Quellcode durchsuchen

which key basics

Chris vor 5 Jahren
Ursprung
Commit
f491cba672
9 geänderte Dateien mit 160 neuen und 42 gelöschten Zeilen
  1. 27 0
      coc-settings.json
  2. 2 0
      general/settings.vim
  3. 7 1
      init.vim
  4. 91 6
      keys/which-key.vim
  5. 21 28
      plug-config/coc.vim
  6. 5 5
      plug-config/fzf.vim
  7. 1 1
      plug-config/sneak.vim
  8. 6 0
      plug-config/start-screen.vim
  9. 0 1
      vim-plug/plugins.vim

+ 27 - 0
coc-settings.json

@@ -1,10 +1,31 @@
 {
 {
+
+  // suggestions
+  // "suggest.echodocSupport": true,
+
+  // diagnostics
+  "diagnostic.errorSign": "✗",
+  "diagnostic.warningSign": "⚠",
+  "diagnostic.infoSign": "",
+  "diagnostic.hintSign": " ",
+  // "diagnostic.displayByAle": true,
+
+  // codelens TODO what does this get me?
+  // "codeLens.enable": true,
+
+  // list
+  "list.indicator": ">",
+  "list.selectedSignText": " ",
+
+  // autoformat
   "coc.preferences.formatOnSaveFiletypes": ["css", "markdown", "javascript", "graphql", "html", "yaml",  "json", "python"],
   "coc.preferences.formatOnSaveFiletypes": ["css", "markdown", "javascript", "graphql", "html", "yaml",  "json", "python"],
+  "coc.preferences.hoverTarget": "float",
 
 
   // python config
   // python config
   "python.linting.enabled": true,
   "python.linting.enabled": true,
   "python.linting.pylintEnabled": true,
   "python.linting.pylintEnabled": true,
 
 
+  // snippets
   "snippets.ultisnips.directories": 
   "snippets.ultisnips.directories": 
   [
   [
     "UltiSnips",
     "UltiSnips",
@@ -15,8 +36,14 @@
   "explorer.width": 30,
   "explorer.width": 30,
   "explorer.icon.enableNerdfont": true,
   "explorer.icon.enableNerdfont": true,
   "explorer.previewAction.onHover": false,
   "explorer.previewAction.onHover": false,
+  "explorer.icon.enableVimDevicons": true,
   "explorer.keyMappings": {
   "explorer.keyMappings": {
     "<cr>": ["expandable?", "expand", "open"],
     "<cr>": ["expandable?", "expand", "open"],
     "v": "open:vsplit"
     "v": "open:vsplit"
   }
   }
+
+  // TODO language servers
+  // TODO g:coc_global_extensions
+  // TODO b:coc_suggest_disable=1 GOYO
+  // TODO add to paths.vim g:coc_node_path
 }
 }

+ 2 - 0
general/settings.vim

@@ -38,6 +38,8 @@ if !exists('g:vscode')
   set formatoptions-=cro                  " Stop newline continution of comments
   set formatoptions-=cro                  " Stop newline continution of comments
   set clipboard=unnamedplus               " Copy paste between vim and everything else
   set clipboard=unnamedplus               " Copy paste between vim and everything else
   set incsearch
   set incsearch
+  set guifont=Hack\ Nerd\ Font
+  " let $NVIM_TUI_ENABLE_TRUE_COLOR=1
   " set mmp=1300
   " set mmp=1300
   " set autochdir                           " Your working directory will always be the same as your working directory
   " set autochdir                           " Your working directory will always be the same as your working directory
   " set foldcolumn=2                        " Folding abilities
   " set foldcolumn=2                        " Folding abilities

+ 7 - 1
init.vim

@@ -22,7 +22,6 @@ else
   source $HOME/.config/nvim/themes/syntax.vim
   source $HOME/.config/nvim/themes/syntax.vim
   source $HOME/.config/nvim/themes/onedark.vim
   source $HOME/.config/nvim/themes/onedark.vim
   source $HOME/.config/nvim/themes/airline.vim
   source $HOME/.config/nvim/themes/airline.vim
-  " source $HOME/.config/nvim/themes/eleline.vim
   source $HOME/.config/nvim/plug-config/rnvimr.vim
   source $HOME/.config/nvim/plug-config/rnvimr.vim
   source $HOME/.config/nvim/plug-config/fzf.vim
   source $HOME/.config/nvim/plug-config/fzf.vim
   source $HOME/.config/nvim/plug-config/commentary.vim
   source $HOME/.config/nvim/plug-config/commentary.vim
@@ -37,3 +36,10 @@ else
   source $HOME/.config/nvim/plug-config/signify.vim
   source $HOME/.config/nvim/plug-config/signify.vim
   luafile $HOME/.config/nvim/lua/plug-colorizer.lua
   luafile $HOME/.config/nvim/lua/plug-colorizer.lua
 endif
 endif
+
+let g:floaterm_wintype='normal'
+let g:floaterm_height=6
+let g:floaterm_keymap_new    = '<F7>'
+let g:floaterm_keymap_prev   = '<F8>'
+let g:floaterm_keymap_next   = '<F9>'
+let g:floaterm_keymap_toggle = '<F12>'

+ 91 - 6
keys/which-key.vim

@@ -2,15 +2,16 @@
 " call which_key#register('<Space>', "g:which_key_map")
 " call which_key#register('<Space>', "g:which_key_map")
 
 
 nnoremap <silent> <leader> :silent WhichKey ' '<CR>
 nnoremap <silent> <leader> :silent WhichKey ' '<CR>
+vnoremap <silent> <leader> :silent WhichKeyVisual ' '<CR>
+
+let g:which_key_map =  {}
+let g:which_key_sep = '→'
+" set timeoutlen=100
 
 
 " Not a fan of floating windows for this
 " Not a fan of floating windows for this
 let g:which_key_use_floating_win = 0
 let g:which_key_use_floating_win = 0
 
 
-" highlight default link WhichKey          Function
-" highlight default link WhichKeySeperator DiffAdded
-" highlight default link WhichKeyGroup     Keyword
-" highlight default link WhichKeyDesc      Identifier
-
+" Change the colors if you want
 highlight default link WhichKey          Operator
 highlight default link WhichKey          Operator
 highlight default link WhichKeySeperator DiffAdded
 highlight default link WhichKeySeperator DiffAdded
 highlight default link WhichKeyGroup     Identifier
 highlight default link WhichKeyGroup     Identifier
@@ -19,5 +20,89 @@ highlight default link WhichKeyDesc      Function
 " Hide status line
 " Hide status line
 autocmd! FileType which_key
 autocmd! FileType which_key
 autocmd  FileType which_key set laststatus=0 noshowmode noruler
 autocmd  FileType which_key set laststatus=0 noshowmode noruler
-  \| autocmd BufLeave <buffer> set laststatus=2 noshowmode ruler 
+  \| autocmd BufLeave <buffer> set laststatus=2 noshowmode ruler
+
+" f is for find
+let g:which_key_map.f = {
+      \ 'name' : '+find' ,
+      \ '/' : [':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'],
+      \ }
+let g:fzf_buffers_jump = 1
+
+" l is for language server protocol
+let g:which_key_map.l = {
+      \ 'name' : '+lsp' ,
+      \ '.' : [':CocConfig'                          , 'config'],
+      \ ';' : ['<Plug>(coc-refactor)'                , 'refactor'],
+      \ 'a' : ['<Plug>(coc-codeaction)'              , 'line action'],
+      \ 'A' : ['<Plug>(coc-codeaction-selected)'     , 'selected action'],
+      \ 'b' : [':CocNext'                            , 'next action'],
+      \ 'B' : [':CocPrev'                            , 'prev action'],
+      \ 'c' : [':CocList commands'                   , 'commands'],
+      \ 'd' : ['<Plug>(coc-definition)'              , 'definition'],
+      \ 'D' : ['<Plug>(coc-declaration)'             , 'declaration'],
+      \ 'e' : [':CocList extensions'                 , 'extensions'],
+      \ 'f' : ['<Plug>(coc-format-selected)'         , 'format selected'],
+      \ 'F' : ['<Plug>(coc-format)'                  , 'format'],
+      \ 'h' : ['<Plug>(coc-float-hide)'              , 'hide'],
+      \ 'i' : ['<Plug>(coc-implementation)'          , 'implementation'],
+      \ 'I' : [':CocList diagnostics'                , 'diagnostics'],
+      \ 'j' : ['<Plug>(coc-float-jump)'              , 'float jump'],
+      \ 'l' : ['<Plug>(coc-codelens-action)'         , 'code lens'],
+      \ 'n' : ['<Plug>(coc-diagnostic-next)'         , 'next diagnostic'],
+      \ 'N' : ['<Plug>(coc-diagnostic-next-error)'   , 'next error'],
+      \ 'o' : ['<Plug>(coc-openlink)'                , 'open link'],
+      \ 'O' : [':CocList outline'                    , 'outline'],
+      \ 'p' : ['<Plug>(coc-diagnostic-prev)'         , 'prev diagnostic'],
+      \ 'P' : ['<Plug>(coc-diagnostic-prev-error)'   , 'prev error'],
+      \ 'q' : ['<Plug>(coc-fix-current)'             , 'quickfix'],
+      \ 'r' : ['<Plug>(coc-rename)'                  , 'rename'],
+      \ 'R' : ['<Plug>(coc-references)'              , 'references'],
+      \ 's' : [':CocList -I symbols'                 , 'references'],
+      \ 't' : ['<Plug>(coc-type-definition)'         , 'type definition'],
+      \ 'u' : [':CocListResume'                      , 'resume list'],
+      \ 'U' : [':CocUpdate'                          , 'update CoC'],
+      \ 'z' : [':CocDisable'                         , 'disable CoC'],
+      \ 'Z' : [':CocEnable'                          , 'enable CoC'],
+      \ }
+
+
+" t is for toggle
+let g:which_key_map.t = {
+      \ 'name' : '+toggle' ,
+      \ 'e' : [':CocCommand explorer'    , 'explorer'],
+      \ 'n' : [':set nonumber!'          , 'line-numbers'],
+      \ 'r' : [':set norelativenumber!'  , 'rel-line-numbers'],
+      \ 's' : [':let @/ = ""'            , 'remove-search-highlight'],
+      \ 'c' : [':ColorizerToggle'        , 'colorizer'],
+      \ 't' : [':FloatermToggle'         , 'terminal'],
+      \ }
+
+
+
+
+call which_key#register('<Space>', "g:which_key_map")
 
 

+ 21 - 28
plug-config/coc.vim

@@ -22,10 +22,6 @@ else
   imap <expr> <cr> pumvisible() ? "\<C-y>" : "\<C-g>u\<CR>"
   imap <expr> <cr> pumvisible() ? "\<C-y>" : "\<C-g>u\<CR>"
 endif
 endif
 
 
-" Use `[g` and `]g` to navigate diagnostics
-nmap <silent> [g <Plug>(coc-diagnostic-prev)
-nmap <silent> ]g <Plug>(coc-diagnostic-next)
-
 " GoTo code navigation.
 " GoTo code navigation.
 nmap <silent> gd <Plug>(coc-definition)
 nmap <silent> gd <Plug>(coc-definition)
 nmap <silent> gy <Plug>(coc-type-definition)
 nmap <silent> gy <Plug>(coc-type-definition)
@@ -49,10 +45,6 @@ autocmd CursorHold * silent call CocActionAsync('highlight')
 " Symbol renaming.
 " Symbol renaming.
 nmap <leader>rn <Plug>(coc-rename)
 nmap <leader>rn <Plug>(coc-rename)
 
 
-" Formatting selected code.
-xmap <leader>f  <Plug>(coc-format-selected)
-nmap <leader>f  <Plug>(coc-format-selected)
-
 augroup mygroup
 augroup mygroup
   autocmd!
   autocmd!
   " Setup formatexpr specified filetype(s).
   " Setup formatexpr specified filetype(s).
@@ -63,13 +55,13 @@ augroup end
 
 
 " Applying codeAction to the selected region.
 " Applying codeAction to the selected region.
 " Example: `<leader>aap` for current paragraph
 " Example: `<leader>aap` for current paragraph
-xmap <leader>a  <Plug>(coc-codeaction-selected)
-nmap <leader>a  <Plug>(coc-codeaction-selected)
+" xmap <leader>a  <Plug>(coc-codeaction-selected)
+" nmap <leader>a  <Plug>(coc-codeaction-selected)
 
 
 " Remap keys for applying codeAction to the current line.
 " Remap keys for applying codeAction to the current line.
-nmap <leader>ac  <Plug>(coc-codeaction)
+" nmap <leader>ac  <Plug>(coc-codeaction)
 " Apply AutoFix to problem on the current line.
 " Apply AutoFix to problem on the current line.
-nmap <leader>qf  <Plug>(coc-fix-current)
+" nmap <leader>qf  <Plug>(coc-fix-current)
 
 
 " Introduce function text object
 " Introduce function text object
 " NOTE: Requires 'textDocument.documentSymbol' support from the language server.
 " NOTE: Requires 'textDocument.documentSymbol' support from the language server.
@@ -100,21 +92,22 @@ set statusline^=%{coc#status()}%{get(b:,'coc_current_function','')}
 
 
 " Mappings using CoCList:
 " Mappings using CoCList:
 " Show all diagnostics.
 " Show all diagnostics.
-nnoremap <silent> <space>a  :<C-u>CocList diagnostics<cr>
-" Manage extensions.
-nnoremap <silent> <space>e  :<C-u>CocList extensions<cr>
-" Show commands.
-nnoremap <silent> <space>c  :<C-u>CocList commands<cr>
-" Find symbol of current document.
-nnoremap <silent> <space>o  :<C-u>CocList outline<cr>
-" Search workspace symbols.
-nnoremap <silent> <space>s  :<C-u>CocList -I symbols<cr>
-" Do default action for next item.
-nnoremap <silent> <space>j  :<C-u>CocNext<CR>
-" Do default action for previous item.
-nnoremap <silent> <space>k  :<C-u>CocPrev<CR>
-" Resume latest coc list.
-nnoremap <silent> <space>p  :<C-u>CocListResume<CR>
+" TODO add these to which key
+" nnoremap <silent> <space>a  :<C-u>CocList diagnostics<cr>
+" " Manage extensions.
+" nnoremap <silent> <space>e  :<C-u>CocList extensions<cr>
+" " Show commands.
+" nnoremap <silent> <space>c  :<C-u>CocList commands<cr>
+" " Find symbol of current document.
+" nnoremap <silent> <space>o  :<C-u>CocList outline<cr>
+" " Search workspace symbols.
+" nnoremap <silent> <space>s  :<C-u>CocList -I symbols<cr>
+" " Do default action for next item.
+" nnoremap <silent> <space>j  :<C-u>CocNext<CR>
+" " Do default action for previous item.
+" nnoremap <silent> <space>k  :<C-u>CocPrev<CR>
+" " Resume latest coc list.
+" nnoremap <silent> <space>p  :<C-u>CocListResume<CR>
 
 
 " Explorer
 " Explorer
 let g:coc_explorer_global_presets = {
 let g:coc_explorer_global_presets = {
@@ -137,5 +130,5 @@ let g:coc_explorer_global_presets = {
 \ }
 \ }
 "nmap <silent> <space>e :CocCommand explorer<CR>
 "nmap <silent> <space>e :CocCommand explorer<CR>
 nnoremap <silent> <leader>e :CocCommand explorer<CR>
 nnoremap <silent> <leader>e :CocCommand explorer<CR>
-nmap <space>f :CocCommand explorer --preset floatingRightside<CR>
+" nmap <space>f :CocCommand explorer --preset floatingRightside<CR>
 autocmd BufEnter * if (winnr("$") == 1 && &filetype == 'coc-explorer') | q | endif
 autocmd BufEnter * if (winnr("$") == 1 && &filetype == 'coc-explorer') | q | endif

+ 5 - 5
plug-config/fzf.vim

@@ -10,11 +10,11 @@ let g:fzf_action = {
 " explicitly bind the keys to down and up in your $FZF_DEFAULT_OPTS.
 " explicitly bind the keys to down and up in your $FZF_DEFAULT_OPTS.
 let g:fzf_history_dir = '~/.local/share/fzf-history'
 let g:fzf_history_dir = '~/.local/share/fzf-history'
 
 
-map <C-f> :Files<CR>
-map <leader>b :Buffers<CR>
-nnoremap <leader>g :Rg<CR>
-nnoremap <leader>t :Tags<CR>
-nnoremap <leader>m :Marks<CR>
+" map <C-f> :Files<CR>
+" map <leader>b :Buffers<CR>
+" nnoremap <leader>g :Rg<CR>
+" nnoremap <leader>t :Tags<CR>
+" nnoremap <leader>m :Marks<CR>
 
 
 
 
 let g:fzf_tags_command = 'ctags -R'
 let g:fzf_tags_command = 'ctags -R'

+ 1 - 1
plug-config/sneak.vim

@@ -15,7 +15,7 @@ highlight Sneak guifg=black guibg=#00C7DF ctermfg=black ctermbg=cyan
 highlight SneakScope guifg=red guibg=yellow ctermfg=red ctermbg=yellow
 highlight SneakScope guifg=red guibg=yellow ctermfg=red ctermbg=yellow
 
 
 " Cool prompt
 " Cool prompt
-let g:sneak#prompt = '🔎'
+let g:sneak#prompt = '🔎 '
 
 
 " I like quickscope better for this since it keeps me in the scope of a single line
 " I like quickscope better for this since it keeps me in the scope of a single line
 " map f <Plug>Sneak_f
 " map f <Plug>Sneak_f

+ 6 - 0
plug-config/start-screen.vim

@@ -23,6 +23,12 @@ let g:startify_change_to_vcs_root = 1
 let g:startify_fortune_use_unicode = 1
 let g:startify_fortune_use_unicode = 1
 let g:startify_session_persistence = 1
 let g:startify_session_persistence = 1
 
 
+let g:webdevicons_enable_startify = 1
+
+function! StartifyEntryFormat()
+        return 'WebDevIconsGetFileTypeSymbol(absolute_path) ." ". entry_path'
+    endfunction
+
 let g:startify_bookmarks = [
 let g:startify_bookmarks = [
             \ { 'c': '~/.config/i3/config' },
             \ { 'c': '~/.config/i3/config' },
             \ { 'i': '~/.config/nvim/init.vim' },
             \ { 'i': '~/.config/nvim/init.vim' },

+ 0 - 1
vim-plug/plugins.vim

@@ -47,7 +47,6 @@ call plug#begin('~/.config/nvim/autoload/plugged')
     " Intellisense
     " Intellisense
     Plug 'neoclide/coc.nvim', {'branch': 'release'}
     Plug 'neoclide/coc.nvim', {'branch': 'release'}
     " Status Line
     " Status Line
-    " Plug 'ChristianChiarulli/eleline.vim'
     Plug 'vim-airline/vim-airline'
     Plug 'vim-airline/vim-airline'
     Plug 'vim-airline/vim-airline-themes'
     Plug 'vim-airline/vim-airline-themes'
     " Ranger
     " Ranger