This repository has been archived on 2023-10-08. You can view files and clone it, but cannot push or open issues or pull requests.
nixos-home/neovim.lua

72 lines
2 KiB
Lua
Raw Normal View History

2023-09-24 12:57:48 +00:00
--[ 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 }
2023-10-03 06:09:32 +00:00
require'lspconfig'.pyright.setup{}
2023-09-24 12:57:48 +00:00
--[ 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]])
--[ GITSIGNS ]--
require("gitsigns").setup()