diff options
author | Thomas Voss <mail@thomasvoss.com> | 2023-09-12 12:16:31 +0200 |
---|---|---|
committer | Thomas Voss <mail@thomasvoss.com> | 2023-09-12 12:16:31 +0200 |
commit | 24fc98bfaca3f07c90ff33a3bfeb738fd84ff79a (patch) | |
tree | 7c5c9c870ed808d5cbee848808c70ff9ec1816c3 /.config | |
parent | a5feec43c14bd05e8dd98d24fba7e25fdbb6fd7d (diff) |
nvim: Add extensive Neovim configuration
Diffstat (limited to '.config')
-rw-r--r-- | .config/nvim/.gitignore | 6 | ||||
-rw-r--r-- | .config/nvim/after/ftplugin/c.lua | 3 | ||||
-rw-r--r-- | .config/nvim/after/ftplugin/go.lua | 3 | ||||
-rw-r--r-- | .config/nvim/after/ftplugin/html.lua | 3 | ||||
-rw-r--r-- | .config/nvim/after/ftplugin/mail.lua | 5 | ||||
-rw-r--r-- | .config/nvim/after/ftplugin/python.lua | 2 | ||||
-rw-r--r-- | .config/nvim/after/ftplugin/rust.lua | 2 | ||||
-rw-r--r-- | .config/nvim/after/plugin/colors.lua | 11 | ||||
-rw-r--r-- | .config/nvim/after/plugin/fugitive.lua | 1 | ||||
-rw-r--r-- | .config/nvim/after/plugin/gsp.lua | 3 | ||||
-rw-r--r-- | .config/nvim/after/plugin/lsp.lua | 40 | ||||
-rw-r--r-- | .config/nvim/after/plugin/telescope.lua | 8 | ||||
-rw-r--r-- | .config/nvim/after/plugin/treesitter.lua | 23 | ||||
-rw-r--r-- | .config/nvim/after/plugin/undotree.lua | 1 | ||||
-rw-r--r-- | .config/nvim/init.lua | 1 | ||||
-rw-r--r-- | .config/nvim/init.vim | 30 |
16 files changed, 112 insertions, 30 deletions
diff --git a/.config/nvim/.gitignore b/.config/nvim/.gitignore new file mode 100644 index 0000000..7fd58ac --- /dev/null +++ b/.config/nvim/.gitignore @@ -0,0 +1,6 @@ +/ftdetect +/ftplugin +/indent +/lua +/plugin +/syntax diff --git a/.config/nvim/after/ftplugin/c.lua b/.config/nvim/after/ftplugin/c.lua new file mode 100644 index 0000000..f37ef07 --- /dev/null +++ b/.config/nvim/after/ftplugin/c.lua @@ -0,0 +1,3 @@ +local lib = require('mango.lib') + +lib.setTabWidth(8, true) diff --git a/.config/nvim/after/ftplugin/go.lua b/.config/nvim/after/ftplugin/go.lua new file mode 100644 index 0000000..f37ef07 --- /dev/null +++ b/.config/nvim/after/ftplugin/go.lua @@ -0,0 +1,3 @@ +local lib = require('mango.lib') + +lib.setTabWidth(8, true) diff --git a/.config/nvim/after/ftplugin/html.lua b/.config/nvim/after/ftplugin/html.lua new file mode 100644 index 0000000..4a52958 --- /dev/null +++ b/.config/nvim/after/ftplugin/html.lua @@ -0,0 +1,3 @@ +local lib = require('mango.lib') + +lib.setTabWidth(2, true) diff --git a/.config/nvim/after/ftplugin/mail.lua b/.config/nvim/after/ftplugin/mail.lua new file mode 100644 index 0000000..c6bb6a2 --- /dev/null +++ b/.config/nvim/after/ftplugin/mail.lua @@ -0,0 +1,5 @@ +local lib = require('mango.lib') + +lib.setTabWidth(2, true) +vim.opt_local.expandtab = true +vim.opt_local.textwidth = 73 diff --git a/.config/nvim/after/ftplugin/python.lua b/.config/nvim/after/ftplugin/python.lua new file mode 100644 index 0000000..a97fe2e --- /dev/null +++ b/.config/nvim/after/ftplugin/python.lua @@ -0,0 +1,2 @@ +vim.opt_local.textwidth = 100 +vim.opt_local.expandtab = false diff --git a/.config/nvim/after/ftplugin/rust.lua b/.config/nvim/after/ftplugin/rust.lua new file mode 100644 index 0000000..a97fe2e --- /dev/null +++ b/.config/nvim/after/ftplugin/rust.lua @@ -0,0 +1,2 @@ +vim.opt_local.textwidth = 100 +vim.opt_local.expandtab = false diff --git a/.config/nvim/after/plugin/colors.lua b/.config/nvim/after/plugin/colors.lua new file mode 100644 index 0000000..654b217 --- /dev/null +++ b/.config/nvim/after/plugin/colors.lua @@ -0,0 +1,11 @@ +require('rose-pine').setup({ + disable_background = true +}) + +function SetTheme(color) + vim.cmd.colorscheme(color or 'rose-pine') + vim.api.nvim_set_hl(0, 'Normal', { bg = 'none' }) + vim.api.nvim_set_hl(0, 'NormalFloat', { bg = 'none' }) +end + +SetTheme() diff --git a/.config/nvim/after/plugin/fugitive.lua b/.config/nvim/after/plugin/fugitive.lua new file mode 100644 index 0000000..6e1b92d --- /dev/null +++ b/.config/nvim/after/plugin/fugitive.lua @@ -0,0 +1 @@ +vim.keymap.set('n', '<leader>gs', vim.cmd.Git) diff --git a/.config/nvim/after/plugin/gsp.lua b/.config/nvim/after/plugin/gsp.lua new file mode 100644 index 0000000..4a52958 --- /dev/null +++ b/.config/nvim/after/plugin/gsp.lua @@ -0,0 +1,3 @@ +local lib = require('mango.lib') + +lib.setTabWidth(2, true) diff --git a/.config/nvim/after/plugin/lsp.lua b/.config/nvim/after/plugin/lsp.lua new file mode 100644 index 0000000..6891256 --- /dev/null +++ b/.config/nvim/after/plugin/lsp.lua @@ -0,0 +1,40 @@ +local lsp = require('lsp-zero') + +lsp.preset('recommended') +lsp.ensure_installed({ + 'clangd', + 'gopls', + 'rust_analyzer', +}) + +lsp.nvim_workspace() + +local cmp = require('cmp') +local cmp_select = {behavior = cmp.SelectBehavior.Select} +local cmp_mappings = lsp.defaults.cmp_mappings({ + ['<C-k>'] = cmp.mapping.select_prev_item(cmp_select), + ['<C-j>'] = cmp.mapping.select_next_item(cmp_select), + ['<CR>'] = cmp.mapping.confirm({ select = true }), + ['<C-Space>'] = cmp.mapping.complete(), +}) + +lsp.set_preferences({ + suggest_lsp_servers = false, + sign_icons = { } +}) + +lsp.setup_nvim_cmp({ + mapping = cmp_mappings +}) + +lsp.on_attach(function(_, bufnr) + local opts = {buffer = bufnr, remap = false} + + vim.keymap.set('n', 'gd', vim.lsp.buf.definition, opts) + vim.keymap.set('n', '<leader>la', vim.lsp.buf.code_action, opts) + vim.keymap.set('n', '<leader>lr', vim.lsp.buf.rename, opts) + vim.keymap.set('n', '<leader>l=', vim.lsp.buf.format, opts) + vim.keymap.set('i', '<C-h>', vim.lsp.buf.signature_help, opts) +end) + +lsp.setup() diff --git a/.config/nvim/after/plugin/telescope.lua b/.config/nvim/after/plugin/telescope.lua new file mode 100644 index 0000000..a9d9225 --- /dev/null +++ b/.config/nvim/after/plugin/telescope.lua @@ -0,0 +1,8 @@ +local builtin = require('telescope.builtin') + +--vim.keymap.set('n', '<leader>pf', builtin.git_files, {}) + +vim.keymap.set('n', '<leader>pf', builtin.find_files, {}) +vim.keymap.set('n', '<leader>ps', function() + builtin.grep_string({ search = vim.fn.input('Grep > ') }) +end) diff --git a/.config/nvim/after/plugin/treesitter.lua b/.config/nvim/after/plugin/treesitter.lua new file mode 100644 index 0000000..ad7f027 --- /dev/null +++ b/.config/nvim/after/plugin/treesitter.lua @@ -0,0 +1,23 @@ +require('nvim-treesitter.configs').setup { + ensure_installed = { + 'c', + 'go', + 'gomod', + 'html', + 'lua', + 'python', + 'query', + 'rust', + 'vim', + 'vimdoc', + 'zig', + }, + + sync_install = false, + auto_install = true, + + highlight = { + enable = true, + additional_vim_regex_highlighting = false, + }, +} diff --git a/.config/nvim/after/plugin/undotree.lua b/.config/nvim/after/plugin/undotree.lua new file mode 100644 index 0000000..a346462 --- /dev/null +++ b/.config/nvim/after/plugin/undotree.lua @@ -0,0 +1 @@ +vim.keymap.set('n', '<leader>u', vim.cmd.UndotreeToggle) diff --git a/.config/nvim/init.lua b/.config/nvim/init.lua new file mode 100644 index 0000000..dfea4db --- /dev/null +++ b/.config/nvim/init.lua @@ -0,0 +1 @@ +require('mango') diff --git a/.config/nvim/init.vim b/.config/nvim/init.vim deleted file mode 100644 index 9c02ea3..0000000 --- a/.config/nvim/init.vim +++ /dev/null @@ -1,30 +0,0 @@ -nnoremap € $ -vnoremap € $ -nnoremap ) 0 -vnoremap ) 0 -nnoremap < << -nnoremap > >> -nnoremap K :vert Man<cr> -vnoremap K :vert Man<cr> -nnoremap <c-h> <c-w>h -nnoremap <c-j> <c-w>j -nnoremap <c-k> <c-w>k -nnoremap <c-l> <c-w>l -nnoremap V <c-v> -nnoremap <c-v> V -nnoremap <c-n> :make<cr> - -fu! SortWords() - if visualmode() == "V" - '<,'>!sort - - else - '<,'>s/\%V.*\%V\w*/\=join(sort(split(submatch(0))), ' ') - endif -endfu - -vnoremap s :<c-u>call SortWords()<cr> - -set noet -set tw=80 colorcolumn=81 -set secure exrc -set splitright splitbelow |