Initial commit
This commit is contained in:
commit
66f3983c1a
35 changed files with 913 additions and 0 deletions
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
/spell
|
2
init.lua
Normal file
2
init.lua
Normal file
|
@ -0,0 +1,2 @@
|
|||
require("core")
|
||||
|
44
lazy-lock.json
Normal file
44
lazy-lock.json
Normal file
|
@ -0,0 +1,44 @@
|
|||
{
|
||||
"LuaSnip": { "branch": "master", "commit": "c9b9a22904c97d0eb69ccb9bab76037838326817" },
|
||||
"bufferline.nvim": { "branch": "main", "commit": "17083c826a004bcb87d3a830c7710d0796a73bbf" },
|
||||
"catppuccin": { "branch": "main", "commit": "f67b886d65a029f12ffa298701fb8f1efd89295d" },
|
||||
"cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" },
|
||||
"cmp-nvim-lsp": { "branch": "main", "commit": "99290b3ec1322070bcfb9e846450a46f6efa50f0" },
|
||||
"cmp_luasnip": { "branch": "master", "commit": "98d9cb5c2c38532bd9bdb481067b20fea8f32e90" },
|
||||
"crates.nvim": { "branch": "main", "commit": "bd35b13e94a292ee6e32c351e05ca2202dc9f070" },
|
||||
"diagflow.nvim": { "branch": "main", "commit": "fc09d55d2e60edc8ed8f9939ba97b7b7e6488c99" },
|
||||
"dressing.nvim": { "branch": "master", "commit": "3a45525bb182730fe462325c99395529308f431e" },
|
||||
"gitsigns.nvim": { "branch": "main", "commit": "abcd00a7d5bc1a9470cb21b023c575acade3e4db" },
|
||||
"indent-blankline.nvim": { "branch": "master", "commit": "259357fa4097e232730341fa60988087d189193a" },
|
||||
"lazy.nvim": { "branch": "main", "commit": "d8f26efd456190241afd1b0f5235fe6fdba13d4a" },
|
||||
"lsp-zero.nvim": { "branch": "v3.x", "commit": "ab2a3413646fedd77aa0eab4214a6473e62f6a64" },
|
||||
"lspkind.nvim": { "branch": "master", "commit": "d79a1c3299ad0ef94e255d045bed9fa26025dab6" },
|
||||
"lualine.nvim": { "branch": "master", "commit": "2a5bae925481f999263d6f5ed8361baef8df4f83" },
|
||||
"mini.bufremove": { "branch": "main", "commit": "285bdac9596ee7375db50c0f76ed04336dcd2685" },
|
||||
"mini.icons": { "branch": "main", "commit": "1c79feb7478ca773fa3dac5cadf43ced9180e861" },
|
||||
"mini.indentscope": { "branch": "main", "commit": "da9af64649e114aa79480c238fd23f6524bc0903" },
|
||||
"mini.pairs": { "branch": "main", "commit": "7e834c5937d95364cc1740e20d673afe2d034cdb" },
|
||||
"mini.splitjoin": { "branch": "main", "commit": "3e92f6764e770ba392325cad3a4497adcada695f" },
|
||||
"neo-tree.nvim": { "branch": "v3.x", "commit": "e6645ecfcba3e064446a6def1c10d788c9873f51" },
|
||||
"neorg": { "branch": "main", "commit": "4cbedbbdd4ccb6f45a2045477f5658a1311dffa3" },
|
||||
"noice.nvim": { "branch": "main", "commit": "eaed6cc9c06aa2013b5255349e4f26a6b17ab70f" },
|
||||
"nui.nvim": { "branch": "main", "commit": "53e907ffe5eedebdca1cd503b00aa8692068ca46" },
|
||||
"nvim-cmp": { "branch": "main", "commit": "8c82d0bd31299dbff7f8e780f5e06d2283de9678" },
|
||||
"nvim-lspconfig": { "branch": "master", "commit": "88157521e890fe7fdf18bee22438875edd6300a6" },
|
||||
"nvim-navic": { "branch": "master", "commit": "8649f694d3e76ee10c19255dece6411c29206a54" },
|
||||
"nvim-treesitter": { "branch": "master", "commit": "097fb77312c731347180e8907424f6c967323f05" },
|
||||
"nvim-ts-autotag": { "branch": "main", "commit": "1cca23c9da708047922d3895a71032bc0449c52d" },
|
||||
"nvim-web-devicons": { "branch": "master", "commit": "aafa5c187a15701a7299a392b907ec15d9a7075f" },
|
||||
"plenary.nvim": { "branch": "master", "commit": "3707cdb1e43f5cea73afb6037e6494e7ce847a66" },
|
||||
"ripgrep": { "branch": "master", "commit": "94305125ef33b86151b6cd2ce2b33d641f6b6ac3" },
|
||||
"telescope.nvim": { "branch": "master", "commit": "415af52339215926d705cccc08145f3782c4d132" },
|
||||
"todo-comments.nvim": { "branch": "main", "commit": "ae0a2afb47cf7395dc400e5dc4e05274bf4fb9e0" },
|
||||
"trouble.nvim": { "branch": "main", "commit": "46cf952fc115f4c2b98d4e208ed1e2dce08c9bf6" },
|
||||
"vim-fugitive": { "branch": "master", "commit": "174230d6a7f2df94705a7ffd8d5413e27ec10a80" },
|
||||
"vim-illuminate": { "branch": "master", "commit": "5eeb7951fc630682c322e88a9bbdae5c224ff0aa" },
|
||||
"vim-lumen": { "branch": "master", "commit": "ac13c32c3e309f6c6a84ff6cad8dbb135e75f0e4" },
|
||||
"vim-numbertoggle": { "branch": "main", "commit": "075b7478777e694fbac330ee34a74590dad0fee1" },
|
||||
"vim-sleuth": { "branch": "master", "commit": "be69bff86754b1aa5adcbb527d7fcd1635a84080" },
|
||||
"vimtex": { "branch": "master", "commit": "adce3d38349925a0a891857c74bd4e8d1b8f80ab" },
|
||||
"which-key.nvim": { "branch": "main", "commit": "1f8d414f61e0b05958c342df9b6a4c89ce268766" }
|
||||
}
|
24
lua/core/config.lua
Normal file
24
lua/core/config.lua
Normal file
|
@ -0,0 +1,24 @@
|
|||
-- Cursorline
|
||||
vim.o.cursorline = true
|
||||
|
||||
-- 4 space indent (by default)
|
||||
vim.o.tabstop = 4
|
||||
vim.o.expandtab = true
|
||||
vim.o.softtabstop = 4
|
||||
vim.o.shiftwidth = 4
|
||||
|
||||
-- Relative line numbers
|
||||
vim.o.number = true
|
||||
vim.o.relativenumber = true
|
||||
|
||||
-- Disable word wrap
|
||||
vim.o.wrap = false
|
||||
|
||||
-- Split to right & below
|
||||
vim.o.splitright = true
|
||||
vim.o.splitbelow = true
|
||||
|
||||
-- Use American English
|
||||
vim.o.spelllang = "en_us"
|
||||
--vim.o.spellcapcheck = false
|
||||
|
5
lua/core/init.lua
Normal file
5
lua/core/init.lua
Normal file
|
@ -0,0 +1,5 @@
|
|||
require("core.remap")
|
||||
require("core.lazy")
|
||||
require("core.theme")
|
||||
require("core.config")
|
||||
require("core.neovide")
|
24
lua/core/lazy.lua
Normal file
24
lua/core/lazy.lua
Normal file
|
@ -0,0 +1,24 @@
|
|||
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
|
||||
if not vim.loop.fs_stat(lazypath) then
|
||||
vim.fn.system({
|
||||
"git",
|
||||
"clone",
|
||||
"--filter=blob:none",
|
||||
"https://github.com/folke/lazy.nvim.git",
|
||||
"--branch=stable", -- latest stable release
|
||||
lazypath,
|
||||
})
|
||||
end
|
||||
vim.opt.rtp:prepend(lazypath)
|
||||
|
||||
-- lazy.nvim configuration
|
||||
local plugins_dir = "plugins"
|
||||
local opts = {
|
||||
-- disable change detection because it's annoying
|
||||
change_detection = {
|
||||
enabled = false,
|
||||
notify = false,
|
||||
},
|
||||
}
|
||||
|
||||
require("lazy").setup(plugins_dir, opts)
|
4
lua/core/neovide.lua
Normal file
4
lua/core/neovide.lua
Normal file
|
@ -0,0 +1,4 @@
|
|||
if vim.g.neovide then
|
||||
vim.o.guifont = "IosevkaTerm Nerd Font:h14"
|
||||
vim.g.neovide_floating_shadow = false
|
||||
end
|
7
lua/core/remap.lua
Normal file
7
lua/core/remap.lua
Normal file
|
@ -0,0 +1,7 @@
|
|||
-- Space as leader key
|
||||
vim.g.mapleader = " "
|
||||
vim.g.maplocalleader = "\\"
|
||||
|
||||
-- U as redo (not sure why this doesn't work by default?)
|
||||
vim.api.nvim_set_keymap('n', 'U', '<C-r>', { noremap = true })
|
||||
|
9
lua/core/theme.lua
Normal file
9
lua/core/theme.lua
Normal file
|
@ -0,0 +1,9 @@
|
|||
-- Set colorscheme to dracula
|
||||
vim.cmd[[colorscheme catppuccin]]
|
||||
|
||||
-- Enable for lualine as well
|
||||
require("lualine").setup {
|
||||
options = {
|
||||
theme = "catppuccin",
|
||||
}
|
||||
}
|
37
lua/plugins/bufferline.lua
Normal file
37
lua/plugins/bufferline.lua
Normal file
|
@ -0,0 +1,37 @@
|
|||
return {
|
||||
{
|
||||
"echasnovski/mini.bufremove",
|
||||
version = false,
|
||||
event = "VeryLazy",
|
||||
opts = {},
|
||||
},
|
||||
{
|
||||
"akinsho/bufferline.nvim",
|
||||
event = "VeryLazy",
|
||||
keys = {
|
||||
{ "gn", "<Cmd>BufferLineCycleNext<cr>", desc = "Go to next buffer", },
|
||||
{ "gp", "<Cmd>BufferLineCyclePrev<cr>", desc = "Go to previous buffer", },
|
||||
},
|
||||
opts = {
|
||||
options = {
|
||||
-- fix bug with neotree causing closing tab to close editor
|
||||
close_command = function(n) require("mini.bufremove").delete() end,
|
||||
right_mouse_command = function(n) require("mini.bufremove").delete() end,
|
||||
--always_show_bufferline = false,
|
||||
diagnostics = "nvim_lsp",
|
||||
offsets = { -- From LazyVim; don't show above NeoTree
|
||||
{
|
||||
filetype = "neo-tree",
|
||||
text = "Neo-tree",
|
||||
highlight = "Directory",
|
||||
text_align = "left",
|
||||
},
|
||||
},
|
||||
}
|
||||
},
|
||||
},
|
||||
{
|
||||
"nvim-tree/nvim-web-devicons",
|
||||
lazy = true
|
||||
},
|
||||
}
|
11
lua/plugins/git.lua
Normal file
11
lua/plugins/git.lua
Normal file
|
@ -0,0 +1,11 @@
|
|||
return {
|
||||
{
|
||||
"lewis6991/gitsigns.nvim",
|
||||
event = "VeryLazy",
|
||||
opts = {},
|
||||
},
|
||||
{
|
||||
"tpope/vim-fugitive",
|
||||
cmd = "Git",
|
||||
},
|
||||
}
|
22
lua/plugins/illuminate.lua
Normal file
22
lua/plugins/illuminate.lua
Normal file
|
@ -0,0 +1,22 @@
|
|||
return {
|
||||
{
|
||||
"RRethy/vim-illuminate",
|
||||
event = "VeryLazy",
|
||||
opts = {
|
||||
delay = 200,
|
||||
large_file_cutoff = 2000,
|
||||
large_file_overrides = {
|
||||
providers = { "lsp" },
|
||||
},
|
||||
filetypes_denylist = {
|
||||
"neo-tree",
|
||||
'dirbuf',
|
||||
'dirvish',
|
||||
'fugitive',
|
||||
},
|
||||
},
|
||||
config = function(_, opts)
|
||||
require("illuminate").configure(opts)
|
||||
end,
|
||||
}
|
||||
}
|
49
lua/plugins/indent.lua
Normal file
49
lua/plugins/indent.lua
Normal file
|
@ -0,0 +1,49 @@
|
|||
local indent_exclude_filetypes = {
|
||||
"help",
|
||||
"alpha",
|
||||
"dashboard",
|
||||
"neo-tree",
|
||||
"Trouble",
|
||||
"trouble",
|
||||
"lazy",
|
||||
"mason",
|
||||
"notify",
|
||||
"toggleterm",
|
||||
"lazyterm",
|
||||
}
|
||||
|
||||
return {
|
||||
{
|
||||
"lukas-reineke/indent-blankline.nvim",
|
||||
main = "ibl",
|
||||
event = "VeryLazy",
|
||||
opts = {
|
||||
indent = {
|
||||
char = "│",
|
||||
tab_char = "│",
|
||||
},
|
||||
scope = { enabled = false },
|
||||
exclude = {
|
||||
filetypes = indent_exclude_filetypes,
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
"echasnovski/mini.indentscope",
|
||||
event = "VeryLazy",
|
||||
opts = {
|
||||
-- symbol = "▏",
|
||||
symbol = "│",
|
||||
options = { try_as_border = true },
|
||||
},
|
||||
init = function()
|
||||
vim.api.nvim_create_autocmd("FileType", {
|
||||
pattern = indent_exclude_filetypes,
|
||||
callback = function()
|
||||
vim.b.miniindentscope_disable = true
|
||||
end,
|
||||
})
|
||||
end,
|
||||
}
|
||||
}
|
||||
|
10
lua/plugins/lang/bash.lua
Normal file
10
lua/plugins/lang/bash.lua
Normal file
|
@ -0,0 +1,10 @@
|
|||
return {
|
||||
{
|
||||
"VonHeikemen/lsp-zero.nvim",
|
||||
opts = {
|
||||
my_servers = {
|
||||
bashls = {},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
15
lua/plugins/lang/c.lua
Normal file
15
lua/plugins/lang/c.lua
Normal file
|
@ -0,0 +1,15 @@
|
|||
return {
|
||||
{
|
||||
"VonHeikemen/lsp-zero.nvim",
|
||||
opts = {
|
||||
my_servers = {
|
||||
clangd = {
|
||||
cmd = {
|
||||
"clangd",
|
||||
"--function-arg-placeholders=0",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
10
lua/plugins/lang/go.lua
Normal file
10
lua/plugins/lang/go.lua
Normal file
|
@ -0,0 +1,10 @@
|
|||
return {
|
||||
{
|
||||
"VonHeikemen/lsp-zero.nvim",
|
||||
opts = {
|
||||
my_servers = {
|
||||
gopls = {},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
8
lua/plugins/lang/js.lua
Normal file
8
lua/plugins/lang/js.lua
Normal file
|
@ -0,0 +1,8 @@
|
|||
return {
|
||||
{
|
||||
"windwp/nvim-ts-autotag",
|
||||
event = "VeryLazy",
|
||||
opts = {},
|
||||
},
|
||||
}
|
||||
|
10
lua/plugins/lang/python.lua
Normal file
10
lua/plugins/lang/python.lua
Normal file
|
@ -0,0 +1,10 @@
|
|||
return {
|
||||
{
|
||||
"VonHeikemen/lsp-zero.nvim",
|
||||
opts = {
|
||||
my_servers = {
|
||||
pylsp = {},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
10
lua/plugins/lang/racket.lua
Normal file
10
lua/plugins/lang/racket.lua
Normal file
|
@ -0,0 +1,10 @@
|
|||
return {
|
||||
{
|
||||
"VonHeikemen/lsp-zero.nvim",
|
||||
opts = {
|
||||
my_servers = {
|
||||
racket_langserver = {},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
52
lua/plugins/lang/rust.lua
Normal file
52
lua/plugins/lang/rust.lua
Normal file
|
@ -0,0 +1,52 @@
|
|||
return {
|
||||
{
|
||||
"VonHeikemen/lsp-zero.nvim",
|
||||
opts = {
|
||||
my_servers = {
|
||||
rust_analyzer = {
|
||||
settings = {
|
||||
['rust-analyzer'] = {
|
||||
completion = {
|
||||
callable = {
|
||||
snippets = "add_parentheses",
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
"Saecki/crates.nvim",
|
||||
event = { "BufRead Cargo.toml" },
|
||||
dependencies = {
|
||||
{
|
||||
"hrsh7th/nvim-cmp",
|
||||
opts = function(_, opts)
|
||||
table.insert(opts.sources, { name = "crates" })
|
||||
end,
|
||||
},
|
||||
},
|
||||
opts = {
|
||||
completion = {
|
||||
cmp = { enabled = true },
|
||||
},
|
||||
-- locali(z|s)ation
|
||||
thousands_separator = ",",
|
||||
},
|
||||
config = function(_, opts)
|
||||
-- K hover keybind
|
||||
local docs_keybind = function()
|
||||
if vim.fn.expand("%:t") == "Cargo.toml" and require("crates").popup_available() then
|
||||
require("crates").show_popup()
|
||||
else
|
||||
vim.lsp.buf.hover()
|
||||
end
|
||||
end
|
||||
vim.keymap.set("n", "K", docs_keybind, { desc = "Show documentation" })
|
||||
|
||||
require("crates").setup(opts)
|
||||
end,
|
||||
},
|
||||
}
|
50
lua/plugins/lang/tex.lua
Normal file
50
lua/plugins/lang/tex.lua
Normal file
|
@ -0,0 +1,50 @@
|
|||
return {
|
||||
{
|
||||
"VonHeikemen/lsp-zero.nvim",
|
||||
opts = {
|
||||
my_servers = {
|
||||
texlab = {},
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
"lervag/vimtex",
|
||||
lazy = true,
|
||||
ft = { "tex", "bib" },
|
||||
config = function()
|
||||
-- Block taken from LazyVim; disable conceal for TeX files, and mitigate conflicts
|
||||
vim.api.nvim_create_autocmd({ "FileType" }, {
|
||||
group = vim.api.nvim_create_augroup("lazyvim_vimtex_conceal", { clear = true }),
|
||||
pattern = { "bib", "tex" },
|
||||
callback = function()
|
||||
vim.wo.conceallevel = 2
|
||||
end,
|
||||
})
|
||||
vim.g.vimtex_mappings_disable = { ["n"] = { "K" } } -- disable `K` as it conflicts with LSP hover
|
||||
vim.g.vimtex_quickfix_method = vim.fn.executable("pplatex") == 1 and "pplatex" or "latexlog"
|
||||
|
||||
-- only open quickfix menu on *error*, not warning
|
||||
vim.g.vimtex_quickfix_open_on_warning = 0
|
||||
|
||||
-- Tell VimTeX that treesitter is managing syntax highlighting
|
||||
vim.g.vimtex_syntax_enabled = 0
|
||||
|
||||
-- Use Zathura instead of Evince
|
||||
--vim.g.vimtex_view_method = "zathura"
|
||||
vim.g.vimtex_view_forward_search_on_start = 0
|
||||
|
||||
-- TeX file-specific options
|
||||
vim.api.nvim_create_autocmd("FileType", {
|
||||
pattern = "tex",
|
||||
callback = function(opts)
|
||||
-- Enable word wrap
|
||||
vim.opt_local.wrap = true
|
||||
vim.opt_local.linebreak = true
|
||||
|
||||
-- Enable spell-check
|
||||
vim.opt_local.spell = true
|
||||
end,
|
||||
})
|
||||
end,
|
||||
},
|
||||
}
|
175
lua/plugins/lsp.lua
Normal file
175
lua/plugins/lsp.lua
Normal file
|
@ -0,0 +1,175 @@
|
|||
return {
|
||||
{
|
||||
"VonHeikemen/lsp-zero.nvim",
|
||||
branch = "v3.x",
|
||||
dependencies = {
|
||||
"neovim/nvim-lspconfig",
|
||||
"SmiteshP/nvim-navic",
|
||||
},
|
||||
opts = {
|
||||
-- Servers configured in my_servers will automatically have
|
||||
-- require("lspconfig")[server].setup(server_opts) called on them
|
||||
my_servers = {},
|
||||
},
|
||||
config = function(_, opts)
|
||||
local lsp_zero = require("lsp-zero")
|
||||
local lspconfig = require("lspconfig")
|
||||
|
||||
-- enable lsp-zero
|
||||
lsp_zero.on_attach(function(client, buffnr)
|
||||
-- set lsp keybinds
|
||||
-- NOTE: this check is needed since crates.nvim will overwrite "K"
|
||||
if not vim.fn.mapcheck("K", "n") then
|
||||
vim.keymap.set("n", "K", vim.lsp.buf.hover, { desc = "Show documentation" })
|
||||
end
|
||||
vim.keymap.set("n", "gd", vim.lsp.buf.definition, { desc = "Go to definition" })
|
||||
vim.keymap.set("n", "gD", vim.lsp.buf.declaration, { desc = "Go to declaration" })
|
||||
vim.keymap.set("n", "gi", vim.lsp.buf.implementation, { desc = "Go to implementation" })
|
||||
vim.keymap.set("n", "go", vim.lsp.buf.type_definition, { desc = "Go to object type definition" })
|
||||
vim.keymap.set("n", "<leader>r", vim.lsp.buf.rename, { desc = "Rename symbol under cursor" })
|
||||
vim.keymap.set("n", "<F2>", vim.lsp.buf.rename, { desc = "Rename symbol under cursor" })
|
||||
vim.keymap.set("n", "<leader>a", vim.lsp.buf.code_action, { desc = "Open code actions" })
|
||||
vim.keymap.set("n", "<leader>m", vim.lsp.buf.format, { desc = "Format current file" })
|
||||
|
||||
-- use telescope for LSP references, etc
|
||||
vim.keymap.set("n", "gr", "<cmd>Telescope lsp_references<cr>", { buffer = buffnr, desc = "Go to references" })
|
||||
|
||||
-- Use navic for context hints
|
||||
if client.supports_method("textDocument/documentSymbol") then
|
||||
require("nvim-navic").attach(client, buffnr)
|
||||
end
|
||||
end)
|
||||
|
||||
-- use pretty icons instead of 'W', 'E', ...
|
||||
lsp_zero.set_sign_icons({
|
||||
error = '✘',
|
||||
warn = '▲',
|
||||
hint = '⚑',
|
||||
info = '»'
|
||||
})
|
||||
|
||||
-- disable LSP logging
|
||||
vim.lsp.set_log_level("off")
|
||||
|
||||
-- Set up language servers
|
||||
local servers = opts.my_servers
|
||||
for server, server_opts in pairs(servers) do
|
||||
require("lspconfig")[server].setup(server_opts)
|
||||
end
|
||||
end,
|
||||
},
|
||||
{
|
||||
"hrsh7th/nvim-cmp",
|
||||
event = "InsertEnter",
|
||||
dependencies = {
|
||||
"onsails/lspkind.nvim",
|
||||
"L3MON4D3/LuaSnip",
|
||||
"hrsh7th/cmp-nvim-lsp",
|
||||
"hrsh7th/cmp-buffer",
|
||||
"saadparwaiz1/cmp_luasnip",
|
||||
},
|
||||
opts = function()
|
||||
local cmp = require("cmp")
|
||||
local luasnip = require("luasnip")
|
||||
local luasnip_snipmate = require("luasnip.loaders.from_snipmate")
|
||||
|
||||
-- set up snippet engine
|
||||
luasnip_snipmate.lazy_load()
|
||||
-- functions for handling <Tab> and <S-Tab> with snippets
|
||||
-- taken from nvim-cmp docs
|
||||
local tab_mapping = cmp.mapping(function(fallback)
|
||||
local has_words_before = function()
|
||||
unpack = unpack or table.unpack
|
||||
local line, col = unpack(vim.api.nvim_win_get_cursor(0))
|
||||
return col ~= 0 and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match("%s") == nil
|
||||
end
|
||||
if cmp.visible() then
|
||||
cmp.select_next_item()
|
||||
-- You could replace the expand_or_jumpable() calls with expand_or_locally_jumpable()
|
||||
-- that way you will only jump inside the snippet region
|
||||
elseif luasnip.expand_or_locally_jumpable() then
|
||||
luasnip.expand_or_jump()
|
||||
elseif has_words_before() then
|
||||
cmp.complete()
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end, { "i", "s" })
|
||||
local s_tab_mapping = cmp.mapping(function(fallback)
|
||||
if cmp.visible() then
|
||||
cmp.select_prev_item()
|
||||
elseif luasnip.jumpable(-1) then
|
||||
luasnip.jump(-1)
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end, { "i", "s" })
|
||||
|
||||
-- configuration for nvim-cmp
|
||||
return {
|
||||
sources = cmp.config.sources({
|
||||
{ name = "nvim_lsp" },
|
||||
{ name = "luasnip" },
|
||||
}, {
|
||||
{ name = "buffer" },
|
||||
}),
|
||||
mapping = {
|
||||
-- Use "Enter" for auto completion
|
||||
["<cr>"] = cmp.mapping.confirm({select = false}),
|
||||
["<Tab>"] = tab_mapping,
|
||||
["<S-Tab>"] = s_tab_mapping,
|
||||
},
|
||||
window = {
|
||||
-- Borders around completion window
|
||||
completion = cmp.config.window.bordered(),
|
||||
documentation = cmp.config.window.bordered(),
|
||||
},
|
||||
formatting = {
|
||||
-- Enable lsp-kind for icons in completion window
|
||||
fields = {'abbr', 'kind', 'menu'},
|
||||
-- Formatter taken from LazyVim
|
||||
format = function(entry, vim_item)
|
||||
local kind = require("lspkind").cmp_format({
|
||||
mode = "symbol_text",
|
||||
maxwidth = 50,
|
||||
})(entry, vim_item)
|
||||
local strings = vim.split(kind.kind, "%s", { trimempty = true })
|
||||
kind.kind = " " .. (strings[1] or "") .. " "
|
||||
kind.menu = " (" .. (strings[2] or "") .. ")"
|
||||
|
||||
return kind
|
||||
end,
|
||||
},
|
||||
}
|
||||
end,
|
||||
},
|
||||
{
|
||||
"dgagn/diagflow.nvim",
|
||||
event = "LspAttach",
|
||||
opts = {
|
||||
scope = "line",
|
||||
},
|
||||
},
|
||||
{
|
||||
"folke/trouble.nvim",
|
||||
dependencies = { "nvim-tree/nvim-web-devicons" },
|
||||
cmd = { "Trouble" },
|
||||
keys = {
|
||||
{ "<leader>d", "<cmd>Trouble diagnostics toggle filter.buf=0<cr>", desc = "Open file diagnostic list" },
|
||||
{ "<leader>D", "<cmd>Trouble diagnostics toggle<cr>", desc = "Open workspace diagnostic list" },
|
||||
},
|
||||
opts = {
|
||||
focus = true,
|
||||
use_diagnostic_signs = true,
|
||||
keys = {
|
||||
-- both q and <esc> to close trouble
|
||||
q = "close",
|
||||
["<esc>"] = "close",
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
|
||||
-- Import language configs
|
||||
{ import = "plugins.lang" },
|
||||
}
|
34
lua/plugins/lualine.lua
Normal file
34
lua/plugins/lualine.lua
Normal file
|
@ -0,0 +1,34 @@
|
|||
return {
|
||||
{
|
||||
"nvim-lualine/lualine.nvim",
|
||||
dependencies = {
|
||||
"SmiteshP/nvim-navic",
|
||||
},
|
||||
opts = {
|
||||
sections = {
|
||||
lualine_c = {
|
||||
{ "navic" },
|
||||
},
|
||||
lualine_x = {
|
||||
"%S", -- showcmd
|
||||
"encoding",
|
||||
"fileformat",
|
||||
"filetype",
|
||||
}
|
||||
},
|
||||
extensions = {
|
||||
"neo-tree",
|
||||
},
|
||||
},
|
||||
config = function(_, opts)
|
||||
-- No need to show mode
|
||||
vim.o.showmode = false
|
||||
-- Show "showcmd" in lualine
|
||||
vim.o.showcmdloc = "statusline"
|
||||
|
||||
-- Set up lualine for now;
|
||||
-- this might be called again to change the theme
|
||||
require("lualine").setup(opts)
|
||||
end,
|
||||
}
|
||||
}
|
54
lua/plugins/neorg.lua
Normal file
54
lua/plugins/neorg.lua
Normal file
|
@ -0,0 +1,54 @@
|
|||
return {
|
||||
{
|
||||
"nvim-neorg/neorg",
|
||||
version = "v7.0.0", -- pin to pre-luarocks version
|
||||
build = ":Neorg sync-parsers",
|
||||
priority = 30, -- should load after treesitter
|
||||
ft = "norg",
|
||||
cmd = "Neorg",
|
||||
keys = {
|
||||
{ "<leader>n", "<cmd>Neorg index<cr>", desc = "Open Neorg" },
|
||||
{ "<leader>N", "<cmd>Neorg return<cr>", desc = "Close Neorg" },
|
||||
},
|
||||
dependencies = {
|
||||
"nvim-lua/plenary.nvim"
|
||||
},
|
||||
config = function()
|
||||
require("neorg").setup({
|
||||
load = {
|
||||
["core.defaults"] = {}, -- Loads default behaviour
|
||||
["core.concealer"] = {}, -- Adds pretty icons to your documents
|
||||
["core.dirman"] = { -- Manages Neorg workspaces
|
||||
config = {
|
||||
workspaces = {
|
||||
notes = "~/notes",
|
||||
},
|
||||
default_workspace = "notes",
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
-- add neorg-specific options
|
||||
vim.api.nvim_create_autocmd("FileType", {
|
||||
pattern = "norg",
|
||||
callback = function()
|
||||
-- enable word wrap
|
||||
vim.opt_local.wrap = true
|
||||
vim.opt_local.linebreak = true
|
||||
|
||||
-- create localleader keybindings
|
||||
local buf = vim.api.nvim_get_current_buf()
|
||||
vim.keymap.set("n",
|
||||
"<localleader>c",
|
||||
"<cmd>Neorg toggle-concealer<cr>",
|
||||
{ desc = "Toggle concealer",
|
||||
buffer = buf,
|
||||
noremap = false
|
||||
})
|
||||
end,
|
||||
})
|
||||
end,
|
||||
},
|
||||
}
|
||||
|
41
lua/plugins/neotree.lua
Normal file
41
lua/plugins/neotree.lua
Normal file
|
@ -0,0 +1,41 @@
|
|||
return {
|
||||
{
|
||||
"nvim-neo-tree/neo-tree.nvim",
|
||||
branch = "v3.x",
|
||||
dependencies = {
|
||||
"nvim-lua/plenary.nvim",
|
||||
"nvim-tree/nvim-web-devicons", -- not strictly required, but recommended
|
||||
"MunifTanjim/nui.nvim",
|
||||
-- "3rd/image.nvim", -- Optional image support in preview window: See `# Preview Mode` for more information
|
||||
},
|
||||
keys = {
|
||||
{
|
||||
"<leader>e",
|
||||
function()
|
||||
require("neo-tree.command").execute({ toggle = true, dir = vim.loop.cwd() })
|
||||
end,
|
||||
desc = "Open file explorer",
|
||||
},
|
||||
},
|
||||
opts = {
|
||||
open_files_do_not_replace_types = { "terminal", "Trouble", "trouble", }, -- From LazyVim
|
||||
close_if_last_window = true,
|
||||
window = {
|
||||
width = 30,
|
||||
mappings = {
|
||||
["<space>"] = "none",
|
||||
},
|
||||
},
|
||||
},
|
||||
init = function()
|
||||
-- Load instead of netrw
|
||||
if vim.fn.argc(-1) == 1 then
|
||||
local stat = vim.loop.fs_stat(vim.fn.argv(0))
|
||||
if stat and stat.type == "directory" then
|
||||
require("neo-tree")
|
||||
end
|
||||
end
|
||||
end,
|
||||
},
|
||||
}
|
||||
|
5
lua/plugins/numbertoggle.lua
Normal file
5
lua/plugins/numbertoggle.lua
Normal file
|
@ -0,0 +1,5 @@
|
|||
return {
|
||||
{
|
||||
"jeffkreeftmeijer/vim-numbertoggle",
|
||||
},
|
||||
}
|
7
lua/plugins/pairs.lua
Normal file
7
lua/plugins/pairs.lua
Normal file
|
@ -0,0 +1,7 @@
|
|||
return {
|
||||
{
|
||||
"echasnovski/mini.pairs",
|
||||
event = "VeryLazy",
|
||||
opts = {},
|
||||
}
|
||||
}
|
5
lua/plugins/sleuth.lua
Normal file
5
lua/plugins/sleuth.lua
Normal file
|
@ -0,0 +1,5 @@
|
|||
return {
|
||||
{
|
||||
"tpope/vim-sleuth",
|
||||
}
|
||||
}
|
16
lua/plugins/splitjoin.lua
Normal file
16
lua/plugins/splitjoin.lua
Normal file
|
@ -0,0 +1,16 @@
|
|||
return {
|
||||
{
|
||||
'echasnovski/mini.splitjoin',
|
||||
version = false,
|
||||
keys = {
|
||||
{ "gS", function() require("mini.splitjoin").toggle() end, desc = "Toggle splitjoin" },
|
||||
},
|
||||
opts = {
|
||||
mappings = {
|
||||
toggle = '',
|
||||
split = '',
|
||||
join = '',
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
56
lua/plugins/telescope.lua
Normal file
56
lua/plugins/telescope.lua
Normal file
|
@ -0,0 +1,56 @@
|
|||
return {
|
||||
{
|
||||
"nvim-telescope/telescope.nvim",
|
||||
dependencies = {
|
||||
"nvim-lua/plenary.nvim",
|
||||
"BurntSushi/ripgrep",
|
||||
},
|
||||
keys = {
|
||||
{ "<leader>f", "<cmd>Telescope find_files<cr>", desc = "Open file picker", },
|
||||
{ "<leader>/", "<cmd>Telescope live_grep<cr>", desc = "Global search", },
|
||||
{ "<leader>b", "<cmd>Telescope buffers<cr>", desc = "Open buffer picker", },
|
||||
{ "<leader>j", "<cmd>Telescope jumplist<cr>", desc = "Open jumplist picker", },
|
||||
{ "<leader>g", "", desc = "Git", },
|
||||
{ "<leader>gf", "<cmd>Telescope git_files<cr>", desc = "Open git file picker", },
|
||||
{ "<leader>gc", "<cmd>Telescope git_commits<cr>", desc = "Browse git commits", },
|
||||
{ "<leader>gd", "<cmd>Telescope git_status<cr>", desc = "View git diff", },
|
||||
},
|
||||
cmd = "Telescope",
|
||||
opts = {
|
||||
defaults = {
|
||||
layout_config = {
|
||||
horizontal = {
|
||||
preview_width = 0.6,
|
||||
-- Show preview even for small windows
|
||||
--preview_cutoff = 50,
|
||||
},
|
||||
},
|
||||
},
|
||||
pickers = {
|
||||
diagnostics = {
|
||||
theme = "dropdown",
|
||||
layout_config = {
|
||||
width = 0.9,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
config = function(_, opts)
|
||||
local actions = require("telescope.actions")
|
||||
opts.defaults.mappings = { i = { ["<esc>"] = actions.close } }
|
||||
|
||||
local telescope = require("telescope")
|
||||
telescope.setup(opts)
|
||||
end,
|
||||
},
|
||||
{
|
||||
"folke/todo-comments.nvim",
|
||||
event = "VeryLazy",
|
||||
dependencies = { "nvim-lua/plenary.nvim", "nvim-telescope/telescope.nvim" },
|
||||
opts = {},
|
||||
keys = {
|
||||
{ "<leader>t", "<cmd>TodoTelescope<cr>", desc = "Open workspace TODOs listing", },
|
||||
},
|
||||
}
|
||||
}
|
||||
|
20
lua/plugins/theme.lua
Normal file
20
lua/plugins/theme.lua
Normal file
|
@ -0,0 +1,20 @@
|
|||
return {
|
||||
{
|
||||
"catppuccin/nvim",
|
||||
name = "catppuccin",
|
||||
lazy = false,
|
||||
priority = 1000,
|
||||
opts = {
|
||||
integrations = {
|
||||
noice = true,
|
||||
notify = true,
|
||||
lsp_trouble = true,
|
||||
which_key = true,
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
-- auto-switch when GNOME theme changes
|
||||
"vimpostor/vim-lumen",
|
||||
},
|
||||
}
|
15
lua/plugins/treesitter.lua
Normal file
15
lua/plugins/treesitter.lua
Normal file
|
@ -0,0 +1,15 @@
|
|||
return {
|
||||
{
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
version = false, -- From LazyVim
|
||||
build = ":TSUpdate",
|
||||
opts = {
|
||||
highlight = { enable = true },
|
||||
indent = { enable = true },
|
||||
ensure_installed = "all",
|
||||
},
|
||||
config = function(_, opts)
|
||||
require("nvim-treesitter.configs").setup(opts)
|
||||
end,
|
||||
}
|
||||
}
|
60
lua/plugins/ui.lua
Normal file
60
lua/plugins/ui.lua
Normal file
|
@ -0,0 +1,60 @@
|
|||
return {
|
||||
{
|
||||
"folke/noice.nvim",
|
||||
event = "VeryLazy",
|
||||
opts = {
|
||||
lsp = {
|
||||
-- override markdown rendering so that **cmp** and other plugins use **Treesitter**
|
||||
override = {
|
||||
["vim.lsp.util.convert_input_to_markdown_lines"] = true,
|
||||
["vim.lsp.util.stylize_markdown"] = true,
|
||||
["cmp.entry.get_documentation"] = true,
|
||||
},
|
||||
},
|
||||
presets = {
|
||||
bottom_search = true, -- use a classic bottom cmdline for search
|
||||
command_palette = true, -- position the cmdline and popupmenu together
|
||||
long_message_to_split = true, -- long messages will be sent to a split
|
||||
inc_rename = false, -- enables an input dialog for inc-rename.nvim
|
||||
lsp_doc_border = true, -- add a border to hover docs and signature help
|
||||
},
|
||||
},
|
||||
dependencies = {
|
||||
{
|
||||
"stevearc/dressing.nvim",
|
||||
opts = {
|
||||
input = {
|
||||
mappings = {
|
||||
i = {
|
||||
["<Esc>"] = "Close",
|
||||
},
|
||||
},
|
||||
},
|
||||
select = {
|
||||
backend = { "telescope" },
|
||||
telescope = require("telescope.themes").get_cursor(),
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
"MunifTanjim/nui.nvim"
|
||||
},
|
||||
--{
|
||||
-- "rcarriga/nvim-notify",
|
||||
-- keys = {
|
||||
-- {
|
||||
-- "<leader>u",
|
||||
-- function()
|
||||
-- require("notify").dismiss()
|
||||
-- end,
|
||||
-- desc = "Dismiss all notifications"
|
||||
-- },
|
||||
-- },
|
||||
-- opts = {
|
||||
-- top_down = false,
|
||||
-- },
|
||||
--},
|
||||
}
|
||||
}
|
||||
}
|
||||
|
15
lua/plugins/whichkey.lua
Normal file
15
lua/plugins/whichkey.lua
Normal file
|
@ -0,0 +1,15 @@
|
|||
return {
|
||||
{
|
||||
"folke/which-key.nvim",
|
||||
dependencies = {
|
||||
"echasnovski/mini.icons",
|
||||
},
|
||||
event = "VeryLazy",
|
||||
init = function()
|
||||
vim.o.timeout = true
|
||||
vim.o.timeoutlen = 300
|
||||
end,
|
||||
opts = {},
|
||||
}
|
||||
}
|
||||
|
6
snippets/tex.snippets
Normal file
6
snippets/tex.snippets
Normal file
|
@ -0,0 +1,6 @@
|
|||
# LaTeX Snippets
|
||||
|
||||
snippet beg "begin/end snippet"
|
||||
\begin{$1}
|
||||
$0
|
||||
\end{$1}
|
Loading…
Add table
Reference in a new issue