Browse Source

which key is stable

Chris 5 năm trước cách đây
mục cha
commit
48e0bde090

+ 0 - 1
README.md

@@ -89,7 +89,6 @@ Explanations and installation instruction can be found on my blog
 - setup custom paths
 - install script envsubst is your friend
 - add better whitespace pluginand a toggle, video about clean code maybe
-- pear tree (jsx autocomplete would be nice)
 - echodoc and buitin support with CoC
 - snippets (coc snippets)
 - git messenger

+ 4 - 6
general/functions.vim

@@ -1,11 +1,9 @@
 " Turn spellcheck on for markdown files
-" augroup auto_spellcheck
-  " autocmd BufNewFile,BufRead *.md setlocal spell
-" augroup END
+augroup auto_spellcheck
+  autocmd BufNewFile,BufRead *.md setlocal spell
+augroup END
 
 " Remove trailing whitespaces automatically before save
 " augroup strip_ws
-  " autocmd BufWritePre * call utils#stripTrailingWhitespaces()
+"   autocmd BufWritePre * call utils#stripTrailingWhitespaces()
 " augroup END
-
-

+ 5 - 4
init.vim

@@ -8,6 +8,7 @@
 " Always source these
 source $HOME/.config/nvim/vim-plug/plugins.vim
 source $HOME/.config/nvim/general/settings.vim
+source $HOME/.config/nvim/general/functions.vim
 source $HOME/.config/nvim/keys/mappings.vim
 source $HOME/.config/nvim/keys/which-key.vim
 source $HOME/.config/nvim/general/paths.vim
@@ -22,20 +23,20 @@ else
   source $HOME/.config/nvim/themes/syntax.vim
   source $HOME/.config/nvim/themes/onedark.vim
   source $HOME/.config/nvim/themes/airline.vim
-  source $HOME/.config/nvim/plug-config/rnvimr.vim
+  source $HOME/.config/nvim/plug-config/ranger.vim
   source $HOME/.config/nvim/plug-config/fzf.vim
   source $HOME/.config/nvim/plug-config/nerd-commenter.vim
   source $HOME/.config/nvim/plug-config/rainbow.vim
-  source $HOME/.config/nvim/plug-config/coc.vim
   source $HOME/.config/nvim/plug-config/quickscope.vim
   source $HOME/.config/nvim/plug-config/sneak.vim
+  source $HOME/.config/nvim/plug-config/coc.vim
   source $HOME/.config/nvim/plug-config/goyo.vim
   source $HOME/.config/nvim/plug-config/vim-rooter.vim
   source $HOME/.config/nvim/plug-config/start-screen.vim
-  source $HOME/.config/nvim/plug-config/signify.vim
+  source $HOME/.config/nvim/plug-config/gitgutter.vim
   source $HOME/.config/nvim/plug-config/closetags.vim
   source $HOME/.config/nvim/plug-config/floaterm.vim
   source $HOME/.config/nvim/plug-config/vista.vim
   luafile $HOME/.config/nvim/lua/plug-colorizer.lua
-  "source $HOME/.config/nvim/plug-config/easymotion.vim
+  " source $HOME/.config/nvim/plug-config/easymotion.vim
 endif

+ 27 - 30
keys/which-key.vim

@@ -2,6 +2,9 @@ let g:which_key_map =  {}
 let g:which_key_sep = '→'
 " set timeoutlen=100
 
+nnoremap <silent> <leader> :silent WhichKey '<Space>'<CR>
+vnoremap <silent> <leader> :silent <c-u> :silent WhichKeyVisual '<Space>'<CR>
+
 " Not a fan of floating windows for this
 let g:which_key_use_floating_win = 0
 
@@ -25,12 +28,10 @@ let g:which_key_map['e'] = [ ':CocCommand explorer'       , 'explorer' ]
 let g:which_key_map['f'] = [ ':Files'                     , 'files' ]
 let g:which_key_map['h'] = [ '<C-W>s'                     , 'split below']
 let g:which_key_map['q'] = [ 'q'                          , 'quit' ]
-let g:which_key_map['r'] = [ ':RnvimrToggle'              , 'ranger' ]
-let g:which_key_map['s'] = [ ':Startify'                  , 'start screen' ]
+let g:which_key_map['r'] = [ ':Ranger'                    , 'ranger' ]
+let g:which_key_map['S'] = [ ':Startify'                  , 'start screen' ]
 let g:which_key_map['v'] = [ '<C-W>v'                     , 'split right']
 let g:which_key_map['z'] = [ 'Goyo'                       , 'zen' ]
-" nmap <leader>r :RnvimrToggle<CR>
-" let g:which_key_map['"'] = ['viw<esc>a"<esc>bi"<esc>lel'  , 'surround']
 
 " f is for find
 let g:which_key_map.f = {
@@ -64,30 +65,28 @@ let g:which_key_map.f = {
 " g is for git
 let g:which_key_map.g = {
       \ 'name' : '+git' ,
-      \ '/' : [':History/'     , 'history'],
-      \ ';' : [':Commands'     , 'commands'],
-      \ 'a' : [':Ag'           , 'text Ag'],
-      \ 'b' : [':BLines'       , 'current buffer'],
-      \ 'B' : [':Buffers'      , 'open buffers'],
-      \ 'c' : [':Commits'      , 'commits'],
-      \ 'C' : [':BCommits'     , 'buffer commits'],
-      \ 'f' : [':Files'        , 'files'],
-      \ 'g' : [':GFiles'       , 'git files'],
-      \ 'G' : [':GFiles?'      , 'modified git files'],
-      \ 'h' : [':History'      , 'file history'],
-      \ 'H' : [':History:'     , 'command history'],
-      \ 'l' : [':Lines'        , 'lines'] ,
-      \ 'm' : [':Marks'        , 'marks'] ,
-      \ 'M' : [':Maps'         , 'normal maps'] ,
-      \ 'p' : [':Helptags'     , 'help tags'] ,
-      \ 'r' : [':Rg'           , 'text Rg'],
-      \ 's' : [':Snippets'     , 'snippets'],
-      \ 'S' : [':Colors'       , 'color schemes'],
-      \ 't' : [':Tags'         , 'project tags'],
-      \ 'T' : [':BTags'        , 'buffer tags'],
-      \ 'w' : [':Windows'      , 'search windows'],
-      \ 'y' : [':Filetypes'    , 'file types'],
-      \ 'z' : [':FZF'          , 'FZF'],
+      \ 'a' : [':Git add .'                        , 'add all'],
+      \ 'A' : [':Git add %'                        , 'add current'],
+      \ 'b' : [':Git blame'                        , 'blame'],
+      \ 'B' : [':GBrowse'                          , 'browse'],
+      \ 'c' : [':Git commit -m "autocommit"'       , 'commit'],
+      \ 'd' : [':Git diff'                         , 'diff'],
+      \ 'D' : [':Gdiffsplit'                       , 'diff split'],
+      \ 'g' : [':GGrep'                            , 'git grep'],
+      \ 'G' : [':Gstatus'                          , 'status'],
+      \ 'h' : [':GitGutterLineHighlightsToggle'    , 'highlight hunks'],
+      \ 'H' : ['<Plug>(GitGutterPreviewHunk)'      , 'preview hunk'],
+      \ 'j' : ['<Plug>(GitGutterNextHunk)'         , 'next hunk'],
+      \ 'k' : ['<Plug>(GitGutterPrevHunk)'         , 'prev hunk'],
+      \ 'l' : [':Git log'                          , 'log'],
+      \ 'p' : [':Git push'                         , 'push'],
+      \ 'P' : [':Git pull'                         , 'pull'],
+      \ 'r' : [':GRemove'                          , 'remove'],
+      \ 's' : ['<Plug>(GitGutterStageHunk)'        , 'stage hunk'],
+      \ 't' : [':GitGutterSignsToggle'             , 'toggle signs'],
+      \ 'u' : ['<Plug>(GitGutterUndoHunk)'         , 'undo hunk'],
+      \ 'v' : [':GV'                               , 'view commits'],
+      \ 'V' : [':GV!'                              , 'view buffer commits'],
       \ }
 
 " l is for language server protocol
@@ -142,7 +141,5 @@ let g:which_key_map.t = {
       \ }
 
 call which_key#register('<Space>', "g:which_key_map")
-nnoremap <silent> <leader> :silent <c-u>WhichKey '<Space>'<CR>
-vnoremap <silent> <leader> :silent <c-u>WhichKeyVisual '<Space>'<CR>
 
 

+ 1 - 0
plug-config/coc.vim

@@ -14,6 +14,7 @@
   "   \ 'coc-svg',
   "   \ 'coc-prettier',
   "   \ 'coc-vimlsp',
+  "   \ 'coc-flutter',
   "   \ 'coc-xml',
   "   \ 'coc-yank',
   "   \ 'coc-json',

+ 0 - 0
plug-config/gitgutter.vim


+ 0 - 1
plug-config/ranger.vim

@@ -1,4 +1,3 @@
 let g:ranger_replace_netrw = 1 "// open ranger when vim open a directory
 "let g:NERDTreeHijackNetrw = 0 // add this line if you use NERDTree
 let g:ranger_map_keys = 0
-map <leader>r :Ranger<CR>

+ 0 - 27
plug-config/signify.vim

@@ -1,27 +0,0 @@
-" Change these if you want
-let g:signify_sign_add               = '+'
-let g:signify_sign_delete            = '_'
-let g:signify_sign_delete_first_line = '‾'
-let g:signify_sign_change            = '~'
-
-" let g:signify_sign_add               = '|'
-" let g:signify_sign_delete            = '|'
-" let g:signify_sign_delete_first_line = '‾'
-" let g:signify_sign_change            = '|'
-
-" I find the numbers disctracting
-let g:signify_sign_show_count = 0
-let g:signify_sign_show_text = 1
-
-
-" Jump though hunks
-" nmap <leader>j <plug>(signify-next-hunk)
-" nmap <leader>k <plug>(signify-prev-hunk)
-" nmap <leader>gJ 9999<leader>gj
-" nmap <leader>gK 9999<leader>gk
-
-
-" If you like colors instead
-" highlight SignifySignAdd                  ctermbg=green                guibg=#00ff00
-" highlight SignifySignDelete ctermfg=black ctermbg=red    guifg=#ffffff guibg=#ff0000
-" highlight SignifySignChange ctermfg=black ctermbg=yellow guifg=#000000 guibg=#ffff00

+ 5 - 4
vim-plug/plugins.vim

@@ -55,14 +55,15 @@ call plug#begin('~/.config/nvim/autoload/plugged')
     Plug 'vim-airline/vim-airline'
     Plug 'vim-airline/vim-airline-themes'
     " Ranger
-    " Plug 'francoiscabrol/ranger.vim'
-    " Plug 'rbgrouleff/bclose.vim'
-    Plug 'kevinhwang91/rnvimr', {'do': 'make sync'}
+    Plug 'francoiscabrol/ranger.vim'
+    Plug 'rbgrouleff/bclose.vim'
+    " Plug 'kevinhwang91/rnvimr', {'do': 'make sync'}
     " FZF
     Plug 'junegunn/fzf', { 'do': { -> fzf#install() } }
     Plug 'junegunn/fzf.vim'
     " Git
-    Plug 'mhinz/vim-signify'
+    " Plug 'mhinz/vim-signify'
+    Plug 'airblade/vim-gitgutter'
     Plug 'tpope/vim-fugitive'
     Plug 'tpope/vim-rhubarb'
     Plug 'junegunn/gv.vim'