68 lines
1.9 KiB
Lua
68 lines
1.9 KiB
Lua
|
--[ GLOBAL ]--
|
||
|
|
||
|
vim.o.background = "dark"
|
||
|
vim.cmd([[colorscheme gruvbox]])
|
||
|
vim.g.mapleader = ";"
|
||
|
vim.o.signcolumn = "yes"
|
||
|
vim.wo.number = true
|
||
|
vim.wo.relativenumber = true
|
||
|
vim.wo.cursorline = true
|
||
|
|
||
|
--[ LSPCONFIG ]--
|
||
|
|
||
|
local opts = { noremap=true, silent=true }
|
||
|
local on_attach = function(client, bufnr)
|
||
|
vim.api.nvim_buf_set_option(bufnr, 'omnifunc', 'v:lua.vim.lsp.omnifunc')
|
||
|
local bufopts = { noremap=true, silent=true, buffer=bufnr }
|
||
|
vim.keymap.set('n', '<leader>D', vim.lsp.buf.declaration, bufopts)
|
||
|
vim.keymap.set('n', '<leader>d', vim.lsp.buf.definition, bufopts)
|
||
|
vim.keymap.set('n', '<leader>h', vim.lsp.buf.hover, bufopts)
|
||
|
vim.keymap.set('n', '<leader>i', vim.lsp.buf.implementation, bufopts)
|
||
|
vim.keymap.set('n', '<leader>s', vim.lsp.buf.signature_help, bufopts)
|
||
|
vim.keymap.set('n', '<leader>rn', vim.lsp.buf.rename, bufopts)
|
||
|
vim.keymap.set('n', '<leader>c', vim.lsp.buf.code_action, bufopts)
|
||
|
vim.keymap.set('n', '<leader>fmt', function() vim.lsp.buf.format { async = true } end, bufopts)
|
||
|
end
|
||
|
|
||
|
require'lspconfig'.nil_ls.setup{ on_attach = on_attach }
|
||
|
|
||
|
--[ LEAP ]--
|
||
|
|
||
|
require('leap').add_default_mappings()
|
||
|
-- Don't remap 'x' in visual mode.
|
||
|
vim.keymap.del({'x', 'o'}, 'x')
|
||
|
vim.keymap.del({'x', 'o'}, 'X')
|
||
|
|
||
|
--[ TELESCOPE ]--
|
||
|
|
||
|
local builtin = require('telescope.builtin')
|
||
|
|
||
|
vim.keymap.set('n', '<leader>ff', builtin.find_files, {})
|
||
|
vim.keymap.set('n', '<leader>fg', builtin.live_grep, {})
|
||
|
vim.keymap.set('n', '<leader>fb', builtin.buffers, {})
|
||
|
vim.keymap.set('n', '<leader>fr', builtin.lsp_references, {})
|
||
|
vim.keymap.set('n', '<leader>fs', builtin.lsp_document_symbols, {})
|
||
|
|
||
|
require('telescope').setup{
|
||
|
pickers = {
|
||
|
find_files = {
|
||
|
theme = "dropdown"
|
||
|
},
|
||
|
live_grep = {
|
||
|
theme = "dropdown"
|
||
|
},
|
||
|
buffers = {
|
||
|
theme = "dropdown"
|
||
|
},
|
||
|
lsp_references = {
|
||
|
theme = "dropdown"
|
||
|
},
|
||
|
lsp_document_symbols = {
|
||
|
theme = "dropdown"
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
--[ COMMENTARY ]--
|
||
|
vim.cmd([[autocmd FileType nix setlocal commentstring=#\ %s]])
|