From 1c408ef31b4402260746baa9afa67cbe5a2ad2dd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20Kmie=C4=87?= Date: Wed, 2 Mar 2022 23:09:58 +0100 Subject: [PATCH] Nvim: modernize plugin configuration --- .config/nvim/after/plugin/context.rc.vim | 39 ++++++++++++++++- .config/nvim/after/plugin/indent.rc.vim | 14 +++---- .config/nvim/after/plugin/nvim-tree.rc.vim | 46 ++++++++++++--------- .config/nvim/after/plugin/treesitter.rc.vim | 7 +++- .config/nvim/init.vim | 35 ++++++++-------- 5 files changed, 93 insertions(+), 48 deletions(-) diff --git a/.config/nvim/after/plugin/context.rc.vim b/.config/nvim/after/plugin/context.rc.vim index 25d5dc2..3ed40f5 100644 --- a/.config/nvim/after/plugin/context.rc.vim +++ b/.config/nvim/after/plugin/context.rc.vim @@ -1,2 +1,37 @@ -" Disable context.vim on json files -let g:context_filetype_blacklist = ["json", "log"] +" Configuration for context.vim +"" Disable context.vim on json files +""let g:context_filetype_blacklist = ["json", "log"] +lua << EOF +require'treesitter-context'.setup{ + enable = true, -- Enable this plugin (Can be enabled/disabled later via commands) + throttle = true, -- Throttles plugin updates (may improve performance) + max_lines = 0, -- How many lines the window should span. Values <= 0 mean no limit. + patterns = { -- Match patterns for TS nodes. These get wrapped to match at word boundaries. + -- For all filetypes + -- Note that setting an entry here replaces all other patterns for this entry. + -- By setting the 'default' entry below, you can control which nodes you want to + -- appear in the context window. + default = { + 'class', + 'function', + 'method', + 'for', + 'while', + 'if', + 'switch', + -- 'case', + }, + -- Example for a specific filetype. + -- If a pattern is missing, *open a PR* so everyone can benefit. + rust = { + 'impl_item', + }, + }, + exact_patterns = { + -- Example for a specific filetype with Lua patterns + -- Treat patterns.rust as a Lua pattern (i.e "^impl_item$" will + -- exactly match "impl_item" only) + rust = true, + } +} +EOF diff --git a/.config/nvim/after/plugin/indent.rc.vim b/.config/nvim/after/plugin/indent.rc.vim index 2e8a123..f2958c9 100644 --- a/.config/nvim/after/plugin/indent.rc.vim +++ b/.config/nvim/after/plugin/indent.rc.vim @@ -1,11 +1,11 @@ lua << EOF ---vim.opt.termguicolors = true ---vim.cmd [[highlight IndentBlanklineIndent1 guifg=#E06C75 gui=nocombine]] ---vim.cmd [[highlight IndentBlanklineIndent2 guifg=#E5C07B gui=nocombine]] ---vim.cmd [[highlight IndentBlanklineIndent3 guifg=#98C379 gui=nocombine]] ---vim.cmd [[highlight IndentBlanklineIndent4 guifg=#56B6C2 gui=nocombine]] ---vim.cmd [[highlight IndentBlanklineIndent5 guifg=#61AFEF gui=nocombine]] ---vim.cmd [[highlight IndentBlanklineIndent6 guifg=#C678DD gui=nocombine]] +vim.opt.termguicolors = true +vim.cmd [[highlight IndentBlanklineIndent1 guifg=#E06C75 gui=nocombine]] +vim.cmd [[highlight IndentBlanklineIndent2 guifg=#E5C07B gui=nocombine]] +vim.cmd [[highlight IndentBlanklineIndent3 guifg=#98C379 gui=nocombine]] +vim.cmd [[highlight IndentBlanklineIndent4 guifg=#56B6C2 gui=nocombine]] +vim.cmd [[highlight IndentBlanklineIndent5 guifg=#61AFEF gui=nocombine]] +vim.cmd [[highlight IndentBlanklineIndent6 guifg=#C678DD gui=nocombine]] --vim.opt.list = true --vim.opt.listchars:append("space:⋅") diff --git a/.config/nvim/after/plugin/nvim-tree.rc.vim b/.config/nvim/after/plugin/nvim-tree.rc.vim index 7c61ead..84f9393 100644 --- a/.config/nvim/after/plugin/nvim-tree.rc.vim +++ b/.config/nvim/after/plugin/nvim-tree.rc.vim @@ -1,27 +1,14 @@ -let g:nvim_tree_quit_on_open = 1 "0 by default, closes the tree when you open a file let g:nvim_tree_indent_markers = 1 "0 by default, this option shows indent markers when folders are open let g:nvim_tree_git_hl = 1 "0 by default, will enable file highlight for git attributes (can be used without the icons). let g:nvim_tree_highlight_opened_files = 1 "0 by default, will enable folder and file icon highlight for opened files/directories. let g:nvim_tree_root_folder_modifier = ':~' "This is the default. See :help filename-modifiers for more options let g:nvim_tree_add_trailing = 1 "0 by default, append a trailing slash to folder names let g:nvim_tree_group_empty = 1 " 0 by default, compact folders that only contain a single folder into one node in the file tree -let g:nvim_tree_change_dir_global = 1 "0 by default, use :cd when changing directories. -let g:nvim_tree_disable_window_picker = 1 "0 by default, will disable the window picker. let g:nvim_tree_icon_padding = ' ' "one space by default, used for rendering the space between the icon and the filename. Use with caution, it could break rendering if you set an empty string depending on your font. let g:nvim_tree_symlink_arrow = ' >> ' " defaults to ' ➛ '. used as a separator between symlinks' source and target. let g:nvim_tree_respect_buf_cwd = 0 "0 by default, will change cwd of nvim-tree to that of new buffer's when opening nvim-tree. let g:nvim_tree_create_in_closed_folder = 0 "1 by default, When creating files, sets the path of a file when cursor is on a closed folder to the parent folder when 0, and inside the folder when 1. let g:nvim_tree_refresh_wait = 1000 " control how often the tree can be refreshed, 1000 means the tree can be refresh once per 1000ms. -let g:nvim_tree_window_picker_exclude = { - \ 'filetype': [ - \ 'notify', - \ 'packer', - \ 'qf' - \ ], - \ 'buftype': [ - \ 'terminal' - \ ] - \ } " Dictionary of buffer option names mapped to a list of option values that " indicates to the window picker that the buffer's window should not be " selectable. @@ -84,8 +71,12 @@ require'nvim-tree'.setup { ignore_ft_on_setup = {}, auto_close = false, open_on_tab = false, - hijack_cursor = false, + hijack_cursor = true, update_cwd = false, + hijack_directories = { + enable = true, + auto_open = true, + }, update_to_buf_dir = { enable = true, auto_open = true, @@ -100,7 +91,7 @@ require'nvim-tree'.setup { } }, update_focused_file = { - enable = false, + enable = true, update_cwd = false, ignore_list = {} }, @@ -114,26 +105,41 @@ require'nvim-tree'.setup { }, git = { enable = true, - ignore = true, + ignore = false, timeout = 500, }, view = { width = 30, height = 30, - hide_root_folder = false, + hide_root_folder = true, side = 'left', - auto_resize = false, + auto_resize = true, mappings = { custom_only = false, list = {} }, number = false, relativenumber = false, - signcolumn = "yes" + signcolumn = "no" }, trash = { cmd = "trash", require_confirm = true - } + }, + actions = { + open_file = { + quit_on_open = true, + disable_window_picker = true, + window_picker = { + exclude = { + filetype = { "notify", "packer", "qf" }, + buftype = { "terminal" }, + }, + }, + }, + change_dir = { + global = true, + }, + }, } EOF diff --git a/.config/nvim/after/plugin/treesitter.rc.vim b/.config/nvim/after/plugin/treesitter.rc.vim index 6232c41..fe7f4ce 100644 --- a/.config/nvim/after/plugin/treesitter.rc.vim +++ b/.config/nvim/after/plugin/treesitter.rc.vim @@ -34,7 +34,7 @@ ts.setup { enable = true, -- disable = { "jsx", "cpp" }, list of languages you want to disable the plugin for extended_mode = true, -- Also highlight non-bracket delimiters like html tags, boolean or table: lang -> boolean - max_file_lines = nil, -- Do not enable for files with more than n lines, int + max_file_lines = 10000, -- Do not enable for files with more than n lines, int -- colors = {}, -- table of hex strings -- termcolors = {} -- table of colour name strings }, @@ -49,6 +49,11 @@ ts.setup { }, }, }, + matchup = { + enable = true, + -- disable = { "c", "ruby" }, + include_match_words + }, } --vim.opt.foldmethod = "expr" --vim.opt.foldexpr = "nvim_treesitter#foldexpr()" diff --git a/.config/nvim/init.vim b/.config/nvim/init.vim index 1180e84..b0a4361 100644 --- a/.config/nvim/init.vim +++ b/.config/nvim/init.vim @@ -22,7 +22,6 @@ Plug 'ms-jpq/coq_nvim', {'branch': 'coq'} Plug 'ms-jpq/coq.artifacts', {'branch': 'artifacts'} Plug 'ms-jpq/coq.thirdparty', {'branch': '3p'} -Plug 'wellle/context.vim' "Plug 'dbeniamine/cheat.sh-vim' Plug 'puremourning/vimspector' "Plug 'vim-test/vim-test' @@ -33,7 +32,11 @@ Plug 'nvim-treesitter/nvim-treesitter', {'do': ':TSUpdate'} Plug 'nvim-treesitter/playground' Plug 'p00f/nvim-ts-rainbow' Plug 'nvim-treesitter/nvim-treesitter-textobjects' +Plug 'romgrk/nvim-treesitter-context' + Plug 'cdelledonne/vim-cmake' + +Plug 'andymass/vim-matchup' " }}} " Completion {{{ @@ -88,20 +91,21 @@ Plug 'lukas-reineke/virt-column.nvim' "Plug 'jez/vim-superman' "vman application Plug 'glacambre/firenvim' "Plug 'JMcKiern/vim-shoot' +Plug 'mrjones2014/legendary.nvim' " }}} " Note taking {{{ Plug 'vimwiki/vimwiki' Plug 'michal-h21/vimwiki-sync' -Plug 'michal-h21/vim-zettel' +"Plug 'michal-h21/vim-zettel' " }}} " Colorschemes {{{ -Plug 'jaredgorski/spacecamp' -Plug 'lifepillar/vim-gruvbox8' -Plug 'dylanaraps/wal' Plug 'vim-airline/vim-airline' | Plug 'vim-airline/vim-airline-themes' -Plug 'tanvirtin/monokai.nvim' +"Plug 'jaredgorski/spacecamp' +"Plug 'lifepillar/vim-gruvbox8' +Plug 'dylanaraps/wal' +"Plug 'tanvirtin/monokai.nvim' Plug 'marko-cerovac/material.nvim' " }}} " @@ -130,12 +134,12 @@ set background=dark "colorscheme wal let g:material_style = "deep ocean" colorscheme material -highlight MatchParen cterm=underline ctermbg=black ctermfg=NONE -highlight VirtColumn ctermfg=DarkGrey ctermbg=NONE +"highlight MatchParen cterm=underline ctermbg=black ctermfg=NONE +"highlight VirtColumn ctermfg=DarkGrey ctermbg=NONE set listchars=tab:▸\ ,trail:¬ set list -hi clear SpellBad -hi SpellBad cterm=underline +"hi clear SpellBad +"hi SpellBad cterm=underline set tabstop=2 set shiftwidth=2 @@ -154,6 +158,8 @@ set scrolloff=10 set inccommand="split" +set lazyredraw + " space one line, home,end globally increase/decrease nnoremap zc nnoremap zo @@ -207,14 +213,7 @@ set updatetime=300 set shortmess+=c set shortmess-=F -" Always show the signcolumn, otherwise it would shift the text each time -" diagnostics appear/become resolved. -if has("patch-8.1.1564") - " Recently vim can merge signcolumn and number column into one - set signcolumn=number -else - set signcolumn=yes -endif +set signcolumn=number set wildmode=longest,list,full