Skip to content

Commit c449f01

Browse files
committed
Configure all plugins
1 parent 523ab16 commit c449f01

23 files changed

+1024
-450
lines changed

config/plugins/fern.vim

Lines changed: 27 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,6 @@ nnoremap <Plug>(fern-close-drawer) :<C-u>FernDo close -drawer -stay<CR>
3434
highlight! FernCursorLine ctermbg=236 guibg=#323232
3535

3636
function! s:init_fern()
37-
autocmd BufEnter <buffer> highlight! link CursorLine FernCursorLine
38-
autocmd BufLeave <buffer> highlight! link CursorLine NONE
39-
4037
silent! nnoremap <buffer> f <Nop>
4138
silent! nnoremap <buffer> F <Nop>
4239
silent! nnoremap <buffer> t <Nop>
@@ -81,6 +78,11 @@ function! s:init_fern()
8178
nmap <buffer><silent> << <Plug>(fern-action-git-stage)
8279
nmap <buffer><silent> >> <Plug>(fern-action-git-unstage)
8380
81+
nmap <silent> <buffer> p <Plug>(fern-action-preview:toggle)
82+
nmap <silent> <buffer> <C-p> <Plug>(fern-action-preview:auto:toggle)
83+
nmap <silent> <buffer> <C-f> <Plug>(fern-action-preview:scroll:down:half)
84+
nmap <silent> <buffer> <C-b> <Plug>(fern-action-preview:scroll:up:half)
85+
8486
nmap <buffer><silent> ? <Plug>(fern-action-help)
8587
nmap <buffer><silent> ! <Plug>(fern-action-hidden)
8688
nmap <buffer><silent> I <Plug>(fern-action-hide-toggle)
@@ -147,30 +149,43 @@ endfunction
147149
augroup fern-custom
148150
autocmd! *
149151
autocmd FileType fern call s:init_fern()
152+
autocmd BufEnter <buffer> highlight! link CursorLine FernCursorLine
153+
autocmd BufLeave <buffer> highlight! link CursorLine NONE
154+
" autocmd DirChanged * ++nested execute printf('FernDo Fern\ %s\ -drawer\ -stay -drawer -stay', v:event.cwd)
150155
augroup END
151156

152157
function! s:get_selected_nodes(helper) abort
153158
let nodes = a:helper.sync.get_selected_nodes()
154159
return empty(nodes) ? [a:helper.sync.get_cursor_node()] : nodes
155160
endfunction
156161

157-
function! s:get_selected_paths(helper) abort
158-
let l:nodes = s:get_selected_nodes(a:helper)
159-
return map(l:nodes, {_, val ->
160-
\ val.status == g:fern#STATUS_NONE || val.status == g:fern#STATUS_COLLAPSED
161-
\ ? fnamemodify(val._path, ':h') : val._path})
162+
function! s:get_cursor_path(helper) abort
163+
let l:node = a:helper.sync.get_cursor_node()
164+
let l:path = l:node._path
165+
if index([g:fern#STATUS_NONE, g:fern#STATUS_COLLAPSED], l:node.status) >= 0
166+
let l:path = fnamemodify(l:path, ':h')
167+
endif
168+
return l:path
162169
endfunction
163170

164171
function! s:find(helper) abort
165-
let l:paths = s:get_selected_paths(a:helper)
172+
let l:path = s:get_cursor_path(a:helper)
166173
silent execute 'wincmd w'
167-
call denite#start([{'name': 'file/rec', 'args': l:paths}])
174+
if exists(':Telescope')
175+
execute 'Telescope find_files cwd=' . fnameescape(l:path)
176+
elseif exists(':Denite')
177+
call denite#start([{'name': 'file/rec', 'args': [l:path]}])
178+
endif
168179
endfunction
169180

170181
function! s:grep(helper) abort
171-
let l:paths = s:get_selected_paths(a:helper)
182+
let l:path = s:get_cursor_path(a:helper)
172183
silent execute 'wincmd w'
173-
call denite#start([{'name': 'grep', 'args': l:paths}])
184+
if exists(':Telescope')
185+
execute 'Telescope grep_string cwd=' . fnameescape(l:path)
186+
else
187+
call denite#start([{'name': 'grep', 'args': [l:path]}])
188+
endif
174189
endfunction
175190

176191
function! s:enter_project_root(helper) abort

config/plugins/gina.vim

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,3 +51,5 @@ let g:gina#command#blame#use_default_mappings = 0
5151
call gina#custom#mapping#nmap('blame', '<Return>', '<Plug>(gina-blame-open)')
5252
call gina#custom#mapping#nmap('blame', '<Backspace>', '<Plug>(gina-blame-back)')
5353
call gina#custom#mapping#nmap('blame', '<C-r>', '<Plug>(gina-blame-C-L)')
54+
55+
" vim: set ts=2 sw=2 tw=80 noet :

lua/plugins/auto-session.lua

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,16 @@
22
-- see: https://github.com/rmagatti/auto-session
33
-- rafi settings
44

5+
local HOME = vim.fn.expand('$HOME')
6+
57
local opts = {
6-
log_level = 'info',
8+
log_level = 'error',
79
auto_session_enable_last_session = false,
810
auto_session_root_dir = vim.fn.stdpath('data')..'/sessions/',
911
auto_session_enabled = true,
1012
auto_save_enabled = true,
1113
auto_restore_enabled = true,
12-
auto_session_suppress_dirs = {'/etc', vim.fn.expand('$HOME')}
14+
auto_session_suppress_dirs = {'/etc', '/tmp', HOME, HOME..'/code'}
1315
}
1416

1517
require('auto-session').setup(opts)

lua/plugins/bqf.lua

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
-- plugin: bqf
2+
-- see: https://github.com/kevinhwang91/nvim-bqf/
3+
-- rafi settings
4+
--
5+
require('bqf').setup({
6+
auto_resize_height = false,
7+
preview = { auto_preview = false },
8+
func_map = {
9+
tab = 'st',
10+
split = 'sv',
11+
vsplit = 'sg',
12+
ptoggleitem = 'p',
13+
},
14+
})

lua/plugins/colorizer.lua

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,17 @@
33
-- rafi settings
44

55
require 'colorizer'.setup {
6-
css = { rgb_fn = true; };
7-
scss = { rgb_fn = true; };
8-
sass = { rgb_fn = true; };
9-
stylus = { rgb_fn = true; };
10-
svelte = { rgb_fn = true; };
11-
vim = { names = false; };
12-
tmux = { names = false; };
13-
'javascript';
14-
'javascriptreact';
15-
'typescript';
16-
'typescriptreact';
17-
html = {
18-
mode = 'foreground';
19-
}
6+
html = { mode = 'foreground' },
7+
css = { rgb_fn = true },
8+
scss = { rgb_fn = true },
9+
sass = { rgb_fn = true },
10+
stylus = { rgb_fn = true },
11+
svelte = { rgb_fn = true },
12+
vim = { names = false },
13+
tmux = { names = false },
14+
'javascript',
15+
'javascriptreact',
16+
'typescript',
17+
'typescriptreact',
18+
'lua',
2019
}

lua/plugins/compe.lua

Lines changed: 22 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@
33
-- rafi settings
44

55
require'compe'.setup({
6-
enabled = true,
76
source = {
87
path = true,
9-
buffer = true,
10-
spell = true,
8+
buffer = {kind = '', true}, --,
9+
-- spell = true,
1110
nvim_lsp = true,
1211
nvim_lua = true,
13-
vsnip = true,
12+
vsnip = {kind = '*'}, --
13+
orgmode = true,
1414
-- tmux = true,
1515
-- tmux = { all_panes = true }
1616
},
@@ -29,13 +29,19 @@ local check_back_space = function()
2929
end
3030
end
3131

32+
local npairs = require('nvim-autopairs')
33+
3234
_G.confirm_completion = function()
3335
if vim.fn.pumvisible() == 0 then
34-
return t '<Plug>delimitMateCR'
36+
return npairs.autopairs_cr()
37+
-- return t '<Plug>delimitMateCR'
3538
elseif vim.fn.complete_info()['selected'] ~= -1 then
36-
return vim.fn['compe#confirm']({ keys = t '<Plug>delimitMateCR', mode = '' })
39+
return vim.fn['compe#confirm'](npairs.esc('<cr>'))
40+
-- elseif vim.fn.complete_info()['selected'] ~= -1 then
41+
-- return vim.fn['compe#confirm']({ keys = t '<Plug>delimitMateCR', mode = '' })
3742
else
38-
return t '<C-e><Plug>delimitMateCR'
43+
return npairs.esc('<cr>')
44+
-- return t '<C-e><Plug>delimitMateCR'
3945
end
4046
end
4147

@@ -63,16 +69,17 @@ _G.s_tab_complete = function()
6369
end
6470
end
6571

66-
vim.api.nvim_set_keymap("i", "<Tab>", "v:lua.tab_complete()", {expr = true})
67-
vim.api.nvim_set_keymap("s", "<Tab>", "v:lua.tab_complete()", {expr = true})
68-
vim.api.nvim_set_keymap("i", "<S-Tab>", "v:lua.s_tab_complete()", {expr = true})
69-
vim.api.nvim_set_keymap("s", "<S-Tab>", "v:lua.s_tab_complete()", {expr = true})
72+
local remap = vim.api.nvim_set_keymap
73+
remap("i", "<Tab>", "v:lua.tab_complete()", {expr = true})
74+
remap("s", "<Tab>", "v:lua.tab_complete()", {expr = true})
75+
remap("i", "<S-Tab>", "v:lua.s_tab_complete()", {expr = true})
76+
remap("s", "<S-Tab>", "v:lua.s_tab_complete()", {expr = true})
7077

71-
vim.api.nvim_set_keymap("i", "<CR>", "v:lua.confirm_completion()", {expr = true})
78+
remap("i", "<CR>", "v:lua.confirm_completion()", {expr = true, noremap=true})
7279

7380
local args = {expr = true, noremap = true, silent = true}
74-
vim.api.nvim_set_keymap("i", "<C-e>", "compe#close('<C-e>')", args)
75-
vim.api.nvim_set_keymap("i", "<C-u>", "compe#scroll({'delta': 4})", args)
76-
vim.api.nvim_set_keymap("i", "<C-d>", "compe#scroll({'delta': -4})", args)
81+
remap("i", "<C-e>", "compe#close('<C-e>')", args)
82+
remap("i", "<C-u>", "compe#scroll({'delta': 4})", args)
83+
remap("i", "<C-d>", "compe#scroll({'delta': -4})", args)
7784

7885
-- vim: set ts=2 sw=2 tw=80 et :

0 commit comments

Comments
 (0)