From 718b37578cca47c3bf25a6a4439f28322b4f46c9 Mon Sep 17 00:00:00 2001 From: ChristianChiarulli Date: Wed, 20 Feb 2019 12:24:54 -0500 Subject: added which key and remapped bindings --- modules/airline.vim | 2 +- modules/general.vim | 65 ++------------------------- modules/language_server.vim | 3 +- modules/plugins.vim | 15 ++++--- modules/pydocstring.vim | 2 +- modules/startify.vim | 22 ++++++--- modules/theme.vim | 2 +- modules/vim-which-key.vim | 106 ++++++++++++++++++++++++++++++++++++++++++++ 8 files changed, 140 insertions(+), 77 deletions(-) create mode 100644 modules/vim-which-key.vim (limited to 'modules') diff --git a/modules/airline.vim b/modules/airline.vim index bf99c2eb..6d2aae4c 100644 --- a/modules/airline.vim +++ b/modules/airline.vim @@ -3,7 +3,7 @@ let g:airline#extensions#tabline#enabled = 1 " enable powerline fonts let g:airline_powerline_fonts = 1 " Switch to your current theme -let g:airline_theme = 'tender' +let g:airline_theme = 'codedark' " Always show tabs set showtabline=2 " We don't need to see things like -- INSERT -- anymore diff --git a/modules/general.vim b/modules/general.vim index 6a6f9b0d..2b27b8fc 100644 --- a/modules/general.vim +++ b/modules/general.vim @@ -13,6 +13,7 @@ syntax enable " Enables syntax highlighing set hidden " Required for specific actions that require multiple buffers set nowrap " display long lines as just one line set encoding=utf-8 " The encoding displayed +set pumheight=10 " Makes popup menu smaller set fileencoding=utf-8 " The encoding written to file set ruler " show the cursor position all the time 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:elite_mode=1 " Disable arrows" - +filetype plugin indent on " Gives vim abilty to recognize filetypes + " Disable arrow movement, resize splits instead. if get(g:, 'elite_mode') nnoremap :resize -2 @@ -44,8 +46,6 @@ if get(g:, 'elite_mode') nnoremap :vertical resize +2 endif -" Gives vim abilty to recognize filetypes -filetype plugin indent on " Alternate way to save nnoremap :w " Alternate way to quit @@ -57,66 +57,7 @@ inoremap pumvisible() ? "\" : "\" " Open terminal with F1 nnoremap :10split term://bash nnoremap :bdelete! term://* -" insert mode for terminal -""autocmd BufWinEnter,WinEnter term://* startinsert -""autocmd BufLeave term://* stopinsert -" Toggle tagbar -"nnoremap :TagbarToggle -" Toggle Line numbers -"nnoremap :set nonumber! -" Toggle NERDTree -"nnoremap :NERDTreeToggle -" Startify -"nnoremap :Startify -" Get rid of highlights after search -"nnoremap :nohlsearch -" Toggle open buffers -" nnoremap :BuffergatorToggle -" For fuzzy finder -""nnoremap :Files -" F10 split vertical -"nnoremap :vsplit -" F11 split horizontal -"nnoremap :split -" Make current buffer only buffer -"nnoremap :only -" Remap window switch -" Switch to rename for LSP to do add leader -""nnoremap :SearchTasks * - -nnoremap q :q -nnoremap n :NERDTreeToggle -nnoremap m :TagbarToggle -nnoremap l :set nonumber! -nnoremap o :only -nnoremap s :Startify -nnoremap w :w -nnoremap p :pclose -nnoremap b :BuffergatorToggle -nnoremap ch :ColorToggle -nnoremap gy :Goyo -nnoremap hi :nohlsearch -nnoremap hs :split -nnoremap vs :vsplit -nnoremap gh :call LanguageClient_textDocument_hover() -nnoremap gd :call LanguageClient_textDocument_definition() -nnoremap gr :call LanguageClient_textDocument_rename() -nnoremap gc :call LanguageClient_contextMenu() -nnoremap fr :call LanguageClient_textDocument_references() -nnoremap fix :ALEFix -nnoremap gi :ALEInfo -" This is a funtion to open any file with (key sequence) - fun! OpenConfigFile(file) - if (&filetype ==? 'startify') - execute 'e ' . a:file - else - execute 'tabe ' . a:file - endif - endfun -nnoremap in :call OpenConfigFile('~/.config/nvim/init.vim') -nnoremap bashrc :call OpenConfigFile('~/.bashrc') -nnoremap code :call OpenConfigFile('~/Library/Application Support/Code/User/settings.json') nnoremap h nnoremap j diff --git a/modules/language_server.vim b/modules/language_server.vim index d3b06011..70c010cb 100644 --- a/modules/language_server.vim +++ b/modules/language_server.vim @@ -1,6 +1,7 @@ " Required for operations modifying multiple buffers like rename. set hidden - +" always show signcolumns +set signcolumn=yes let g:LanguageClient_autoStart = 1 let g:LanguageClient_serverCommands = { diff --git a/modules/plugins.vim b/modules/plugins.vim index debf33d1..7882e2d0 100644 --- a/modules/plugins.vim +++ b/modules/plugins.vim @@ -10,12 +10,15 @@ if dein#load_state('~/.config/nvim/dein') " 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('luochen1990/rainbow') + " key menu popup " + call dein#add('liuchengxu/vim-which-key') "Interface" call dein#add('Shougo/denite.nvim') " Neoterm @@ -39,12 +42,14 @@ if dein#load_state('~/.config/nvim/dein') " For ctags call dein#add('ludovicchabant/vim-gutentags') call dein#add('skywind3000/gutentags_plus') + " Better Previews " + call dein#add('skywind3000/vim-preview') " Tagbar call dein#add('majutsushi/tagbar') " Auto Pairs call dein#add('jiangmiao/auto-pairs') " Buffergator use \b - call dein#add('jeetsukumaran/vim-buffergator') +"" call dein#add('jeetsukumaran/vim-buffergator') " Ctrlp call dein#add('ctrlpvim/ctrlp.vim') "Linting diff --git a/modules/pydocstring.vim b/modules/pydocstring.vim index 34ce0e64..c0200b76 100644 --- a/modules/pydocstring.vim +++ b/modules/pydocstring.vim @@ -1,2 +1,2 @@ -nmap doc (pydocstring) +"nmap doc (pydocstring) diff --git a/modules/startify.vim b/modules/startify.vim index 46731681..8cdaf8b8 100644 --- a/modules/startify.vim +++ b/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 = [ + "\ ' _ __ _ ', + "\ ' / | / /__ ____ _ __(_)___ ___ ', + "\ ' / |/ / _ \/ __ \ | / / / __ `__ \', + "\ ' / /| / __/ /_/ / |/ / / / / / / /', + "\ ' /_/ |_/\___/\____/|___/_/_/ /_/ /_/ '] diff --git a/modules/theme.vim b/modules/theme.vim index 38226b61..e302aee9 100644 --- a/modules/theme.vim +++ b/modules/theme.vim @@ -2,7 +2,7 @@ " Switch to whatever colorscheme you like "colorscheme onedark ""colorscheme gruvbox -colorscheme tender +colorscheme codedark " This chunk is just for spacevim theme "colorscheme space-vim-dark diff --git a/modules/vim-which-key.vim b/modules/vim-which-key.vim new file mode 100644 index 00000000..0bfb55cf --- /dev/null +++ b/modules/vim-which-key.vim @@ -0,0 +1,106 @@ +" set which key +" +" Any keymapping that involves +nnoremap :WhichKey '' +let g:which_key_sep = '→' + +" By default timeoutlen is 1000 ms +set timeoutlen=100 + +let g:mapleader = "\" +let g:maplocalleader = ',' + +let g:which_key_map = {} +"let g:which_key_default_group_name = '' +"let g:which_key_map.f = { 'name' : '+file' } +"nnoremap fs :update +"let g:which_key_map.f.s = ['update', 'save-file'] + +" This is a funtion to open any file with (key sequence) +fun! OpenConfigFile(file) + if (&filetype ==? 'startify') + execute 'e ' . a:file + else + execute 'tabe ' . a:file + endif +endfun + +nnoremap in :call OpenConfigFile('~/.config/nvim/init.vim') +nnoremap bashrc :call OpenConfigFile('~/.bashrc') +nnoremap code :call OpenConfigFile('~/Library/Application Support/Code/User/settings.json') + +let g:which_key_map['/'] = [ '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' : ['(pydocstring)' , 'python-docstring'] , + \ }, + \ } + +let g:which_key_map.w = { + \ 'name' : '+windows' , + \ 'v' : ['v' , 'split-window-right'] , + \ 'h' : ['s' , 'split-window-below'] , + \ 'w' : ['w' , 'other-window'] , + \ 'o' : ['only' , 'close-all-other-windows'] , + \ 'd' : ['c' , 'delete-window'] , + \ '2' : ['v' , 'layout-double-columns'] , + \ '=' : ['=' , '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('', "g:which_key_map") +nnoremap :WhichKey '' +vnoremap :WhichKeyVisual '' + +""nnoremap :WhichKey '' +""nnoremap :WhichKey ',' -- cgit v1.2.3