summaryrefslogtreecommitdiff
path: root/after
diff options
context:
space:
mode:
authorGravatar Matthew Wozniak <me@woz.blue> 2024-12-12 22:34:06 -0500
committerGravatar Matthew Wozniak <me@woz.blue> 2024-12-12 22:39:08 -0500
commita7f3bc8f5d8e7fbb3e6b631f9898de3e7d3bba7b (patch)
tree86499eda0fe7761c0e1495bfa2a2b4901ff84b4f /after
downloadnvim-master.tar.gz
nvim-master.zip
configs 2025 initial setupHEADmaster
Diffstat (limited to 'after')
-rw-r--r--after/plugin/cfg.vim6
-rw-r--r--after/plugin/fzf-lua.lua2
-rw-r--r--after/plugin/lsp.lua79
-rw-r--r--after/plugin/vimtex.vim2
4 files changed, 89 insertions, 0 deletions
diff --git a/after/plugin/cfg.vim b/after/plugin/cfg.vim
new file mode 100644
index 0000000..9d95463
--- /dev/null
+++ b/after/plugin/cfg.vim
@@ -0,0 +1,6 @@
+set number
+set autoindent
+set sw=4 ts=4 noet tw=80 cc=80
+set spr sb pb=12 winbl=12 nowrap ruler autoread
+set gfn=Hack:h10 noshowmode
+colorscheme seoul256
diff --git a/after/plugin/fzf-lua.lua b/after/plugin/fzf-lua.lua
new file mode 100644
index 0000000..d687fda
--- /dev/null
+++ b/after/plugin/fzf-lua.lua
@@ -0,0 +1,2 @@
+require('util').nn('<leader>ff', '<cmd>FzfLua files<CR>')
+
diff --git a/after/plugin/lsp.lua b/after/plugin/lsp.lua
new file mode 100644
index 0000000..6eb1ebb
--- /dev/null
+++ b/after/plugin/lsp.lua
@@ -0,0 +1,79 @@
+local lspconfig = require('lspconfig')
+local cmp = require('cmp')
+local cmp_lsp = require('cmp_nvim_lsp')
+
+local nn = require('util').nn
+
+cmp.setup({
+ snippet = {
+ expand = function(args)
+ require('luasnip').lsp_expand(args.body)
+ end,
+ },
+ window = {
+ -- completion = cmp.config.window.bordered(),
+ -- documentation = cmp.config.window.bordered(),
+ },
+ 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-e>'] = cmp.mapping.abort(),
+ ['<Tab>'] = cmp.mapping.select_next_item(),
+ ['<S-Tab>'] = cmp.mapping.select_prev_item(),
+ -- Accept currently selected item. Set `select` to `false` to only
+ -- confirm explicitly selected items.
+ ['<Tab>'] = cmp.mapping.confirm({ select = true }),
+ }),
+ sources = {
+ { name = 'nvim_lsp' },
+ { name = 'buffer' },
+ { name = 'path' },
+ -- For luasnip users.
+ { name = 'luasnip' },
+ },
+})
+
+-- 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' }
+ }),
+ matching = { disallow_symbol_nonprefix_matching = false }
+})
+
+local function onattach(client, buf)
+ nn("gD", vim.lsp.buf.declaration)
+ nn("gd", vim.lsp.buf.definition)
+ nn("<Leader>K", vim.lsp.buf.hover)
+ nn("gi", vim.lsp.buf.implementation)
+ nn("<C-k>", vim.lsp.buf.signature_help)
+ nn("<Leader>D", vim.lsp.buf.type_definition)
+ nn("<Leader>r", vim.lsp.buf.rename)
+ nn("<Leader>A", vim.lsp.buf.code_action)
+ nn("<Leader>R", vim.lsp.buf.references)
+ nn("<Leader>f", vim.lsp.buf.format)
+end
+
+local caps = vim.lsp.protocol.make_client_capabilities()
+caps = cmp_lsp.default_capabilities(caps)
+
+local servers = {'clangd', 'rust_analyzer', 'zls', 'texlab'}
+for _, lsp in pairs(servers) do
+ lspconfig[lsp].setup {
+ capabilities = caps,
+ on_attach = onattach,
+ flags = { debounce_text_changes = 500 }
+ }
+end
diff --git a/after/plugin/vimtex.vim b/after/plugin/vimtex.vim
new file mode 100644
index 0000000..c45ed12
--- /dev/null
+++ b/after/plugin/vimtex.vim
@@ -0,0 +1,2 @@
+let g:vimtex_view_method = 'zathura'
+