diff options
author | Daniel Weipert <code@drogueronin.de> | 2023-11-06 15:54:24 +0100 |
---|---|---|
committer | Daniel Weipert <code@drogueronin.de> | 2023-11-06 15:54:24 +0100 |
commit | 99ae247eacf35697c607d880675d910fcce90ae3 (patch) | |
tree | c54bd8b42a56c7ad94ff138c69fd85005b02f4ae /.config/nvim | |
parent | d9f12831186077736fcd9c163a4b31a1fa28690e (diff) |
[nvim] refactor plugins to use lazy.nvim
Diffstat (limited to '.config/nvim')
-rw-r--r-- | .config/nvim/config/config.vim | 5 | ||||
-rw-r--r-- | .config/nvim/init.vim | 5 | ||||
-rw-r--r-- | .config/nvim/lazy-lock.json | 29 | ||||
-rw-r--r-- | .config/nvim/plugins.vim | 439 | ||||
-rw-r--r-- | .config/nvim/plugins/_install.vim | 48 | ||||
-rw-r--r-- | .config/nvim/plugins/_load.vim | 11 | ||||
-rw-r--r-- | .config/nvim/plugins/aerial.vim | 28 | ||||
-rw-r--r-- | .config/nvim/plugins/comment.vim | 3 | ||||
-rw-r--r-- | .config/nvim/plugins/diffview.vim | 6 | ||||
-rw-r--r-- | .config/nvim/plugins/gitgutter.vim | 2 | ||||
-rw-r--r-- | .config/nvim/plugins/indent_blankline.vim | 43 | ||||
-rw-r--r-- | .config/nvim/plugins/leap.vim | 3 | ||||
-rw-r--r-- | .config/nvim/plugins/lsp.vim | 91 | ||||
-rw-r--r-- | .config/nvim/plugins/markdown_preview.vim | 3 | ||||
-rw-r--r-- | .config/nvim/plugins/nerdtree.vim | 58 | ||||
-rw-r--r-- | .config/nvim/plugins/telescope.vim | 3 | ||||
-rw-r--r-- | .config/nvim/plugins/treesitter.vim | 18 |
17 files changed, 470 insertions, 325 deletions
diff --git a/.config/nvim/config/config.vim b/.config/nvim/config/config.vim index 2c1b895..7c541aa 100644 --- a/.config/nvim/config/config.vim +++ b/.config/nvim/config/config.vim @@ -19,11 +19,6 @@ augroup numbertoggle autocmd BufLeave,WinLeave * if &nu | set norelativenumber | endif augroup END -" colors -colorscheme darcula -set termguicolors -highlight Normal guibg=NONE ctermbg=NONE - " diff if &diff autocmd BufEnter * if winnr('$') == 1 | quit | endif diff --git a/.config/nvim/init.vim b/.config/nvim/init.vim index 5e9fb44..cf13e51 100644 --- a/.config/nvim/init.vim +++ b/.config/nvim/init.vim @@ -12,7 +12,6 @@ let g:NERDTreeNoInitFiletypes = ["DiffviewFiles"] let g:NERDTreeStatusLineTabSwitchFiletypes = ["nerdtree", "help"] -source ~/.config/nvim/plugins/_install.vim -source ~/.config/nvim/config/config.vim source ~/.config/nvim/config/keys.vim -source ~/.config/nvim/plugins/_load.vim +source ~/.config/nvim/config/config.vim +source ~/.config/nvim/plugins.vim diff --git a/.config/nvim/lazy-lock.json b/.config/nvim/lazy-lock.json new file mode 100644 index 0000000..8c7d62c --- /dev/null +++ b/.config/nvim/lazy-lock.json @@ -0,0 +1,29 @@ +{ + "Comment.nvim": { "branch": "master", "commit": "0236521ea582747b58869cb72f70ccfa967d2e89" }, + "LuaSnip": { "branch": "master", "commit": "a4de64570b9620875c8ea04175cd07ed8e32ac99" }, + "aerial.nvim": { "branch": "master", "commit": "8e4090bf9412e24b05823c771cb3956c2ba72981" }, + "cmp-nvim-lsp": { "branch": "main", "commit": "44b16d11215dce86f253ce0c30949813c0a90765" }, + "cmp_luasnip": { "branch": "master", "commit": "05a9ab28b53f71d1aece421ef32fee2cb857a843" }, + "darcula": { "branch": "master", "commit": "faf8dbab27bee0f27e4f1c3ca7e9695af9b1242b" }, + "diffview.nvim": { "branch": "main", "commit": "d38c1b5266850f77f75e006bcc26213684e1e141" }, + "editorconfig.nvim": { "branch": "master", "commit": "5b9e303e1d6f7abfe616ce4cc8d3fffc554790bf" }, + "indent-blankline.nvim": { "branch": "master", "commit": "29be0919b91fb59eca9e90690d76014233392bef" }, + "lazy.nvim": { "branch": "main", "commit": "96584866b9c5e998cbae300594d0ccfd0c464627" }, + "leap.nvim": { "branch": "main", "commit": "b6ae80f8fc9993638608fc1a51c6ab0eeb12618c" }, + "markdown-preview.nvim": { "branch": "master", "commit": "a923f5fc5ba36a3b17e289dc35dc17f66d0548ee" }, + "mason-lspconfig.nvim": { "branch": "main", "commit": "40301e1c74bc0946eece13edf2b1c561cc497491" }, + "mason.nvim": { "branch": "main", "commit": "eabf6d347fdb75be360d4c0ced1145670a171453" }, + "nerdtree": { "branch": "master", "commit": "4c588f182090e01edadeecb127a353cb08d1e39f" }, + "nerdtree-git-plugin": { "branch": "master", "commit": "e1fe727127a813095854a5b063c15e955a77eafb" }, + "nvim-cmp": { "branch": "main", "commit": "0b751f6beef40fd47375eaf53d3057e0bfa317e4" }, + "nvim-lspconfig": { "branch": "master", "commit": "37457f268af5cd6765e589b0dcd7cbd192d8da00" }, + "nvim-treesitter": { "branch": "master", "commit": "96f55f304332ca6ea1b7dde32d3ec04b5298c316" }, + "nvim-web-devicons": { "branch": "master", "commit": "5de460ca7595806044eced31e3c36c159a493857" }, + "plenary.nvim": { "branch": "master", "commit": "50012918b2fc8357b87cff2a7f7f0446e47da174" }, + "telescope.nvim": { "branch": "master", "commit": "20bf20500c95208c3ac0ef07245065bf94dcab15" }, + "vim-devicons": { "branch": "master", "commit": "71f239af28b7214eebb60d4ea5bd040291fb7e33" }, + "vim-gitgutter": { "branch": "main", "commit": "f7b97666ae36c7b3f262f3190dbcd7033845d985" }, + "vim-polyglot": { "branch": "master", "commit": "bc8a81d3592dab86334f27d1d43c080ebf680d42" }, + "vim-surround": { "branch": "master", "commit": "3d188ed2113431cf8dac77be61b842acb64433d9" }, + "vim-xtabline": { "branch": "master", "commit": "ccfa687d4f8d34bc2e23facc9b92c3abb90e5f93" } +}
\ No newline at end of file diff --git a/.config/nvim/plugins.vim b/.config/nvim/plugins.vim new file mode 100644 index 0000000..c437068 --- /dev/null +++ b/.config/nvim/plugins.vim @@ -0,0 +1,439 @@ +lua <<EOF +local lazypath = vim.fn.stdpath('data') .. '/lazy/lazy.nvim' +if not vim.loop.fs_stat(lazypath) then + vim.fn.system({ + "git", + "clone", + "--filter=blob:none", + "https://github.com/folke/lazy.nvim.git", + "--branch=stable", -- latest stable release + lazypath, + }) +end +vim.opt.rtp:prepend(lazypath) + +require('lazy').setup({ + { + 'doums/darcula', + lazy = false, + priority = 1000, + config = function() + vim.cmd([[colorscheme darcula]]) + vim.cmd([[set termguicolors]]) + vim.cmd([[highlight Normal guibg=NONE ctermbg=NONE]]) + end, + }, + + { + 'airblade/vim-gitgutter', + event = 'VimEnter', + config = function() + vim.cmd([[nnoremap <leader>gp <cmd>GitGutterPreviewHunk<CR>]]) + vim.cmd([[nnoremap <leader>gu <cmd>GitGutterUndoHunk<CR>]]) + end, + }, + + { + 'lukas-reineke/indent-blankline.nvim', + event = 'VimEnter', + + config = function() + local hooks = require('ibl.hooks') + + hooks.register( + hooks.type.WHITESPACE, + hooks.builtin.hide_first_space_indent_level + ) + + hooks.register( + hooks.type.WHITESPACE, + hooks.builtin.hide_first_tab_indent_level + ) + + hooks.register( + hooks.type.HIGHLIGHT_SETUP, + function() + vim.api.nvim_set_hl(0, 'IndentBlanklineChar', { fg = '#303030', nocombine = true }) + vim.api.nvim_set_hl(0, 'IndentBlanklineContextChar', { fg = '#404040', nocombine = true }) + end + ) + + require('ibl').setup { + indent = { + highlight = { + 'IndentBlanklineChar', + }, + }, + + whitespace = { + remove_blankline_trail = true, + }, + + scope = { + enabled = false, + + highlight = { + 'IndentBlanklineContextChar', + }, + }, + } + end, + }, + + { 'gpanders/editorconfig.nvim', event = 'VimEnter' }, + { 'tpope/vim-surround', event = 'VimEnter' }, + { 'sheerun/vim-polyglot', event = 'VimEnter' }, + + { + 'williamboman/mason-lspconfig.nvim', + event = 'VimEnter', + + dependencies = { + 'williamboman/mason.nvim', + 'hrsh7th/cmp-nvim-lsp', + 'neovim/nvim-lspconfig', + }, + + config = function() + local on_attach = function(client, bufnr) + local function buf_set_keymap(...) vim.api.nvim_buf_set_keymap(bufnr, ...) end + local function buf_set_option(...) vim.api.nvim_buf_set_option(bufnr, ...) end + + -- Enable completion triggered by <c-x><c-o> + buf_set_option('omnifunc', 'v:lua.vim.lsp.omnifunc') + + -- Mappings. + local opts = { noremap=true, silent=true } + + -- See :help vim.lsp.* for documentation on any of the below functions + buf_set_keymap('n', 'gD', '<cmd>lua vim.lsp.buf.declaration()<CR>', opts) + buf_set_keymap('n', 'gd', '<cmd>lua vim.lsp.buf.definition()<CR>', opts) + buf_set_keymap('n', 'K', '<cmd>lua vim.lsp.buf.hover()<CR>', opts) + buf_set_keymap('n', 'gi', '<cmd>lua vim.lsp.buf.implementation()<CR>', opts) + buf_set_keymap('n', '<C-k>', '<cmd>lua vim.lsp.buf.signature_help()<CR>', opts) + buf_set_keymap('n', '<space>wa', '<cmd>lua vim.lsp.buf.add_workspace_folder()<CR>', opts) + buf_set_keymap('n', '<space>wr', '<cmd>lua vim.lsp.buf.remove_workspace_folder()<CR>', opts) + buf_set_keymap('n', '<space>wl', '<cmd>lua print(vim.inspect(vim.lsp.buf.list_workspace_folders()))<CR>', opts) + buf_set_keymap('n', '<space>D', '<cmd>lua vim.lsp.buf.type_definition()<CR>', opts) + buf_set_keymap('n', '<space>rn', '<cmd>lua vim.lsp.buf.rename()<CR>', opts) + buf_set_keymap('n', '<space>ca', '<cmd>lua vim.lsp.buf.code_action()<CR>', opts) + buf_set_keymap('n', 'gr', '<cmd>lua vim.lsp.buf.references()<CR>', opts) + buf_set_keymap('n', '<space>e', '<cmd>lua vim.diagnostic.open_float()<CR>', opts) + buf_set_keymap('n', '[d', '<cmd>lua vim.diagnostic.goto_prev()<CR>', opts) + buf_set_keymap('n', ']d', '<cmd>lua vim.diagnostic.goto_next()<CR>', opts) + buf_set_keymap('n', '<space>q', '<cmd>lua vim.diagnostic.setloclist()<CR>', opts) + buf_set_keymap('n', '<space>f', '<cmd>lua vim.lsp.buf.format({async = true})<CR>', opts) + end + + local capabilities = vim.lsp.protocol.make_client_capabilities() + capabilities = require('cmp_nvim_lsp').default_capabilities(capabilities) + + vim.o.completeopt = 'menuone,noselect' + + require('mason').setup() + require('mason-lspconfig').setup() + require('mason-lspconfig').setup_handlers { + function (server_name) + require ('lspconfig')[server_name].setup { + on_attach = on_attach, + capabilities = capabilities, + } + end + } + end, + }, + + { + 'nvim-treesitter/nvim-treesitter', + event = 'VimEnter', + + build = function() + vim.cmd([[:TSUpdate]]) + end, + + config = function() + require('nvim-treesitter.configs').setup { + ensure_installed = 'all', + sync_install = false, + indent = { + enable = true, + }, + highlight = { + enable = true, + additional_vim_regex_highlighting = false, + }, + } + + vim.cmd([[highlight! link @text.diff.add DiffAdd]]) + vim.cmd([[highlight! link @text.diff.delete DiffDelete]]) + vim.cmd([[highlight! link @text.diff.change DiffChange]]) + vim.cmd([[highlight! link @text.diff.text DiffText]]) + end, + }, + + { + 'sindrets/diffview.nvim', + + dependencies = { + 'nvim-tree/nvim-web-devicons', + }, + + cmd = 'DiffviewOpen', + + config = function() + require('diffview').setup({}) + + -- close all windows when Diffview is closed + vim.api.nvim_create_autocmd('QuitPre', { + callback = function() + if vim.bo.filetype == 'DiffviewFiles' then + vim.cmd([[quitall]]) + end + end, + }) + end, + }, + + { + 'preservim/nerdtree', + + dependencies = { + 'ryanoasis/vim-devicons', + 'Xuyuanp/nerdtree-git-plugin', + }, + + event = 'BufWinEnter', + + config = function() + vim.g.NERDTreeShowHidden = 1 + vim.g.NERDTreeGitStatusShowIgnored = 1 + + vim.g.NERDTreeShowLineNumbers = 1 + vim.cmd([[:autocmd BufEnter NERD_* setlocal rnu]]) + + vim.cmd([[ + if !&diff + autocmd StdinReadPre * let s:std_in=1 + endif + ]]) + + vim.cmd([[ + function NERDTreeInit() + if !&diff + let buffer_type = getbufvar(bufnr(), "&filetype") + if index(g:NERDTreeNoInitFiletypes, buffer_type) == -1 + NERDTree + + if argc() > 0 || exists('s:std_in') + wincmd p + endif + + if argc() > 0 + silent NERDTreeFind + wincmd p + endif + endif + endif + endfunction + autocmd VimEnter * call NERDTreeInit() + ]]) + + vim.cmd([[autocmd BufWinEnter * if getcmdwintype() == '' | silent NERDTreeMirror | endif]]) + vim.cmd([[autocmd BufEnter * if winnr('$') == 1 && exists('b:NERDTree') && b:NERDTree.isTabTree() | quit | endif]]) + + vim.cmd([[ + " set status line on tab switch + function NERDTreeStatusLineTabSwitch() + " only when in non-meaningful window + if index(g:NERDTreeStatusLineTabSwitchFiletypes, &filetype) == -1 + return + endif + + let tab_nr = tabpagenr() + let buffer_list = tabpagebuflist(tab_nr) + + " default to 2 + let meaningful_window_nr = 2 + + for buffer_nr in buffer_list + let buffer_type = getbufvar(buffer_nr, "&filetype") + if index(g:NERDTreeStatusLineTabSwitchFiletypes, buffer_type) == -1 + let meaningful_window_nr = bufwinnr(buffer_nr) + break + endif + endfor + + exe meaningful_window_nr .. "wincmd w" + endfunction + autocmd TabLeave * call NERDTreeStatusLineTabSwitch() + ]]) + + vim.cmd([[map <C-b> <cmd>NERDTreeToggle<CR>]]) + end, + }, + + { + 'nvim-telescope/telescope.nvim', + cmd = 'Telescope', + dependencies = { + 'nvim-lua/plenary.nvim', + }, + init = function() + vim.cmd([[nnoremap <leader>ff <cmd>Telescope find_files<CR>]]) + vim.cmd([[nnoremap <leader>fg <cmd>Telescope live_grep<CR>]]) + vim.cmd([[nnoremap <leader><leader> <cmd>Telescope buffers<CR>]]) + end, + }, + + { + 'mg979/vim-xtabline', + event = 'TabEnter', + }, + + { + 'ggandor/leap.nvim', + keys = { 's', 'S' }, + config = function() + require('leap').add_default_mappings() + end, + }, + + { + 'iamcco/markdown-preview.nvim', + + ft = 'markdown', + + build = function() + vim.fn['mkdp#util#install()']() + end, + + config = function() + vim.g.mkdp_preview_options = { + disable_sync_scroll = 1 + } + end, + }, + + { + 'stevearc/aerial.nvim', + + dependencies = { + 'nvim-telescope/telescope.nvim', + }, + + cmd = { + 'AerialToggle', + 'Telescope aerial', + }, + + init = function() + vim.cmd([[nnoremap <leader>a <cmd>AerialToggle!<CR>]]) + vim.cmd([[nnoremap <leader>fa <cmd>Telescope aerial<CR>]]) + end, + + config = function() + require('aerial').setup({ + filter_kind = false, + }) + + require('telescope').load_extension('aerial') + + vim.cmd([[ + " add aerial to tab switch filetypes + call add(g:NERDTreeStatusLineTabSwitchFiletypes, 'aerial') + + " close Aerial and NERDTree if they are the only remaining windows + function AerialNERDTreeClose() + if winnr('$') != 2 + return + endif + + let window_filetypes = UtilityWinfiletypes() + + if index(window_filetypes, 'aerial') != -1 && index(window_filetypes, 'nerdtree') != -1 + " one quit suffices, since aerial and nerdtree close themselves + quit + endif + endfunction + autocmd BufEnter * call AerialNERDTreeClose() + ]]) + end, + }, + + { + 'numToStr/Comment.nvim', + keys = { + 'gcc', + { 'gc', mode = 'v' }, + { 'gb', mode = 'v' }, + }, + config = function() + require('Comment').setup() + end, + }, + + { + 'hrsh7th/nvim-cmp', + dependencies = { + 'saadparwaiz1/cmp_luasnip', + 'L3MON4D3/LuaSnip', + }, + event = 'InsertEnter', + config = function() + local cmp = require('cmp') + local luasnip = require('luasnip') + + cmp.setup { + snippet = { + expand = function(args) + luasnip.lsp_expand(args.body) + end, + }, + mapping = { + ['<C-p>'] = cmp.mapping.select_prev_item(), + ['<C-n>'] = cmp.mapping.select_next_item(), + ['<C-d>'] = cmp.mapping.scroll_docs(-4), + ['<C-f>'] = cmp.mapping.scroll_docs(4), + ['<C-Space>'] = cmp.mapping.complete(), + ['<C-e>'] = cmp.mapping.close(), + ['<CR>'] = cmp.mapping.confirm { + behavior = cmp.ConfirmBehavior.Replace, + select = true, + }, + ['<Tab>'] = function(fallback) + if cmp.visible() then + cmp.select_next_item() + elseif luasnip.expand_or_jumpable() then + luasnip.expand_or_jump() + else + fallback() + end + end, + ['<S-Tab>'] = function(fallback) + if cmp.visible() then + cmp.select_prev_item() + elseif luasnip.jumpable(-1) then + luasnip.jump(-1) + else + fallback() + end + end, + }, + sources = { + { name = 'nvim_lsp' }, + { name = 'luasnip' }, + }, + } + end + }, + + -- { 'https://gitlab.com/dweipert.de/rclone.nvim' }, + { dir = '~/Projects/rclone.nvim', cmd = 'Rclone' }, + + + -- Optional + + { 'nvim-tree/nvim-web-devicons', lazy = true, optional = true }, + { 'Xuyuanp/nerdtree-git-plugin', lazy = true, optional = true }, +}) +EOF diff --git a/.config/nvim/plugins/_install.vim b/.config/nvim/plugins/_install.vim deleted file mode 100644 index f47037c..0000000 --- a/.config/nvim/plugins/_install.vim +++ /dev/null @@ -1,48 +0,0 @@ -call plug#begin(stdpath('data') . '/plugged') - -Plug 'doums/darcula' - -Plug 'ryanoasis/vim-devicons' -Plug 'nvim-tree/nvim-web-devicons' - -Plug 'preservim/nerdtree' -Plug 'Xuyuanp/nerdtree-git-plugin' - -Plug 'nvim-lua/plenary.nvim' -Plug 'nvim-telescope/telescope.nvim' -Plug 'sindrets/diffview.nvim' - -Plug 'airblade/vim-gitgutter' - -Plug 'mg979/vim-xtabline' - -Plug 'ggandor/leap.nvim' - -Plug 'nvim-treesitter/nvim-treesitter', {'do': ':TSUpdate'} - -Plug 'lukas-reineke/indent-blankline.nvim' - -Plug 'tpope/vim-surround' - -Plug 'gpanders/editorconfig.nvim' - -Plug 'iamcco/markdown-preview.nvim', {'do': { -> mkdp#util#install() }, 'for': ['markdown', 'vim-plug']} -" if install fails do `:call mkdp#util#install() manually` - -Plug 'stevearc/aerial.nvim' -Plug 'numToStr/Comment.nvim' - -Plug 'williamboman/mason.nvim' -Plug 'williamboman/mason-lspconfig.nvim' -Plug 'neovim/nvim-lspconfig' -Plug 'hrsh7th/nvim-cmp' -Plug 'hrsh7th/cmp-nvim-lsp' -Plug 'saadparwaiz1/cmp_luasnip' -Plug 'L3MON4D3/LuaSnip' - -Plug 'sheerun/vim-polyglot' - -"Plug 'https://gitlab.com/dweipert.de/rclone.nvim' -Plug '~/Projects/rclone.nvim' - -call plug#end() diff --git a/.config/nvim/plugins/_load.vim b/.config/nvim/plugins/_load.vim deleted file mode 100644 index 4917b89..0000000 --- a/.config/nvim/plugins/_load.vim +++ /dev/null @@ -1,11 +0,0 @@ -source ~/.config/nvim/plugins/aerial.vim -source ~/.config/nvim/plugins/comment.vim -source ~/.config/nvim/plugins/diffview.vim -source ~/.config/nvim/plugins/gitgutter.vim -source ~/.config/nvim/plugins/indent_blankline.vim -source ~/.config/nvim/plugins/leap.vim -source ~/.config/nvim/plugins/lsp.vim -source ~/.config/nvim/plugins/markdown_preview.vim -source ~/.config/nvim/plugins/nerdtree.vim -source ~/.config/nvim/plugins/telescope.vim -source ~/.config/nvim/plugins/treesitter.vim diff --git a/.config/nvim/plugins/aerial.vim b/.config/nvim/plugins/aerial.vim deleted file mode 100644 index 9a6db49..0000000 --- a/.config/nvim/plugins/aerial.vim +++ /dev/null @@ -1,28 +0,0 @@ -lua <<EOF -require('aerial').setup({ - filter_kind = false, -}) - -require('telescope').load_extension('aerial') -EOF - -nnoremap <leader>a <cmd>AerialToggle!<CR> -nnoremap <leader>fa <cmd>Telescope aerial<CR> - -" add aerial to tab switch filetypes -call add(g:NERDTreeStatusLineTabSwitchFiletypes, 'aerial') - -" close Aerial and NERDTree if they are the only remaining windows -function AerialNERDTreeClose() - if winnr('$') != 2 - return - endif - - let window_filetypes = UtilityWinfiletypes() - - if index(window_filetypes, 'aerial') != -1 && index(window_filetypes, 'nerdtree') != -1 - " one quit suffices, since aerial and nerdtree close themselves - quit - endif -endfunction -autocmd BufEnter * call AerialNERDTreeClose() diff --git a/.config/nvim/plugins/comment.vim b/.config/nvim/plugins/comment.vim deleted file mode 100644 index 3b150b6..0000000 --- a/.config/nvim/plugins/comment.vim +++ /dev/null @@ -1,3 +0,0 @@ -lua <<EOF -require('Comment').setup() -EOF diff --git a/.config/nvim/plugins/diffview.vim b/.config/nvim/plugins/diffview.vim deleted file mode 100644 index 4b9d2f0..0000000 --- a/.config/nvim/plugins/diffview.vim +++ /dev/null @@ -1,6 +0,0 @@ -lua <<EOF -require('diffview').setup({}) -EOF - -" close all windows when Diffview is closed -autocmd QuitPre * if &filetype == 'DiffviewFiles' | quitall | endif diff --git a/.config/nvim/plugins/gitgutter.vim b/.config/nvim/plugins/gitgutter.vim deleted file mode 100644 index 5099e57..0000000 --- a/.config/nvim/plugins/gitgutter.vim +++ /dev/null @@ -1,2 +0,0 @@ -nnoremap <leader>gp <cmd>GitGutterPreviewHunk<CR> -nnoremap <leader>gu <cmd>GitGutterUndoHunk<CR> diff --git a/.config/nvim/plugins/indent_blankline.vim b/.config/nvim/plugins/indent_blankline.vim deleted file mode 100644 index 2702b4f..0000000 --- a/.config/nvim/plugins/indent_blankline.vim +++ /dev/null @@ -1,43 +0,0 @@ -lua <<EOF - -local hooks = require('ibl.hooks') - -hooks.register( - hooks.type.WHITESPACE, - hooks.builtin.hide_first_space_indent_level -) - -hooks.register( - hooks.type.WHITESPACE, - hooks.builtin.hide_first_tab_indent_level -) - -hooks.register( - hooks.type.HIGHLIGHT_SETUP, - function() - vim.api.nvim_set_hl(0, 'IndentBlanklineChar', { fg = '#303030', nocombine = true }) - vim.api.nvim_set_hl(0, 'IndentBlanklineContextChar', { fg = '#404040', nocombine = true }) - end -) - - -require('ibl').setup { - indent = { - highlight = { - 'IndentBlanklineChar', - }, - }, - - whitespace = { - remove_blankline_trail = true, - }, - - scope = { - enabled = false, - - highlight = { - 'IndentBlanklineContextChar', - }, - }, -} -EOF diff --git a/.config/nvim/plugins/leap.vim b/.config/nvim/plugins/leap.vim deleted file mode 100644 index be63380..0000000 --- a/.config/nvim/plugins/leap.vim +++ /dev/null @@ -1,3 +0,0 @@ -lua <<EOF -require('leap').add_default_mappings() -EOF diff --git a/.config/nvim/plugins/lsp.vim b/.config/nvim/plugins/lsp.vim deleted file mode 100644 index d0f6f26..0000000 --- a/.config/nvim/plugins/lsp.vim +++ /dev/null @@ -1,91 +0,0 @@ -lua <<EOF -local on_attach = function(client, bufnr) - local function buf_set_keymap(...) vim.api.nvim_buf_set_keymap(bufnr, ...) end - local function buf_set_option(...) vim.api.nvim_buf_set_option(bufnr, ...) end - - -- Enable completion triggered by <c-x><c-o> - buf_set_option('omnifunc', 'v:lua.vim.lsp.omnifunc') - - -- Mappings. - local opts = { noremap=true, silent=true } - - -- See :help vim.lsp.* for documentation on any of the below functions - buf_set_keymap('n', 'gD', '<cmd>lua vim.lsp.buf.declaration()<CR>', opts) - buf_set_keymap('n', 'gd', '<cmd>lua vim.lsp.buf.definition()<CR>', opts) - buf_set_keymap('n', 'K', '<cmd>lua vim.lsp.buf.hover()<CR>', opts) - buf_set_keymap('n', 'gi', '<cmd>lua vim.lsp.buf.implementation()<CR>', opts) - buf_set_keymap('n', '<C-k>', '<cmd>lua vim.lsp.buf.signature_help()<CR>', opts) - buf_set_keymap('n', '<space>wa', '<cmd>lua vim.lsp.buf.add_workspace_folder()<CR>', opts) - buf_set_keymap('n', '<space>wr', '<cmd>lua vim.lsp.buf.remove_workspace_folder()<CR>', opts) - buf_set_keymap('n', '<space>wl', '<cmd>lua print(vim.inspect(vim.lsp.buf.list_workspace_folders()))<CR>', opts) - buf_set_keymap('n', '<space>D', '<cmd>lua vim.lsp.buf.type_definition()<CR>', opts) - buf_set_keymap('n', '<space>rn', '<cmd>lua vim.lsp.buf.rename()<CR>', opts) - buf_set_keymap('n', '<space>ca', '<cmd>lua vim.lsp.buf.code_action()<CR>', opts) - buf_set_keymap('n', 'gr', '<cmd>lua vim.lsp.buf.references()<CR>', opts) - buf_set_keymap('n', '<space>e', '<cmd>lua vim.diagnostic.open_float()<CR>', opts) - buf_set_keymap('n', '[d', '<cmd>lua vim.diagnostic.goto_prev()<CR>', opts) - buf_set_keymap('n', ']d', '<cmd>lua vim.diagnostic.goto_next()<CR>', opts) - buf_set_keymap('n', '<space>q', '<cmd>lua vim.diagnostic.setloclist()<CR>', opts) - buf_set_keymap('n', '<space>f', '<cmd>lua vim.lsp.buf.format({async = true})<CR>', opts) -end - -local capabilities = vim.lsp.protocol.make_client_capabilities() -capabilities = require('cmp_nvim_lsp').default_capabilities(capabilities) - -vim.o.completeopt = 'menuone,noselect' - -require('mason').setup() -require('mason-lspconfig').setup() -require('mason-lspconfig').setup_handlers { - function (server_name) - require ('lspconfig')[server_name].setup { - on_attach = on_attach, - capabilities = capabilities, - } - end -} - -local cmp = require('cmp') -local luasnip = require('luasnip') -cmp.setup { - snippet = { - expand = function(args) - luasnip.lsp_expand(args.body) - end, - }, - mapping = { - ['<C-p>'] = cmp.mapping.select_prev_item(), - ['<C-n>'] = cmp.mapping.select_next_item(), - ['<C-d>'] = cmp.mapping.scroll_docs(-4), - ['<C-f>'] = cmp.mapping.scroll_docs(4), - ['<C-Space>'] = cmp.mapping.complete(), - ['<C-e>'] = cmp.mapping.close(), - ['<CR>'] = cmp.mapping.confirm { - behavior = cmp.ConfirmBehavior.Replace, - select = true, - }, - ['<Tab>'] = function(fallback) - if cmp.visible() then - cmp.select_next_item() - elseif luasnip.expand_or_jumpable() then - luasnip.expand_or_jump() - else - fallback() - end - end, - ['<S-Tab>'] = function(fallback) - if cmp.visible() then - cmp.select_prev_item() - elseif luasnip.jumpable(-1) then - luasnip.jump(-1) - else - fallback() - end - end, - }, - sources = { - { name = 'nvim_lsp' }, - { name = 'luasnip' }, - }, -} -EOF diff --git a/.config/nvim/plugins/markdown_preview.vim b/.config/nvim/plugins/markdown_preview.vim deleted file mode 100644 index 03ff94f..0000000 --- a/.config/nvim/plugins/markdown_preview.vim +++ /dev/null @@ -1,3 +0,0 @@ -let g:mkdp_preview_options = { - \ 'disable_sync_scroll': 1 -\ } diff --git a/.config/nvim/plugins/nerdtree.vim b/.config/nvim/plugins/nerdtree.vim deleted file mode 100644 index 7caf768..0000000 --- a/.config/nvim/plugins/nerdtree.vim +++ /dev/null @@ -1,58 +0,0 @@ -let g:NERDTreeShowHidden=1 -let g:NERDTreeGitStatusShowIgnored=1 - -:let g:NERDTreeShowLineNumbers=1 -:autocmd BufEnter NERD_* setlocal rnu - -if !&diff - autocmd StdinReadPre * let s:std_in=1 -endif - -function NERDTreeInit() - if !&diff - let buffer_type = getbufvar(bufnr(), "&filetype") - if index(g:NERDTreeNoInitFiletypes, buffer_type) == -1 - NERDTree - - if argc() > 0 || exists('s:std_in') - wincmd p - endif - - if argc() > 0 - silent NERDTreeFind - wincmd p - endif - endif - endif -endfunction -autocmd VimEnter * call NERDTreeInit() - -autocmd BufWinEnter * if getcmdwintype() == '' | silent NERDTreeMirror | endif -autocmd BufEnter * if winnr('$') == 1 && exists('b:NERDTree') && b:NERDTree.isTabTree() | quit | endif - -" set status line on tab switch -function NERDTreeStatusLineTabSwitch() - " only when in non-meaningful window - if index(g:NERDTreeStatusLineTabSwitchFiletypes, &filetype) == -1 - return - endif - - let tab_nr = tabpagenr() - let buffer_list = tabpagebuflist(tab_nr) - - " default to 2 - let meaningful_window_nr = 2 - - for buffer_nr in buffer_list - let buffer_type = getbufvar(buffer_nr, "&filetype") - if index(g:NERDTreeStatusLineTabSwitchFiletypes, buffer_type) == -1 - let meaningful_window_nr = bufwinnr(buffer_nr) - break - endif - endfor - - exe meaningful_window_nr .. "wincmd w" -endfunction -autocmd TabLeave * call NERDTreeStatusLineTabSwitch() - -map <C-b> <cmd>NERDTreeToggle<CR> diff --git a/.config/nvim/plugins/telescope.vim b/.config/nvim/plugins/telescope.vim deleted file mode 100644 index 729edad..0000000 --- a/.config/nvim/plugins/telescope.vim +++ /dev/null @@ -1,3 +0,0 @@ -nnoremap <leader>ff <cmd>Telescope find_files<CR> -nnoremap <leader>fg <cmd>Telescope live_grep<CR> -nnoremap <leader><leader> <cmd>Telescope buffers<CR> diff --git a/.config/nvim/plugins/treesitter.vim b/.config/nvim/plugins/treesitter.vim deleted file mode 100644 index b011e36..0000000 --- a/.config/nvim/plugins/treesitter.vim +++ /dev/null @@ -1,18 +0,0 @@ -lua <<EOF -require('nvim-treesitter.configs').setup { - ensure_installed = 'all', - sync_install = false, - indent = { - enable = true, - }, - highlight = { - enable = true, - additional_vim_regex_highlighting = false, - }, -} -EOF - -highlight! link @text.diff.add DiffAdd -highlight! link @text.diff.delete DiffDelete -highlight! link @text.diff.change DiffChange -highlight! link @text.diff.text DiffText |