浏览代码

added more goodies to neovim config

Noah Vogt 3 年之前
父节点
当前提交
d244d82b7c

+ 23 - 11
dot-config/nvim/coc-settings.json

@@ -1,17 +1,26 @@
 {
-"diagnostic-languageserver.filetypes": {
-  "sh": "shellcheck"
-},
-"diagnostic-languageserver.formatFiletypes": {
-  "sh": "shfmt",
-  "python": "black"
-},
-  "python.linting.pylintEnabled" : true,
+  "diagnostic-languageserver.filetypes": {
+    "sh": "shellcheck"
+  },
+  "diagnostic-languageserver.formatFiletypes": {
+    "sh": "shfmt",
+    "python": "black"
+  },
+  "python.linting.pylintEnabled": true,
   "languageserver": {
     "ccls": {
       "command": "ccls",
-      "filetypes": ["c", "cpp", "cuda", "objc", "objcpp"],
-      "rootPatterns": [".ccls-root", "compile_commands.json"],
+      "filetypes": [
+        "c",
+        "cpp",
+        "cuda",
+        "objc",
+        "objcpp"
+      ],
+      "rootPatterns": [
+        ".ccls-root",
+        "compile_commands.json"
+      ],
       "initializationOptions": {
         "cache": {
           "directory": "/tmp/ccls-cache"
@@ -21,5 +30,8 @@
         }
       }
     }
-  }
+  },
+  "codeLens.enable": true,
+  "java.referencesCodeLens.enabled": true,
+  "java.jdt.ls.vmargs": "-javaagent:/usr/local/share/lombok/lombok.jar"
 }

+ 7 - 6
dot-config/nvim/general/auto.vim

@@ -50,12 +50,6 @@ augroup texclear
   autocmd VimLeavePre *.md !texclear "%"
 augroup END
 
-"autocmd VimLeavePre *.c !rm -rf .ccls-cache
-"autocmd VimLeavePre *.cc !rm -rf .ccls-cache
-"autocmd VimLeavePre *.cpp !rm -rf .ccls-cache
-"autocmd VimLeavePre *.h !rm -rf .ccls-cache
-"autocmd VimLeavePre *.hh !rm -rf .ccls-cache
-
 " use python syntax highlighting for .tibasic files
 augroup tibasic
   autocmd!
@@ -87,3 +81,10 @@ augroup my-glyph-palette
   autocmd FileType fern call glyph_palette#apply()
   autocmd FileType startify call glyph_palette#apply()
 augroup END
+
+" relative line numbers
+augroup numbertoggle
+  autocmd!
+  autocmd BufEnter,FocusGained,InsertLeave * set relativenumber
+  autocmd BufLeave,FocusLost,InsertEnter   * set norelativenumber
+augroup END

+ 10 - 0
dot-config/nvim/general/basic.vim

@@ -71,3 +71,13 @@ set lazyredraw
 
 " ignore case when searching
 set ignorecase
+
+" Show next 3 lines while scrolling.
+if !&scrolloff
+    set scrolloff=3       
+endif
+
+" Show next 5 columns while side-scrolling.
+if !&sidescrolloff
+    set sidescrolloff=5   
+endif

+ 5 - 2
dot-config/nvim/init.vim

@@ -1,5 +1,4 @@
 " noah's $VIMINIT
-" 
 
 " get basic (set)tings
 source $XDG_CONFIG_HOME/nvim/general/basic.vim
@@ -12,7 +11,11 @@ source $XDG_CONFIG_HOME/nvim/plug-conf/ctrlp.vim
 source $XDG_CONFIG_HOME/nvim/plug-conf/sneak.vim
 source $XDG_CONFIG_HOME/nvim/plug-conf/airline.vim
 source $XDG_CONFIG_HOME/nvim/plug-conf/startify.vim
-lua require('treesitter')
+source $XDG_CONFIG_HOME/nvim/plug-conf/editorconfig.vim
+lua require 'treesitter'
+lua require 'indent-blankline'
+lua require 'telescope'
+
 " get theme
 source $XDG_CONFIG_HOME/nvim/theme/theme.vim
 " get keybinds

+ 27 - 4
dot-config/nvim/keys/bindings.vim

@@ -8,12 +8,9 @@ vnoremap J :m '>+1<CR>gv=gv
 nnoremap <Leader>w :w<CR>
 nnoremap <Leader>z :wq<CR>
 nnoremap <Leader>q :qa<CR>
+nnoremap <Leader>e :q<CR>
 
 " windows commands
-nnoremap <leader>h :wincmd h<CR>
-nnoremap <leader>j wincmd j<CR>
-nnoremap <leader>k wincmd k<CR>
-nnoremap <leader>l wincmd l<CR>
 nnoremap <leader>pv :wincmd v<bar> :Ex <bar> :vertical resize 30<CR>
 nnoremap <leader>ps :Rg<CR>
 nnoremap <silent> <leader>+ :vertical resize +5<CR>
@@ -157,3 +154,29 @@ nmap ]h <Plug>(coc-git-nextchunk)
 " navigate conflicts of current buffer
 nmap [c <Plug>(coc-git-prevconflict)
 nmap ]c <Plug>(coc-git-nextconflict)
+
+
+function! WinMove(key)
+    let t:curwin = winnr()
+    exec "wincmd ".a:key
+    if (t:curwin == winnr())
+        if (match(a:key,'[jk]'))
+            wincmd v
+        else
+            wincmd s
+        endif
+        exec "wincmd ".a:key
+    endif
+endfunction
+
+" smart global buffor / window switching
+nnoremap <silent> <C-h> :call WinMove('h')<CR>
+nnoremap <silent> <C-j> :call WinMove('j')<CR>
+nnoremap <silent> <C-k> :call WinMove('k')<CR>
+nnoremap <silent> <C-l> :call WinMove('l')<CR>
+
+" source vim config
+nnoremap <Leader>sv :source $XDG_CONFIG_HOME/nvim/init.vim<CR>
+
+nnoremap <leader>l :Telescope live_grep<CR>
+nnoremap <leader>t :Telescope find_files<CR>

+ 12 - 0
dot-config/nvim/lua/indent-blankline.lua

@@ -0,0 +1,12 @@
+-- uncomment below to show whitespace characters
+
+--vim.opt.list = true
+--vim.opt.listchars:append("space:⋅")
+--vim.opt.listchars:append("eol:↴")
+
+require("indent_blankline").setup {
+    -- highlight the indentation guide of the current context
+    show_current_context = true,
+    -- underline the starting line of the block
+    show_current_context_start = false,
+}

+ 2 - 0
dot-config/nvim/plug-conf/editorconfig.vim

@@ -0,0 +1,2 @@
+" avoid fetching on remote sessions + do not interfere w/ vim fugitive
+let g:EditorConfig_exclude_patterns = ['fugitive://.*', 'scp://.*']

+ 25 - 0
dot-config/nvim/vim-plug/plugins.vim

@@ -3,6 +3,11 @@
 "  \| PlugInstall --sync | source $VIMINIT
 "\| endif
 
+function! UpdateRemotePlugins(...)
+    " Needed to refresh runtime files
+    let &rtp=&rtp
+    UpdateRemotePlugins
+  endfunction
 
 call plug#begin('~/.cache/vim/plugged')
 
@@ -82,4 +87,24 @@ Plug 'nvim-treesitter/nvim-treesitter', {'do': ':TSUpdate'}
 " w/ refactoring capabilites
 Plug 'nvim-treesitter/nvim-treesitter-refactor'
 
+" adds indentation guides to all lines
+Plug 'lukas-reineke/indent-blankline.nvim'
+
+" add editorconfig support
+Plug 'editorconfig/editorconfig-vim'
+
+" highly extensible fuzzy finder
+Plug 'nvim-telescope/telescope.nvim'
+" w/ media preview
+Plug 'nvim-telescope/telescope-media-files.nvim'
+" w/ dependencies
+Plug 'nvim-lua/popup.nvim'
+Plug 'nvim-lua/plenary.nvim'
+
+" a more adventurous wildmenu
+Plug 'gelguy/wilder.nvim', { 'do': function('UpdateRemotePlugins') }
+
+Plug 'nixprime/cpsm'
+Plug 'romgrk/fzy-lua-native'
+
 call plug#end()