From 4075f40f459f42c8fdecda8e3ac2e84c80398830 Mon Sep 17 00:00:00 2001 From: Chris Date: Thu, 2 Apr 2020 03:01:55 -0400 Subject: auto push --- coc-settings.json | 2 +- init.vim | 4 +- modules/ctrlp.vim | 2 - modules/denite.vim | 125 ---------------------------------------------- modules/fzf.vim | 63 +++++++++++++++++++++++ modules/plugins.vim | 19 ++----- modules/relativenums.vim | 1 + modules/test.vim | 19 ------- modules/vim-which-key.vim | 5 +- 9 files changed, 75 insertions(+), 165 deletions(-) delete mode 100644 modules/ctrlp.vim delete mode 100644 modules/denite.vim create mode 100644 modules/fzf.vim delete mode 100644 modules/test.vim diff --git a/coc-settings.json b/coc-settings.json index 9c75a4b1..da3e97d3 100644 --- a/coc-settings.json +++ b/coc-settings.json @@ -1,3 +1,3 @@ { - "coc.preferences.formatOnSaveFiletypes": ["css", "markdown", "javascript"] + "coc.preferences.formatOnSaveFiletypes": ["css", "markdown", "javascript", "graphql", "html", "yaml"] } diff --git a/init.vim b/init.vim index b959b125..b7fc2a98 100644 --- a/init.vim +++ b/init.vim @@ -2,7 +2,7 @@ source $HOME/.config/nvim/modules/pythonpath.vim " Eventually move to pyenv/virtualenv source $HOME/.config/nvim/modules/nodepath.vim " Make sure to set version here source $HOME/.config/nvim/modules/plugins.vim -"source $HOME/.config/nvim/modules/denite.vim +source $HOME/.config/nvim/modules/fzf.vim source $HOME/.config/nvim/modules/general.vim source $HOME/.config/nvim/modules/theme.vim source $HOME/.config/nvim/modules/airline.vim @@ -24,4 +24,4 @@ source $HOME/.config/nvim/modules/rainbow.vim source $HOME/.config/nvim/modules/vim-which-key.vim source $HOME/.config/nvim/modules/echodoc.vim " Special test file " -source $HOME/.config/nvim/modules/test.vim +"source $HOME/.config/nvim/modules/test.vim diff --git a/modules/ctrlp.vim b/modules/ctrlp.vim deleted file mode 100644 index 5d52cf01..00000000 --- a/modules/ctrlp.vim +++ /dev/null @@ -1,2 +0,0 @@ -let g:ctrlp_map = '' -let g:ctrlp_cmd = 'CtrlP' diff --git a/modules/denite.vim b/modules/denite.vim deleted file mode 100644 index 6b547f86..00000000 --- a/modules/denite.vim +++ /dev/null @@ -1,125 +0,0 @@ -" === Denite setup ===" -" Use ripgrep for searching current directory for files -" By default, ripgrep will respect rules in .gitignore -" --files: Print each file that would be searched (but don't search) -" --glob: Include or exclues files for searching that match the given glob -" (aka ignore .git files) -" -call denite#custom#var('file/rec', 'command', ['rg', '--files', '--glob', '!.git']) - -" Use ripgrep in place of "grep" -call denite#custom#var('grep', 'command', ['rg']) - -" Custom options for ripgrep -" --vimgrep: Show results with every match on it's own line -" --hidden: Search hidden directories and files -" --heading: Show the file name above clusters of matches from each file -" --S: Search case insensitively if the pattern is all lowercase -call denite#custom#var('grep', 'default_opts', ['--hidden', '--vimgrep', '--heading', '-S']) - -" Recommended defaults for ripgrep via Denite docs -call denite#custom#var('grep', 'recursive_opts', []) -call denite#custom#var('grep', 'pattern_opt', ['--regexp']) -call denite#custom#var('grep', 'separator', ['--']) -call denite#custom#var('grep', 'final_opts', []) - -" Remove date from buffer list -call denite#custom#var('buffer', 'date_format', '') - -" Custom options for Denite -" auto_resize - Auto resize the Denite window height automatically. -" prompt - Customize denite prompt -" direction - Specify Denite window direction as directly below current pane -" winminheight - Specify min height for Denite window -" highlight_mode_insert - Specify h1-CursorLine in insert mode -" prompt_highlight - Specify color of prompt -" highlight_matched_char - Matched characters highlight -" highlight_matched_range - matched range highlight -let s:denite_options = {'default' : { -\ 'split': 'floating', -\ 'start_filter': 1, -\ 'auto_resize': 1, -\ 'source_names': 'short', -\ 'prompt': 'λ ', -\ 'highlight_matched_char': 'QuickFixLine', -\ 'highlight_matched_range': 'Visual', -\ 'highlight_window_background': 'Visual', -\ 'highlight_filter_background': 'DiffAdd', -\ 'winrow': 1, -\ 'vertical_preview': 1 -\ }} - -" Loop through denite options and enable them -function! s:profile(opts) abort - for l:fname in keys(a:opts) - for l:dopt in keys(a:opts[l:fname]) - call denite#custom#option(l:fname, l:dopt, a:opts[l:fname][l:dopt]) - endfor - endfor -endfunction - -call s:profile(s:denite_options) - echo 'Denite not installed. It should work after running :PlugInstall' - -nmap ; :Denite buffer -nmap t :DeniteProjectDir file/rec -nnoremap g :Denite grep:. -no-empty -nnoremap j :DeniteCursorWord grep:. - -" Define mappings while in 'filter' mode -" - Switch to normal mode inside of search results -" - Exit denite window in any mode -" - Open currently selected file in any mode -" - Open currently selected file in a new tab -" - Open currently selected file a vertical split -" - Open currently selected file in a horizontal split -autocmd FileType denite-filter call s:denite_filter_my_settings() -function! s:denite_filter_my_settings() abort - imap - \ (denite_filter_quit) - inoremap - \ denite#do_map('quit') - nnoremap - \ denite#do_map('quit') - inoremap - \ denite#do_map('do_action') - inoremap - \ denite#do_map('do_action', 'tabopen') - inoremap - \ denite#do_map('do_action', 'vsplit') - inoremap - \ denite#do_map('do_action', 'split') -endfunction - -" Define mappings while in denite window -" - Opens currently selected file -" q or - Quit Denite window -" d - Delete currenly selected file -" p - Preview currently selected file -" or i - Switch to insert mode inside of filter prompt -" - Open currently selected file in a new tab -" - Open currently selected file a vertical split -" - Open currently selected file in a horizontal split -autocmd FileType denite call s:denite_my_settings() -function! s:denite_my_settings() abort - nnoremap - \ denite#do_map('do_action') - nnoremap q - \ denite#do_map('quit') - nnoremap - \ denite#do_map('quit') - nnoremap d - \ denite#do_map('do_action', 'delete') - nnoremap p - \ denite#do_map('do_action', 'preview') - nnoremap i - \ denite#do_map('open_filter_buffer') - nnoremap - \ denite#do_map('open_filter_buffer') - nnoremap - \ denite#do_map('do_action', 'tabopen') - nnoremap - \ denite#do_map('do_action', 'vsplit') - nnoremap - \ denite#do_map('do_action', 'split') -endfunction diff --git a/modules/fzf.vim b/modules/fzf.vim new file mode 100644 index 00000000..4466a32f --- /dev/null +++ b/modules/fzf.vim @@ -0,0 +1,63 @@ +" This is the default extra key bindings +let g:fzf_action = { + \ 'ctrl-t': 'tab split', + \ 'ctrl-x': 'split', + \ 'ctrl-v': 'vsplit' } + +" An action can be a reference to a function that processes selected lines +function! s:build_quickfix_list(lines) + call setqflist(map(copy(a:lines), '{ "filename": v:val }')) + copen + cc +endfunction + +let g:fzf_action = { + \ 'ctrl-q': function('s:build_quickfix_list'), + \ 'ctrl-t': 'tab split', + \ 'ctrl-x': 'split', + \ 'ctrl-v': 'vsplit' } + +" Default fzf layout +" - down / up / left / right +let g:fzf_layout = { 'down': '~40%' } + +" You can set up fzf window using a Vim command (Neovim or latest Vim 8 required) +let g:fzf_layout = { 'window': 'enew' } +let g:fzf_layout = { 'window': '-tabnew' } +let g:fzf_layout = { 'window': '10new' } + +" Customize fzf colors to match your color scheme +" - fzf#wrap translates this to a set of `--color` options +let g:fzf_colors = +\ { 'fg': ['fg', 'Normal'], + \ 'bg': ['bg', 'Normal'], + \ 'hl': ['fg', 'Comment'], + \ 'fg+': ['fg', 'CursorLine', 'CursorColumn', 'Normal'], + \ 'bg+': ['bg', 'CursorLine', 'CursorColumn'], + \ 'hl+': ['fg', 'Statement'], + \ 'info': ['fg', 'PreProc'], + \ 'border': ['fg', 'Ignore'], + \ 'prompt': ['fg', 'Conditional'], + \ 'pointer': ['fg', 'Exception'], + \ 'marker': ['fg', 'Keyword'], + \ 'spinner': ['fg', 'Label'], + \ 'header': ['fg', 'Comment'] } + +" Enable per-command history +" - History files will be stored in the specified directory +" - When set, CTRL-N and CTRL-P will be bound to 'next-history' and +" 'previous-history' instead of 'down' and 'up'. +"let g:fzf_history_dir = '~/.local/share/fzf-history' + +if has('nvim') && !exists('g:fzf_layout') + autocmd! FileType fzf + autocmd FileType fzf set laststatus=0 noshowmode noruler + \| autocmd BufLeave set laststatus=2 showmode ruler +endif + +if has("nvim") + au TermOpen * tnoremap + au FileType fzf tunmap +endif + +nnoremap :FZF diff --git a/modules/plugins.vim b/modules/plugins.vim index 2538b601..80388657 100644 --- a/modules/plugins.vim +++ b/modules/plugins.vim @@ -12,14 +12,15 @@ if dein#load_state('~/.config/nvim/dein') "call dein#add('kevinhwang91/rnvimr', {'do': 'make sync'}) call dein#add('francoiscabrol/ranger.vim') call dein#add('rbgrouleff/bclose.vim') + " Fuzzy finder + call dein#add('junegunn/fzf') " Language support call dein#add('neoclide/coc.nvim', {'merged':0, 'rev': 'release'}) " All the Themes call dein#add('joshdick/onedark.vim') + call dein#add('HerringtonDarkholme/yats.vim') " key menu popup " call dein#add('liuchengxu/vim-which-key') - "Interface" - call dein#add('Shougo/denite.nvim') " Neoterm call dein#add('kassio/neoterm') " Running tests in vim " @@ -47,19 +48,9 @@ if dein#load_state('~/.config/nvim/dein') call dein#add('majutsushi/tagbar') " Auto Pairs call dein#add('jiangmiao/auto-pairs') - " Buffergator use \b -"" call dein#add('jeetsukumaran/vim-buffergator') - " Ctrlp - "call dein#add('ctrlpvim/ctrlp.vim') + call dein#add('christoomey/vim-tmux-navigator') "Linting - call dein#add('w0rp/ale') - call dein#add('autozimu/LanguageClient-neovim', { - \ 'rev': 'next', - \ 'build': 'bash install.sh', - \ }) - " Fuzzy finder - "call dein#add('junegunn/fzf.vim', { 'dir': '~/.fzf', 'do': './install --all' }) - "call dein#add('junegunn/fzf') + "call dein#add('w0rp/ale') " Sneak mode " call dein#add('justinmk/vim-sneak') ""Git diff --git a/modules/relativenums.vim b/modules/relativenums.vim index 6451203f..106560e0 100644 --- a/modules/relativenums.vim +++ b/modules/relativenums.vim @@ -1,3 +1,4 @@ +set relativenumber function! NumberToggle() if(&relativenumber == 1) set number diff --git a/modules/test.vim b/modules/test.vim deleted file mode 100644 index bb9cb1ec..00000000 --- a/modules/test.vim +++ /dev/null @@ -1,19 +0,0 @@ -"Place for me to test things" - -let s:menus = {} -let s:menus.denite = { 'description': 'denite commands' } -let s:menus.denite.command_candidates = [ -\ ['> file_rec', 'Denite file_rec'], -\ ['> file_mru', 'Denite file_mru'], -\ ] - -call denite#custom#var('menu', 'menus', s:menus) - -function Command () - set wrap - set nobuflisted - :pedit ~/.config/nvim/commands/leadercommands.txt - -endfunction - -nmap :call SaveBackup() diff --git a/modules/vim-which-key.vim b/modules/vim-which-key.vim index 2e791a06..32fd033f 100644 --- a/modules/vim-which-key.vim +++ b/modules/vim-which-key.vim @@ -30,12 +30,13 @@ 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['e'] = [ 'NERDTreeToggle', 'file-explorer' ] let g:which_key_map['p'] = [ 'pclose','close-preview' ] let g:which_key_map['q'] = [ 'q','quit' ] let g:which_key_map['d'] = [ 'bd','delete-buffer' ] let g:which_key_map['s'] = [ 'w','save' ] -"let g:which_key_map['f'] = [ 'Denite file','files' ] -let g:which_key_map['f'] = [ 'Ranger','Ranger' ] +let g:which_key_map['r'] = [ 'Ranger','ranger' ] +let g:which_key_map['f'] = [ 'FZF','fzf' ] let g:which_key_map.t = { \ 'name' : '+toggle' , -- cgit v1.2.3