Ver Fonte

added which key and remapped bindings

ChristianChiarulli há 6 anos atrás
pai
commit
718b37578c

+ 1 - 0
init.vim

@@ -18,6 +18,7 @@ source $HOME/.config/nvim/modules/neosnippets.vim
 source $HOME/.config/nvim/modules/emmet.vim
 source $HOME/.config/nvim/modules/emmet.vim
 source $HOME/.config/nvim/modules/colorizer.vim
 source $HOME/.config/nvim/modules/colorizer.vim
 source $HOME/.config/nvim/modules/rainbow.vim
 source $HOME/.config/nvim/modules/rainbow.vim
+source $HOME/.config/nvim/modules/vim-which-key.vim
 " Special test file "
 " Special test file "
 source $HOME/.config/nvim/modules/test.vim
 source $HOME/.config/nvim/modules/test.vim
 
 

+ 1 - 1
modules/airline.vim

@@ -3,7 +3,7 @@ let g:airline#extensions#tabline#enabled = 1
 " enable powerline fonts
 " enable powerline fonts
 let g:airline_powerline_fonts = 1
 let g:airline_powerline_fonts = 1
 " Switch to your current theme
 " Switch to your current theme
-let g:airline_theme = 'tender'
+let g:airline_theme = 'codedark'
 " Always show tabs 
 " Always show tabs 
 set showtabline=2
 set showtabline=2
 " We don't need to see things like -- INSERT -- anymore
 " We don't need to see things like -- INSERT -- anymore

+ 3 - 62
modules/general.vim

@@ -13,6 +13,7 @@ syntax enable                           " Enables syntax highlighing
 set hidden                              " Required for specific actions that require multiple buffers
 set hidden                              " Required for specific actions that require multiple buffers
 set nowrap                              " display long lines as just one line
 set nowrap                              " display long lines as just one line
 set encoding=utf-8                      " The encoding displayed 
 set encoding=utf-8                      " The encoding displayed 
+set pumheight=10                        " Makes popup menu smaller
 set fileencoding=utf-8                  " The encoding written to file
 set fileencoding=utf-8                  " The encoding written to file
 set ruler              					        " show the cursor position all the time
 set ruler              					        " show the cursor position all the time
 set iskeyword+=-                      	" treat dash separated words as a word text object"
 set iskeyword+=-                      	" treat dash separated words as a word text object"
@@ -35,7 +36,8 @@ set background=dark                     " tell vim what the background color loo
 
 
 let g:python_highlight_all = 0          " Get rid of annoying red highlights"
 let g:python_highlight_all = 0          " Get rid of annoying red highlights"
 let g:elite_mode=1                      " Disable arrows"
 let g:elite_mode=1                      " Disable arrows"
-
+filetype plugin indent on               " Gives vim abilty to recognize filetypes
+                 
 " Disable arrow movement, resize splits instead.
 " Disable arrow movement, resize splits instead.
 if get(g:, 'elite_mode')
 if get(g:, 'elite_mode')
     nnoremap <Up>    :resize -2<CR>
     nnoremap <Up>    :resize -2<CR>
@@ -44,8 +46,6 @@ if get(g:, 'elite_mode')
     nnoremap <Right> :vertical resize +2<CR>
     nnoremap <Right> :vertical resize +2<CR>
 endif
 endif
 
 
-" Gives vim abilty to recognize filetypes
-filetype plugin indent on                 
 " Alternate way to save
 " Alternate way to save
 nnoremap <C-s> :w<CR>
 nnoremap <C-s> :w<CR>
 " Alternate way to quit
 " Alternate way to quit
@@ -57,66 +57,7 @@ inoremap <expr><TAB> pumvisible() ? "\<C-n>" : "\<TAB>"
 " Open terminal with F1
 " Open terminal with F1
 nnoremap <silent> <F1> :10split term://bash<CR>
 nnoremap <silent> <F1> :10split term://bash<CR>
 nnoremap <silent> <F2> :bdelete! term://*<return>
 nnoremap <silent> <F2> :bdelete! term://*<return>
-" insert mode for terminal
-""autocmd BufWinEnter,WinEnter term://* startinsert
-""autocmd BufLeave term://* stopinsert
-" Toggle tagbar
-"nnoremap <silent> <F2> :TagbarToggle<CR>
-" Toggle Line numbers
-"nnoremap <silent> <F4> :set nonumber!<CR>
-" Toggle NERDTree
-"nnoremap <silent> <F5> :NERDTreeToggle<CR>
-" Startify
-"nnoremap <silent> <F6> :Startify<CR>
-" Get rid of highlights after search
-"nnoremap <silent> <F7> :nohlsearch<CR><F7>
-" Toggle open buffers
-" nnoremap <silent> <F8> :BuffergatorToggle<CR>
-" For fuzzy finder
-""nnoremap <silent> <F9> :Files<CR>
-" F10 split vertical
-"nnoremap <silent> <F9> :vsplit<CR>
-" F11 split horizontal
-"nnoremap <silent> <F10> :split<CR>
-" Make current buffer only buffer
-"nnoremap <silent> <F12> :only<CR>
-" Remap window switch
-" Switch to rename for LSP to do add leader
-""nnoremap <F4> :SearchTasks *<CR>
-
-nnoremap <silent> <leader>q :q<return>
-nnoremap <silent> <leader>n :NERDTreeToggle<return>
-nnoremap <silent> <leader>m :TagbarToggle<return>
-nnoremap <silent> <leader>l :set nonumber!<return>
-nnoremap <silent> <leader>o :only<return>
-nnoremap <silent> <leader>s :Startify<return>
-nnoremap <silent> <leader>w :w<return>
-nnoremap <silent> <leader>p :pclose<return>
-nnoremap <silent> <leader>b :BuffergatorToggle<return>
-nnoremap <silent> <leader>ch :ColorToggle<return>
-nnoremap <silent> <leader>gy :Goyo<return>
-nnoremap <silent> <leader>hi :nohlsearch<return>
-nnoremap <silent> <leader>hs :split<return>
-nnoremap <silent> <leader>vs :vsplit<return>
-nnoremap <silent> <leader>gh :call LanguageClient_textDocument_hover()<CR>
-nnoremap <silent> <leader>gd :call LanguageClient_textDocument_definition()<CR>
-nnoremap <silent> <leader>gr :call LanguageClient_textDocument_rename()<CR>
-nnoremap <silent> <leader>gc :call LanguageClient_contextMenu()<CR>
-nnoremap <silent> <leader>fr :call LanguageClient_textDocument_references()<CR>
-nnoremap <silent> <leader>fix :ALEFix<CR>
-nnoremap <silent> <leader>gi :ALEInfo<CR>
 
 
-" This is a funtion to open any file with <leader>(key sequence)
-    fun! OpenConfigFile(file)
-      if (&filetype ==? 'startify')
-        execute 'e ' . a:file
-      else
-        execute 'tabe ' . a:file
-      endif
-    endfun
-nnoremap <silent> <leader>in :call OpenConfigFile('~/.config/nvim/init.vim')<cr>
-nnoremap <silent> <leader>bashrc :call OpenConfigFile('~/.bashrc')<cr>
-nnoremap <silent> <leader>code :call OpenConfigFile('~/Library/Application Support/Code/User/settings.json')<cr>
 
 
 nnoremap <C-h> <C-w>h
 nnoremap <C-h> <C-w>h
 nnoremap <C-j> <C-w>j
 nnoremap <C-j> <C-w>j

+ 2 - 1
modules/language_server.vim

@@ -1,6 +1,7 @@
 " Required for operations modifying multiple buffers like rename.
 " Required for operations modifying multiple buffers like rename.
 set hidden
 set hidden
-
+" always show signcolumns
+set signcolumn=yes
 let g:LanguageClient_autoStart = 1
 let g:LanguageClient_autoStart = 1
 
 
 let g:LanguageClient_serverCommands = {
 let g:LanguageClient_serverCommands = {

+ 10 - 5
modules/plugins.vim

@@ -10,12 +10,15 @@ if dein#load_state('~/.config/nvim/dein')
 
 
   
   
   " All the Themes
   " All the Themes
-  call dein#add('flazz/vim-colorschemes')
-  "  call dein#add('liuchengxu/space-vim-dark')
-  "  call dein#add('joshdick/onedark.vim')
-  "  call dein#add('morhetz/gruvbox')
+  ""call dein#add('flazz/vim-colorschemes')
+  call dein#add('liuchengxu/space-vim-dark')
+  call dein#add('tomasiser/vim-code-dark')
+  call dein#add('joshdick/onedark.vim')
+  call dein#add('morhetz/gruvbox')
   call dein#add('jacoborus/tender.vim')
   call dein#add('jacoborus/tender.vim')
   call dein#add('luochen1990/rainbow')
   call dein#add('luochen1990/rainbow')
+  " key menu popup "
+  call dein#add('liuchengxu/vim-which-key')
   "Interface"
   "Interface"
   call dein#add('Shougo/denite.nvim')
   call dein#add('Shougo/denite.nvim')
   "  Neoterm
   "  Neoterm
@@ -39,12 +42,14 @@ if dein#load_state('~/.config/nvim/dein')
   " For ctags
   " For ctags
   call dein#add('ludovicchabant/vim-gutentags')
   call dein#add('ludovicchabant/vim-gutentags')
   call dein#add('skywind3000/gutentags_plus')
   call dein#add('skywind3000/gutentags_plus')
+  " Better Previews "
+  call dein#add('skywind3000/vim-preview')
   " Tagbar
   " Tagbar
   call dein#add('majutsushi/tagbar')
   call dein#add('majutsushi/tagbar')
   " Auto Pairs
   " Auto Pairs
   call dein#add('jiangmiao/auto-pairs')
   call dein#add('jiangmiao/auto-pairs')
   " Buffergator use \b
   " Buffergator use \b
-  call dein#add('jeetsukumaran/vim-buffergator')
+""  call dein#add('jeetsukumaran/vim-buffergator')
   " Ctrlp 
   " Ctrlp 
   call dein#add('ctrlpvim/ctrlp.vim')
   call dein#add('ctrlpvim/ctrlp.vim')
   "Linting 
   "Linting 

+ 1 - 1
modules/pydocstring.vim

@@ -1,2 +1,2 @@
-nmap <silent> <leader>doc <Plug>(pydocstring)
+"nmap <silent> <leader>doc <Plug>(pydocstring)
 
 

+ 16 - 6
modules/startify.vim

@@ -1,6 +1,16 @@
-let g:startify_custom_header = [                                                                                                                                                                                 
-	\ '     _   __                _         ',
-	\ '    / | / /__  ____ _   __(_)___ ___ ',
-	\ '   /  |/ / _ \/ __ \ | / / / __ `__ \',
-	\ '  / /|  /  __/ /_/ / |/ / / / / / / /',
-	\ ' /_/ |_/\___/\____/|___/_/_/ /_/ /_/ ']
+
+let g:startify_custom_header = [
+\ '  __    _________                            __    ____   ____.__          ',
+\ ' / /   /   _____/__________    ____  ____    \ \   \   \ /   /|__| _____   ',
+\ '/ /    \_____  \\____ \__  \ _/ ___\/ __ \    \ \   \   Y   / |  |/     \  ',
+\ '\ \    /        \  |_> > __ \\  \__\  ___/    / /    \     /  |  |  Y Y  \ ',
+\ ' \_\  /_______  /   __(____  /\___  >___  >  /_/      \___/   |__|__|_|  / ',
+\ '              \/|__|       \/     \/    \/                             \/  ']
+
+
+"let g:startify_custom_header = [                                                                                                                                                                                 
+  "\ '     _   __                _         ',
+  "\ '    / | / /__  ____ _   __(_)___ ___ ',
+  "\ '   /  |/ / _ \/ __ \ | / / / __ `__ \',
+  "\ '  / /|  /  __/ /_/ / |/ / / / / / / /',
+  "\ ' /_/ |_/\___/\____/|___/_/_/ /_/ /_/ ']

+ 1 - 1
modules/theme.vim

@@ -2,7 +2,7 @@
 " Switch to whatever colorscheme you like
 " Switch to whatever colorscheme you like
 "colorscheme onedark
 "colorscheme onedark
 ""colorscheme gruvbox
 ""colorscheme gruvbox
-colorscheme tender
+colorscheme codedark
 
 
 " This chunk is just for spacevim theme
 " This chunk is just for spacevim theme
 "colorscheme space-vim-dark
 "colorscheme space-vim-dark

+ 106 - 0
modules/vim-which-key.vim

@@ -0,0 +1,106 @@
+" set which key
+"
+" Any keymapping that involves <leader is here>
+nnoremap <silent> <leader> :WhichKey '<Space>'<CR>
+let g:which_key_sep = '→'
+
+" By default timeoutlen is 1000 ms
+set timeoutlen=100
+
+let g:mapleader = "\<Space>"
+let g:maplocalleader = ','
+
+let g:which_key_map =  {}
+"let g:which_key_default_group_name = ''
+"let g:which_key_map.f = { 'name' : '+file' }
+"nnoremap <silent> <leader>fs :update<CR>
+"let g:which_key_map.f.s = ['update', 'save-file']
+
+" This is a funtion to open any file with <leader>(key sequence)
+fun! OpenConfigFile(file)
+  if (&filetype ==? 'startify')
+    execute 'e ' . a:file
+  else
+    execute 'tabe ' . a:file
+  endif
+endfun
+
+nnoremap <silent> <leader>in :call OpenConfigFile('~/.config/nvim/init.vim')<cr>
+nnoremap <silent> <leader>bashrc :call OpenConfigFile('~/.bashrc')<cr>
+nnoremap <silent> <leader>code :call OpenConfigFile('~/Library/Application Support/Code/User/settings.json')<cr>
+
+let g:which_key_map['/'] = [ '<Plug>NERDCommenterToggle','commenter' ]
+let g:which_key_map['p'] = [ 'pclose','close-preview' ]
+let g:which_key_map['q'] = [ 'q','quit' ]
+let g:which_key_map['s'] = [ 'w','save' ]
+
+let g:which_key_map.t = {
+      \ 'name' : '+toggle' ,
+      \ 'f' : ['NERDTreeToggle'    , 'file-explorer']           ,
+      \ 'b' : ['TagbarToggle'      , 'tagbar']                  ,
+      \ 'l' : ['set nonumber!'     , 'line-numbers']            ,
+      \ 's' : ['nohlsearch'        , 'remove-search-highlight'] ,
+      \ 'c' : ['ColorToggle'       , 'remove-color']            ,
+      \ }
+
+let g:which_key_map.h = {
+      \ 'name' : '+highlights' ,
+      \ 's' : ['nohlsearch'     , 'remove-search-highlight'] ,
+      \ 'c' : ['ColorToggle'    , 'remove-color']            ,
+      \ }
+
+      "\ 'f' : ['LanguageClient#textDocument_formatting()'     , 'formatting']       ,
+let g:which_key_map.l = {
+      \ 'name' : '+lsp' ,
+      \ 'c' : ['LanguageClient_contextMenu()'                 , 'context_menu']     ,
+      \ 'f' : ['ALEFix'                                       , 'formatting']       ,
+      \ 'i' : ['ALEInfo'                                      , 'info']             ,
+      \ 'h' : ['LanguageClient#textDocument_hover()'          , 'hover']            ,
+      \ 'r' : ['LanguageClient#textDocument_references()'     , 'references']       ,
+      \ 'R' : ['LanguageClient#textDocument_rename()'         , 'rename']           ,
+      \ 's' : ['LanguageClient#textDocument_documentSymbol()' , 'document-symbol']  ,
+      \ 'S' : ['LanguageClient#workspace_symbol()'            , 'workspace-symbol'] ,
+      \ 'g' : {
+        \ 'name': '+goto',
+        \ 'd' : ['LanguageClient#textDocument_definition()'     , 'definition']       ,
+        \ 't' : ['LanguageClient#textDocument_typeDefinition()' , 'type-definition']  ,
+        \ 'i' : ['LanguageClient#textDocument_implementation()'  , 'implementation']  ,
+        \ },
+      \ 'p' : {
+        \ 'name': '+python',
+        \ 'd' : ['<Plug>(pydocstring)'  , 'python-docstring']  ,
+        \ },
+      \ }
+
+let g:which_key_map.w = {
+      \ 'name' : '+windows' ,
+      \ 'v' : ['<C-W>v'     , 'split-window-right']    ,
+      \ 'h' : ['<C-W>s'     , 'split-window-below']    ,
+      \ 'w' : ['<C-W>w'     , 'other-window']          ,
+      \ 'o' : ['only'       , 'close-all-other-windows']    ,
+      \ 'd' : ['<C-W>c'     , 'delete-window']         ,
+      \ '2' : ['<C-W>v'     , 'layout-double-columns'] ,
+      \ '=' : ['<C-W>='     , 'balance-window']        ,
+      \ '?' : ['Windows'    , 'fzf-window']            ,
+      \ }
+
+let g:which_key_map.b = {
+       \ 'name' : '+buffer' ,
+       \ '1' : ['b1'        , 'buffer 1']        ,
+       \ '2' : ['b2'        , 'buffer 2']        ,
+       \ 'd' : ['bd'        , 'delete-buffer']   ,
+       \ 'f' : ['bfirst'    , 'first-buffer']    ,
+       \ 'l' : ['blast'     , 'last-buffer']     ,
+       \ 'n' : ['bnext'     , 'next-buffer']     ,
+       \ 'p' : ['bprevious' , 'previous-buffer'] ,
+       \ '?' : ['Buffers'   , 'fzf-buffer']      ,
+       \ 's' : ['Startify'  , 'Startify']     ,
+       \ 'g' : ['Goyo'      , 'Goyo'] ,
+       \ }
+
+call which_key#register('<Space>', "g:which_key_map")
+nnoremap <silent> <leader> :<c-u>WhichKey '<Space>'<CR>
+vnoremap <silent> <leader> :<c-u>WhichKeyVisual '<Space>'<CR>
+
+""nnoremap <silent> <leader>      :<c-u>WhichKey '<Space>'<CR>
+""nnoremap <silent> <localleader> :<c-u>WhichKey  ','<CR>