Chris 4 years ago
parent
commit
784fdcf19d
6 changed files with 102 additions and 10 deletions
  1. 1 0
      README.md
  2. 6 0
      lua/keymappings.lua
  3. 66 0
      lua/nv-far/init.lua
  4. 3 1
      lua/nv-utils/init.lua
  5. 3 1
      lua/plugins.lua
  6. 23 8
      vimscript/nv-whichkey/init.vim

+ 1 - 0
README.md

@@ -46,6 +46,7 @@ $HOME/.config/nvim/lua/nv-vscode/init.vim
 - formatting using efm server for python
 - formatting using efm server for prettier/eslint
 - snippet support
+- learn what opt is
 
 **LOW PRIORITY**
 - redo barbar highlight groups

+ 6 - 0
lua/keymappings.lua

@@ -65,3 +65,9 @@ vim.cmd('inoremap <expr> <c-k> (\"\\<C-p>\")')
 -- TAB Complete
 --vim.api.nvim_set_keymap('i', '<expr><TAB>', 'pumvisible() ? \"\\<C-n>\" : \"\\<TAB>\"', { noremap = true, silent = true })
 
+vim.cmd([[
+map p <Plug>(miniyank-autoput)
+map P <Plug>(miniyank-autoPut)
+map <leader>n <Plug>(miniyank-cycle)
+map <leader>N <Plug>(miniyank-cycleback)
+]])

+ 66 - 0
lua/nv-far/init.lua

@@ -0,0 +1,66 @@
+vim.cmd([[
+set lazyredraw            " improve scrolling performance when navigating through large results
+
+let g:far#window_width=50
+" Use %:p with buffer option only
+let g:far#file_mask_favorites=['%:p', '**/*.*', '**/*.js', '**/*.py', '**/*.java', '**/*.css', '**/*.html', '**/*.vim', '**/*.cpp', '**/*.c', '**/*.h', ]
+let g:far#window_min_content_width=30
+let g:far#enable_undo=1
+
+" let g:far#ignore_files=['$HOME/.config/nvim/utils/farignore']
+" let g:far#ignore_files=['node_modules/']
+
+"     Below are the default mappings and corresponding variable names in
+
+" x v_x   - Exclude item under the cursor.
+
+" i v_i   - Include item under the cursor.
+
+" t v_t   - Toggle item exclusion under the cursor.
+
+" f v_f   - Smartly toggle item exclusion under the cursor: exclude all items when all are excluded, otherwise exclude all items.
+
+" X       - Exclude all items.
+
+" I       - Include all items.
+
+" T       - Toggle exclusion for all items.
+
+" F       - Smartly toggle exclusion for all items: include all items when all are excluded, otherwise exclude all items.
+
+" <CR>    - Jump to the source code of the item under the cursor. See |far-jump|
+
+" p       - Open preview window (if not) and scroll to the item under the cursor. See |far-preview|
+
+" P       - Close preview window. See |far-preview|
+
+" CTRL-K  - Scroll preview window up (if open). See |far-preview|, |g:far#preview_window_scroll_step|
+
+" CTRL-J  - Scroll preview window down (if open). See |far-preview|, |g:far#preview_window_scroll_step|
+
+" zo      - Expand node under the cursor.
+
+" zc      - Collapse node under the cursor.
+
+" za      - Toggle node expanding under the cursor.
+
+" zs      - Smartly toggle exclusion for all nodes: expand all nodes when all are collapsed, otherwise collapse all nodes.
+
+" zr v_zr - Expand all nodes.
+
+" zm v_zm - Collapse all nodes.
+
+" zA v_zA - Toggle exclusion for all nodes.
+
+" zS v_zS - Smartly toggle exclusion for all nodes: expand all nodes when all are collapsed, otherwise collapse all nodes.
+
+" s v_s   - Execute |:Fardo|<CR>, to replace all included items.
+
+" u v_s   - Execute |:Farundo|<CR>, to undo the last replacement by |:Fardo|.
+
+" U v_U   - Execute |:Farundo| --all=1<CR>, to undo all replacements by |:Fardo|. For param '--all=' see |farundo-params|.
+
+" q v_q   - Close searching result buffer and its preview buffer (if exists)
+
+]])
+

+ 3 - 1
lua/nv-utils/init.lua

@@ -29,7 +29,9 @@ function_wrapper.define_augroups(
             {'BufNewFile', '*', 'setlocal formatoptions-=c formatoptions-=r formatoptions-=o'},
             {'FileType', 'java', 'luafile ~/.config/nvim/lua/lsp/java-ls.lua'},
             {'FileType', 'java', 'nnoremap ca <Cmd>lua require(\'jdtls\').code_action()<CR>'},
-
+            {'FileType', 'java', 'nnoremap ca <Cmd>lua require(\'jdtls\').code_action()<CR>'},
+            {'User', 'GoyoLeave', 'lua require(\'galaxyline\').disable_galaxyline()'},
+            {'User', 'GoyoEnter', 'lua require(\'galaxyline\').galaxyline_augroup()'},
         },
     }
 )

+ 3 - 1
lua/plugins.lua

@@ -117,5 +117,7 @@ return require('packer').startup(function(use)
   --use 'suy/vim-context-commentstring'
   -- use 'b3nj5m1n/kommentary'
   use 'andymass/vim-matchup'
-  use 'sheerun/vim-polyglot'
+  use 'junegunn/goyo.vim'
+  use 'bfredl/nvim-miniyank'
+  use 'brooth/far.vim'
 end)

+ 23 - 8
vimscript/nv-whichkey/init.vim

@@ -21,26 +21,35 @@ autocmd! FileType which_key
 autocmd  FileType which_key set laststatus=0 noshowmode noruler
   \| autocmd BufLeave <buffer> set laststatus=2 noshowmode ruler
 
-
+" " delete without yanking
+" nnoremap <leader>d "_d
+" vnoremap <leader>d "_d
+" 
+" " replace currently selected text with default register
+" " without yanking it
+" vnoremap <leader>p "_dP
+" vnoremap <leader>p "_dP
+map <leader>p <Plug>(miniyank-startput)
+map <leader>P <Plug>(miniyank-startPut)
 " Single mappings
-" let g:which_key_map['/'] = [ ':call Comment()'                                 , 'comment' ]
-" let g:which_key_map['/'] = { 'name' : 'comment' }
-
-"let g:which_key_map['/'] = [ ':call Comment()'                                 , 'comment' ]
 let g:which_key_map['/'] = 'which_key_ignore'
+let g:which_key_map['p'] = 'which_key_ignore'
+let g:which_key_map['P'] = 'which_key_ignore'
+let g:which_key_map['n'] = 'which_key_ignore'
+let g:which_key_map['N'] = 'which_key_ignore'
 let g:which_key_map['?'] = [ ':NvimTreeFindFile'                               , 'find current file' ]
 let g:which_key_map['e'] = [ ':NvimTreeToggle'                                 , 'explorer' ]
 let g:which_key_map['f'] = [ ':Telescope find_files'                           , 'find files' ]
 let g:which_key_map['h'] = [ '<C-W>s'                                          , 'split below']
 let g:which_key_map['m'] = [ ':MarkdownPreviewToggle'                          , 'markdown preview']
-let g:which_key_map['n'] = [ ':let @/ = ""'                                    , 'no highlight' ]
+let g:which_key_map['h'] = [ ':let @/ = ""'                                    , 'no highlight' ]
 let g:which_key_map['r'] = [ ':RnvimrToggle'                                   , 'ranger' ]
-let g:which_key_map['p'] = [ '"0p'                                             , 'paste' ]
+" let g:which_key_map['p'] = [ '"0p'                                             , 'paste' ]
 " TODO create entire treesitter section
 let g:which_key_map['T'] = [ ':TSHighlightCapturesUnderCursor'                 , 'treesitter highlight' ]
 let g:which_key_map['v'] = [ '<C-W>v'                                          , 'split right']
 " Add Zen mode, play nice with status line
-" let g:which_key_map['z'] = [ 'Goyo'                                            , 'zen' ]
+let g:which_key_map['z'] = [ 'Goyo'                                            , 'zen' ]
 
 " Group mappings
 
@@ -206,4 +215,10 @@ let g:which_key_map.t = {
       \ }
       " \ 'r' : [':FloatermNew ranger'                            , 'ranger'],
 
+let g:which_key_map.R = {
+      \ 'name' : '+Find_Replace' ,
+      \ 'f' : [':Farr --source=vimgrep'    , 'file'],
+      \ 'p' : [':Farr --source=rgnvim'     , 'project'],
+      \ }
+
 call which_key#register('<Space>', "g:which_key_map")