set nocompatible filetype off source /usr/share/nvim/runtime/plugin/fzf.vim call plug#begin('$HOME/.config/nvim/bundle') Plug 'tpope/vim-sensible' " Colors Plug 'chriskempson/base16-vim' Plug 'terryma/vim-multiple-cursors' Plug 'Lokaltog/vim-easymotion' Plug 'rust-lang/rust.vim' " Plug 'racer-rust/vim-racer' Plug 'vim-ruby/vim-ruby' Plug 'tpope/vim-rails' Plug 'tpope/vim-rake' Plug 'tpope/vim-bundler' Plug 'tpope/vim-markdown' Plug 'calviken/vim-gdscript3' " Plug 'tpope/vim-projectionist' " Plug 'tpope/vim-haml' Plug 'ledger/vim-ledger' Plug 'slim-template/vim-slim' Plug 'fatih/vim-go' " Plug 'wavded/vim-stylus' " Plug 'digitaltoad/vim-jade' Plug 'Glench/Vim-Jinja2-Syntax' Plug 'HerringtonDarkholme/yats.vim' Plug 'm-pilia/vim-ccls' Plug 'm-pilia/vim-yggdrasil' " Zig Plug 'ziglang/zig.vim' " Elixir Plug 'elixir-editors/vim-elixir' Plug 'mhinz/vim-mix-format' Plug 'tomtom/tcomment_vim' Plug 'majutsushi/tagbar', { 'on': 'TagbarToggle' } Plug 'scrooloose/nerdtree' Plug 'milkypostman/vim-togglelist' " l and q " Snippets Plug 'L3MON4D3/LuaSnip' " Appearance Plug 'itchyny/lightline.vim' Plug 'shinchu/lightline-gruvbox.vim' Plug 'spywhere/lightline-lsp' Plug 'editorconfig/editorconfig-vim' Plug 'tpope/vim-surround' Plug 'tpope/vim-unimpaired' Plug 'tpope/vim-endwise' Plug 'rstacruz/vim-closer' Plug 'junegunn/fzf.vim' Plug 'godlygeek/tabular' " LSP Plug 'neovim/nvim-lspconfig' Plug 'hrsh7th/cmp-nvim-lsp' Plug 'folke/lsp-colors.nvim' Plug 'hrsh7th/cmp-buffer' Plug 'hrsh7th/cmp-path' Plug 'hrsh7th/cmp-cmdline' Plug 'hrsh7th/nvim-cmp' " For luasnip users. Plug 'saadparwaiz1/cmp_luasnip' " Plug 'tpope/vim-dispatch' Plug 'airblade/vim-gitgutter' Plug 'tpope/vim-fugitive' Plug 'kassio/neoterm' Plug 'janko/vim-test' " Tasks Plug 'blindFS/vim-taskwarrior' Plug 'powerman/vim-plugin-AnsiEsc' Plug 'vimwiki/vimwiki' Plug 'tbabej/taskwiki' call plug#end() " Colorscheme set t_Co=256 set termguicolors set background=dark let base16colorspace=256 colorscheme base16-gruvbox-dark-hard " Required for operations modifying multiple buffers like rename. set hidden " autocmd FileType ruby setlocal omnifunc=rubycomplete#Complete autocmd FileType ledger setlocal sw=4 ts=4 sts=4 autocmd FileType rust setlocal sw=4 ts=4 sts=4 " For conceal markers. if has('conceal') set conceallevel=0 concealcursor=niv endif " Enable snipMate compatibility feature. let g:neosnippet#enable_snipmate_compatibility = 1 " " Tell Neosnippet about the other snippets let g:neosnippet#snippets_directory='$HOME/.config/nvim/bundle/vim-snippets/snippets' " nvim-lspconfig lua << EOF local nvim_lsp = require('lspconfig') -- Use an on_attach function to only map the following keys -- after the language server attaches to the current buffer 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 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', 'lua vim.lsp.buf.declaration()', opts) buf_set_keymap('n', 'gd', 'lua vim.lsp.buf.definition()', opts) buf_set_keymap('n', 'K', 'lua vim.lsp.buf.hover()', opts) buf_set_keymap('n', 'gi', 'lua vim.lsp.buf.implementation()', opts) buf_set_keymap('n', '', 'lua vim.lsp.buf.signature_help()', opts) buf_set_keymap('n', 'wa', 'lua vim.lsp.buf.add_workspace_folder()', opts) buf_set_keymap('n', 'wr', 'lua vim.lsp.buf.remove_workspace_folder()', opts) buf_set_keymap('n', 'wl', 'lua print(vim.inspect(vim.lsp.buf.list_workspace_folders()))', opts) buf_set_keymap('n', 'D', 'lua vim.lsp.buf.type_definition()', opts) buf_set_keymap('n', 'rn', 'lua vim.lsp.buf.rename()', opts) buf_set_keymap('n', 'ca', 'lua vim.lsp.buf.code_action()', opts) buf_set_keymap('n', 'gr', 'lua vim.lsp.buf.references()', opts) buf_set_keymap('n', 'e', 'lua vim.lsp.diagnostic.show_line_diagnostics()', opts) buf_set_keymap('n', '[d', 'lua vim.lsp.diagnostic.goto_prev()', opts) buf_set_keymap('n', ']d', 'lua vim.lsp.diagnostic.goto_next()', opts) buf_set_keymap('n', 'q', 'lua vim.lsp.diagnostic.set_loclist()', opts) buf_set_keymap('n', 'f', 'lua vim.lsp.buf.formatting()', opts) end -- Use a loop to conveniently call 'setup' on multiple servers and -- map buffer local keybindings when the language server attaches local servers = { 'eslint', 'erlangls', 'solargraph', 'tsserver', 'stylelint_lsp', 'eslint', 'zls', 'ansiblels', 'bashls', 'ccls' } -- Setup lspconfig. local capabilities = vim.lsp.protocol.make_client_capabilities() capabilities = require('cmp_nvim_lsp').update_capabilities(capabilities) for _, lsp in ipairs(servers) do nvim_lsp[lsp].setup { flags = { debounce_text_changes = 150, }, on_attach = on_attach, capabilities = capabilities } end nvim_lsp.elixirls.setup{ cmd = { "elixir-ls" }, on_attach = on_attach, capabilities = capabilities } EOF set completeopt=menu,menuone,noselect lua <'] = cmp.mapping(cmp.mapping.scroll_docs(-4), { 'i', 'c' }), [''] = cmp.mapping(cmp.mapping.scroll_docs(4), { 'i', 'c' }), [''] = cmp.mapping(cmp.mapping.complete(), { 'i', 'c' }), [''] = cmp.mapping.confirm({ behavior = cmp.ConfirmBehavior.Replace, select = true }), [''] = cmp.mapping(function(fallback) if cmp.visible() then cmp.select_next_item() elseif luasnip.expand_or_jumpable() then luasnip.expand_or_jump() elseif has_words_before() then cmp.complete() else fallback() end end, { 'i', 's' }), [''] = cmp.mapping(function(fallback) if cmp.visible() then cmp.select_prev_item() elseif luasnip.jumpable(-1) then luasnip.jump(-1) else fallback() end end, { 'i', 's' }), [''] = cmp.mapping({ i = cmp.mapping.abort(), c = cmp.mapping.close(), }), }, sources = cmp.config.sources({ { name = 'nvim_lsp' }, { name = 'luasnip' }, -- For luasnip users. }, { { name = 'buffer' }, }) }) -- Use buffer source for `/` (if you enabled `native_menu`, this won't work anymore). cmp.setup.cmdline('/', { sources = { { name = 'buffer' } } }) -- Use cmdline & path source for ':' (if you enabled `native_menu`, this won't work anymore). cmp.setup.cmdline(':', { sources = cmp.config.sources({ { name = 'path' } }, { { name = 'cmdline' } }) }) EOF " EditorConfig let g:EditorConfig_exclude_patterns = ['fugitive://.*', 'scp://.*'] " FZF ripgrep nnoremap g :Rg " NerdTREE silent! nmap :NERDTreeToggle silent! map :NERDTreeFind let g:NERDTreeMapActivateNode="" let g:NERDTreeMapPreview="" " Lightline let g:lightline = { \ 'colorscheme': 'gruvbox', \ 'component_function': { \ 'gitbranch': 'fugitive#head' \ }, \ } let g:lightline.component_expand = { \ 'linter_hints': 'lightline#lsp#hints', \ 'linter_infos': 'lightline#lsp#infos', \ 'linter_warnings': 'lightline#lsp#warnings', \ 'linter_errors': 'lightline#lsp#errors', \ 'linter_ok': 'lightline#lsp#ok', \ } let g:lightline.component_type = { \ 'linter_hints': 'right', \ 'linter_infos': 'right', \ 'linter_warnings': 'warning', \ 'linter_errors': 'error', \ 'linter_ok': 'right', \ } let g:lightline.active = { \ 'left': [ [ 'mode', 'paste' ], \ [ 'gitbranch', 'readonly', 'filename', 'modified' ]], \ 'right': [ [ 'lineinfo' ], \ [ 'percent' ], \ [ 'fileformat', 'fileencoding', 'filetype' ], \ [ 'linter_errors', 'linter_warnings', 'linter_infos', 'linter_hints', 'linter_ok' ]] \ } set shell=fish " Terminal tnoremap command Term split term://fish let g:neoterm_autoinsert = 1 let g:neoterm_default_mod = 'rightbelow' let g:neoterm_size = '20' " vim-test " make test commands execute using neoterm let test#strategy = "neoterm" nnoremap tn :TestNearest nnoremap tf :TestFile nnoremap ts :TestSuite " Vim gitgutter let g:gitgutter_enabled = 1 let g:gitgutter_signs = 1 let g:gitgutter_sign_added = '+' let g:gitgutter_sign_modified = '~' let g:gitgutter_sign_removed = '-' let g:gitgutter_sign_removed_first_line = '-' let g:gitgutter_sign_modified_removed = '~' let g:gitgutter_highlight_linenrs = 1 let g:gitgutter_highlight_lines = 0 highlight GitGutterChangeLineNr ctermfg=16 ctermbg=18 guifg=#83a598 guibg=#3c3836 highlight GitGutterChangeDeleteLineNr ctermfg=16 ctermbg=18 guifg=#d3869b guibg=#3c3836 highlight link GitGutterAddLineNr GitGutterAddLine highlight link GitGutterDeleteLineNr GitGutterDeleteLine " fzf let $FZF_DEFAULT_COMMAND="fd --type file --full-path -c never -H" silent! nmap :Files " An action can be a reference to a function that processes selected lines function! s:build_quickfix_list(lines) call setqflist(map(copy(a:lines), '{ "filename": v:val }')) copen cc endfunction " This is the default extra key bindings let g:fzf_action = { \ 'ctrl-q': function('s:build_quickfix_list'), \ 'ctrl-t': 'tab split', \ 'ctrl-x': 'split', \ 'ctrl-v': 'vsplit', \ 'ctrl-o': 'edit' } let g:fzf_preview_window = 'right:60%' " let g:fzf_layout = { 'window': { 'width': 0.4, 'height': 0.25 } } " let g:fzf_preview_window = '' let g:fzf_buffers_jump = 1 autocmd! FileType fzf set laststatus=0 noshowmode noruler \| autocmd BufLeave set laststatus=2 showmode ruler command! -bang -nargs=* Rg \ call fzf#vim#grep( \ 'rg --column --line-number --no-heading --color=always --smart-case -- '.shellescape(), 1, \ fzf#vim#with_preview(), 0) command! -bang -nargs=? -complete=dir Files \ call fzf#vim#files(, fzf#vim#with_preview(), 0) " Customize fzf colors to match your color scheme let g:fzf_colors = \ { 'fg': ['fg', 'Normal'], \ 'bg': ['bg', 'Normal'], \ 'hl': ['fg', 'Comment'], \ 'fg+': ['fg', 'CursorLine', 'CursorColumn', 'Normal'], \ 'bg+': ['bg', 'CursorLine', 'CursorColumn'], \ 'hl+': ['fg', 'Statement'], \ 'info': ['fg', 'PreProc'], \ 'border': ['fg', 'Ignore'], \ 'prompt': ['fg', 'Conditional'], \ 'pointer': ['fg', 'Exception'], \ 'marker': ['fg', 'Keyword'], \ 'spinner': ['fg', 'Label'], \ 'header': ['fg', 'Comment'] } " Replace current word with yanked or deleted text " nnoremap S "_diwP " tagbar nmap :TagbarToggle let g:tagbar_type_rust = { \ 'ctagstype' : 'rust', \ 'kinds' : [ \'T:types,type definitions', \'f:functions,function definitions', \'g:enum,enumeration names', \'s:structure names', \'m:modules,module names', \'c:consts,static constants', \'t:traits', \'i:impls,trait implementations', \] \} let g:tagbar_type_ruby = { \ 'kinds' : [ \ 'm:modules', \ 'c:classes', \ 'd:describes', \ 'C:contexts', \ 'f:methods', \ 'F:singleton methods' \ ] \} " Vimwiki let g:vimwiki_list = [{'path': '~/vimwiki/', 'syntax': 'markdown', 'ext': '.md'}] " FIXME: this is strange workaround for workaround for bug in kitty autocmd FileType vimwiki nnoremap wH VimwikiGoBackLink " Taskwiki let g:taskwiki_markup_syntax = "markdown" " let g:taskwiki_source_tw_colors = "yes" nnoremap tR :TaskWikiBufferLoad set noswapfile set ofu=syntaxcomplete#Complete set ts=2 " Tabs are 2 spaces set bs=2 " Backspace over everything in insert mode set shiftwidth=2 " Tabs under smart indent set cf " Enable error files & error jumping. set clipboard=unnamed " Yanks go on clipboard instead. set nu " Line numbers on set relativenumber set wrap set linebreak " set timeoutlen=250 " Time to wait after ESC (default causes an annoying delay) set cmdheight=1 set updatetime=300 set hlsearch " Highlight searches set re=0 " set lazyredraw set redrawtime=1000 " Search set ignorecase smartcase " Ignore case of searches set cinoptions=:0,p0,t0 set cinwords=if,else,while,do,for,switch,case,begin set formatoptions=tcqr set cindent set expandtab set colorcolumn=80,120 set nostartofline " Don’t reset cursor to start of line when moving around. set noeol " Don’t add empty newlines at the end of files autocmd InsertEnter * set cursorline " Show cursor line in insert mode autocmd InsertLeave * set nocursorline " Hide cursor line in insert mode " Visual set showmatch " Show matching brackets. set mat=5 " Bracket blinking. " Show $ at end of line and trailing space as ~ set novisualbell " No blinking . set noerrorbells " No noise. " Invisibles set list listchars=tab:▸·,trail:·,nbsp:· " Use one space, not two, after punctuation. set nojoinspaces " Disable folding set nofoldenable " Disable some keys noremap noremap noremap noremap noremap noremap noremap noremap inoremap inoremap inoremap inoremap " Open new split panes to right and bottom, which feels more natural set splitbelow set splitright set title " Quicker window movement nnoremap j nnoremap k nnoremap h nnoremap l