diff options
Diffstat (limited to 'nvim/after/plugin')
| -rw-r--r-- | nvim/after/plugin/bufdel.lua | 3 | ||||
| -rw-r--r-- | nvim/after/plugin/bufferline.lua | 22 | ||||
| -rw-r--r-- | nvim/after/plugin/lsp.lua | 58 | ||||
| -rw-r--r-- | nvim/after/plugin/luasnip.lua | 10 | ||||
| -rw-r--r-- | nvim/after/plugin/markdown-preview.lua | 6 | ||||
| -rw-r--r-- | nvim/after/plugin/nvim-cmp.lua | 74 | ||||
| -rw-r--r-- | nvim/after/plugin/nvim-markdown.lua | 9 | ||||
| -rw-r--r-- | nvim/after/plugin/oil.lua | 48 | ||||
| -rw-r--r-- | nvim/after/plugin/treesitter.lua | 21 | ||||
| -rw-r--r-- | nvim/after/plugin/vimtex.lua | 14 |
10 files changed, 265 insertions, 0 deletions
diff --git a/nvim/after/plugin/bufdel.lua b/nvim/after/plugin/bufdel.lua new file mode 100644 index 0000000..12d097f --- /dev/null +++ b/nvim/after/plugin/bufdel.lua @@ -0,0 +1,3 @@ +require('bufdel').setup { + quit = false, -- quit Neovim when last buffer is closed +} diff --git a/nvim/after/plugin/bufferline.lua b/nvim/after/plugin/bufferline.lua new file mode 100644 index 0000000..53db4f3 --- /dev/null +++ b/nvim/after/plugin/bufferline.lua @@ -0,0 +1,22 @@ +vim.cmd.colorscheme "catppuccin" +vim.opt.termguicolors = true + +require("bufferline").setup({ + options = { + offsets = { + { + filetype = "undotree", + text = "Undo Zone", + text_align = "center", + separator = true + } + }, + show_buffer_icons = true, -- disable filetype icons for buffers + separator_style = "thick", + hover = { + enabled = true, + delay = 200, + reveal = {'close'} + }, + } +}) diff --git a/nvim/after/plugin/lsp.lua b/nvim/after/plugin/lsp.lua new file mode 100644 index 0000000..2db301b --- /dev/null +++ b/nvim/after/plugin/lsp.lua @@ -0,0 +1,58 @@ +local lspconfig = require('lspconfig') +local lsp_defaults = lspconfig.util.default_config + +lsp_defaults.capabilities = vim.tbl_deep_extend( + 'force', + lsp_defaults.capabilities, + require('cmp_nvim_lsp').default_capabilities() +) + +vim.api.nvim_create_autocmd('LspAttach', { + desc = 'LSP actions', + callback = function(event) + -- Enable completion triggered by <c-x><c-o> + vim.api.nvim_buf_set_option(event.buf, 'omnifunc', 'v:lua.vim.lsp.omnifunc') + + -- Mappings. + -- See `:help vim.lsp.*` for documentation on any of the below functions + local bufopts = { noremap=true, silent=true, buffer=event.buf } + vim.keymap.set('n', 'gD', vim.lsp.buf.declaration, bufopts) + vim.keymap.set('n', 'gd', vim.lsp.buf.definition, bufopts) + vim.keymap.set('n', 'K', vim.lsp.buf.hover, bufopts) + vim.keymap.set('n', 'gi', vim.lsp.buf.implementation, bufopts) + vim.keymap.set('n', '<C-k>', vim.lsp.buf.signature_help, bufopts) + vim.keymap.set('n', '<leader>wa', vim.lsp.buf.add_workspace_folder, bufopts) + vim.keymap.set('n', '<leader>wr', vim.lsp.buf.remove_workspace_folder, bufopts) + vim.keymap.set('n', '<leader>wl', function() + print(vim.inspect(vim.lsp.buf.list_workspace_folders())) + end, bufopts) + vim.keymap.set('n', '<leader>D', vim.lsp.buf.type_definition, bufopts) + vim.keymap.set('n', '<leader>rn', vim.lsp.buf.rename, bufopts) + vim.keymap.set('n', '<leader>ca', vim.lsp.buf.code_action, bufopts) + vim.keymap.set('n', 'gr', vim.lsp.buf.references, bufopts) + vim.keymap.set('n', '<leader>f', function() vim.lsp.buf.format { async = true } end, bufopts) + end +}) + +require('mason').setup() +require('mason-lspconfig').setup({ + ensure_installed = { + 'julials', + } +}) + +require("mason-lspconfig").setup_handlers { + function (server_name) + lspconfig[server_name].setup {} + end, + + ["julials"] = function () + lspconfig.julials.setup { + on_attach = on_attach, + julia_env_path = "/home/josh/.julia/environments/v1.9/", + filetypes = { "julia", "jl" }, + single_file_support = true + } + end +} + diff --git a/nvim/after/plugin/luasnip.lua b/nvim/after/plugin/luasnip.lua new file mode 100644 index 0000000..140d9b2 --- /dev/null +++ b/nvim/after/plugin/luasnip.lua @@ -0,0 +1,10 @@ +-- Somewhere in your Neovim startup, e.g. init.lua +require("luasnip").config.set_config({ -- Setting LuaSnip config + enable_autosnippets = true, + store_selection_keys = "<Tab>", + region_check_events = 'InsertEnter', + delete_check_events = 'InsertLeave' +}) + +-- Load all snippets from the nvim/LuaSnip directory at startup +require("luasnip.loaders.from_lua").load({paths = "~/.config/nvim/snips/"}) diff --git a/nvim/after/plugin/markdown-preview.lua b/nvim/after/plugin/markdown-preview.lua new file mode 100644 index 0000000..65170e6 --- /dev/null +++ b/nvim/after/plugin/markdown-preview.lua @@ -0,0 +1,6 @@ +vim.cmd([[ + function OpenMarkdownPreview (url) + execute "silent ! firefox --new-window " . a:url + endfunction + let g:mkdp_browserfunc = 'OpenMarkdownPreview' +]]) diff --git a/nvim/after/plugin/nvim-cmp.lua b/nvim/after/plugin/nvim-cmp.lua new file mode 100644 index 0000000..40cb605 --- /dev/null +++ b/nvim/after/plugin/nvim-cmp.lua @@ -0,0 +1,74 @@ +local cmp = require'cmp' +local luasnip = require'luasnip' + +local check_backspace = function() + local col = vim.fn.col "." - 1 + return col == 0 or vim.fn.getline("."):sub(col, col):match "%s" +end + +cmp.setup.filetype({ 'tex' } , { + enabled = false +}) + +cmp.setup({ + snippet = { + expand = function(args) + require('luasnip').lsp_expand(args.body) -- For `luasnip` users. + end, + }, + mapping = cmp.mapping.preset.insert({ + ['<C-b>'] = cmp.mapping.scroll_docs(-4), + ['<C-f>'] = cmp.mapping.scroll_docs(4), + ['<C-Space>'] = cmp.mapping.complete(), + ['<C-c>'] = cmp.mapping.abort(), + ['<CR>'] = cmp.mapping.confirm({ select = false }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items. + ["<Tab>"] = cmp.mapping(function(fallback) + if cmp.visible() then + cmp.select_next_item() + elseif luasnip.expandable() then + luasnip.expand() + elseif luasnip.expand_or_jumpable() then + luasnip.expand_or_jump() + elseif check_backspace() then + fallback() + else + fallback() + end + end, { "i", "s", }), + ["<S-Tab>"] = 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", }), + }), + sources = cmp.config.sources({ + { name = 'nvim_lsp' }, + { name = 'luasnip' }, -- For luasnip users. + }, { + { name = 'buffer' }, + { name = 'path' }, + { name = 'luasnip', option = { use_show_condition = false } }, + }) +}) + +-- Use buffer source for `/` and `?` (if you enabled `native_menu`, this won't work anymore). +cmp.setup.cmdline({ '/', '?' }, { + mapping = cmp.mapping.preset.cmdline(), + sources = { + { name = 'buffer' } + } +}) + +-- Use cmdline & path source for ':' (if you enabled `native_menu`, this won't work anymore). +cmp.setup.cmdline(':', { + mapping = cmp.mapping.preset.cmdline(), + sources = cmp.config.sources({ + { name = 'path' } + }, { + { name = 'cmdline' } + }) +}) diff --git a/nvim/after/plugin/nvim-markdown.lua b/nvim/after/plugin/nvim-markdown.lua new file mode 100644 index 0000000..c11d7ca --- /dev/null +++ b/nvim/after/plugin/nvim-markdown.lua @@ -0,0 +1,9 @@ +vim.g.vim_markdown_conceal = 2 +vim.g.vim_markdown_math = 1 +vim.g.vim_markdown_toc_autofit = 1 + +local map = vim.keymap.set; +local opts = { noremap = false, silent = true} + +map('', 'o', '<Plug>Markdown_NewLineBelow<Esc>', opts) +map('', 'O', '<Plug>Markdown_NewLineAbove<Esc>', opts) diff --git a/nvim/after/plugin/oil.lua b/nvim/after/plugin/oil.lua new file mode 100644 index 0000000..f2a2c7d --- /dev/null +++ b/nvim/after/plugin/oil.lua @@ -0,0 +1,48 @@ +require("oil").setup({ + -- Oil will take over directory buffers (e.g. `vim .` or `:e src/`) + -- Set to false if you still want to use netrw. + default_file_explorer = true, + -- Id is automatically added at the beginning, and name at the end + -- See :help oil-columns + columns = { + "icon", + -- "permissions", + -- "size", + -- "mtime", + }, + -- Buffer-local options to use for oil buffers + buf_options = { + buflisted = false, + bufhidden = "hide", + }, + -- Send deleted files to the trash instead of permanently deleting them (:help oil-trash) + delete_to_trash = true, + -- Skip the confirmation popup for simple operations + skip_confirm_for_simple_edits = false, + -- Selecting a new/moved/renamed file or directory will prompt you to save changes first + prompt_save_on_select_new_entry = true, + -- Keymaps in oil buffer. Can be any value that `vim.keymap.set` accepts OR a table of keymap + -- options with a `callback` (e.g. { callback = function() ... end, desc = "", nowait = true }) + -- Additionally, if it is a string that matches "actions.<name>", + -- it will use the mapping at require("oil.actions").<name> + -- Set to `false` to remove a keymap + -- See :help oil-actions for a list of all available actions + keymaps = { + ["g?"] = "actions.show_help", + ["<CR>"] = "actions.select", + ["<C-s>"] = "actions.select_vsplit", + ["<C-h>"] = "actions.select_split", + ["<C-t>"] = "actions.select_tab", + ["<C-p>"] = "actions.preview", + ["<C-c>"] = "actions.close", + ["<C-l>"] = "actions.refresh", + ["-"] = "actions.parent", + ["_"] = "actions.open_cwd", + ["`"] = "actions.cd", + ["~"] = "actions.tcd", + ["gs"] = "actions.change_sort", + ["g."] = "actions.toggle_hidden", + }, + -- Set to false to disable all of the above keymaps + use_default_keymaps = true, +}) diff --git a/nvim/after/plugin/treesitter.lua b/nvim/after/plugin/treesitter.lua new file mode 100644 index 0000000..268e901 --- /dev/null +++ b/nvim/after/plugin/treesitter.lua @@ -0,0 +1,21 @@ +require'nvim-treesitter.configs'.setup { + -- A list of parser names, or "all" (the five listed parsers should always be installed) + ensure_installed = { "c", "lua", "vim", "vimdoc", "query", "julia", "rust" }, + + -- Install parsers synchronously (only applied to `ensure_installed`) + sync_install = false, + + -- Automatically install missing parsers when entering buffer + -- Recommendation: set to false if you don't have `tree-sitter` CLI installed locally + auto_install = true, + + highlight = { + enable = true, + + -- Setting this to true will run `:h syntax` and tree-sitter at the same time. + -- Set this to `true` if you depend on 'syntax' being enabled (like for indentation). + -- Using this option may slow down your editor, and you may see some duplicate highlights. + -- Instead of true it can also be a list of languages + additional_vim_regex_highlighting = true, + }, +} diff --git a/nvim/after/plugin/vimtex.lua b/nvim/after/plugin/vimtex.lua new file mode 100644 index 0000000..c2b2276 --- /dev/null +++ b/nvim/after/plugin/vimtex.lua @@ -0,0 +1,14 @@ +vim.g.vimtex_view_general_viewer = 'zathura' +vim.g.vimtex_quickfix_open_on_warning = 0 +vim.g.vimtex_imaps_enabled = 0 +vim.cmd([[ +let g:vimtex_compiler_latexmk = { + \ 'options' : [ + \ '-verbose', + \ '-file-line-error', + \ '-synctex=1', + \ '-interaction=nonstopmode', + \ '-shell-escape', + \ ], + \} +]]) |