diff options
Diffstat (limited to '.vim/plugin')
| -rw-r--r-- | .vim/plugin/fuzz.vim | 16 | ||||
| -rw-r--r-- | .vim/plugin/hard.vim | 65 | ||||
| -rw-r--r-- | .vim/plugin/line.vim | 159 | ||||
| -rw-r--r-- | .vim/plugin/split_term.vim | 11 |
4 files changed, 251 insertions, 0 deletions
diff --git a/.vim/plugin/fuzz.vim b/.vim/plugin/fuzz.vim new file mode 100644 index 0000000..0e1cb55 --- /dev/null +++ b/.vim/plugin/fuzz.vim @@ -0,0 +1,16 @@ +" skip this, we have vim-clap now!!! +finish + +if exists('g:loaded_fuzz') + finish +endif +let g:loaded_fuzz = 1 +let g:fuzz_prompt = '❯' + +nmap <silent> ff :call fuzz#files()<CR> +nmap <silent> fb :call fuzz#buffers()<CR> +nmap <silent> fc :call fuzz#commands()<CR> +nmap <silent> fr :Rg<space> + +command! -nargs=* -complete=custom,fuzz#cmdoptions Fuzz :call fuzz#exec(<f-args>) +command! -nargs=* Rg :call fuzz#rg(<f-args>) diff --git a/.vim/plugin/hard.vim b/.vim/plugin/hard.vim new file mode 100644 index 0000000..07a346d --- /dev/null +++ b/.vim/plugin/hard.vim @@ -0,0 +1,65 @@ +" hardmode == not using arrow keys + +function! s:bail() + let l:msg = 'E0X: Use hjkl' + echohl ErrorMsg | echo l:msg | echohl None +endfunction + +function! s:enable_hardmode(bang) + if !a:bang + try + " map arrow keys to more useful actions + " https://coderoncode.com/posts/vim-is-the-perfect-ide + nmap r<up> :resize +2<CR> + nmap r<down> :resize -2<CR> + nmap r<left> :vertical resize +2<CR> + nmap r<right> :vertical resize +2<CR> + + nmap w<up> :wincmd k<CR> + nmap w<down> :wincmd j<CR> + nmap w<left> :wincmd h<CR> + nmap w<right> :wincmd l<CR> + + nmap wm<up> :wincmd K<CR> + nmap wm<down> :wincmd J<CR> + nmap wm<left> :wincmd H<CR> + nmap wm<right> :wincmd L<CR> + + " or bail on them altogether + nmap <up> :call <SID>bail()<CR> + nmap <down> :call <SID>bail()<CR> + nmap <left> :call <SID>bail()<CR> + nmap <right> :call <SID>bail()<CR> + + vmap <up> :call <SID>bail()<CR> + vmap <down> :call <SID>bail()<CR> + vmap <left> :call <SID>bail()<CR> + vmap <right> :call <SID>bail()<CR> + + imap <up> <esc>:call <SID>bail()<CR> + imap <down> <esc>:call <SID>bail()<CR> + imap <left> <esc>:call <SID>bail()<CR> + imap <right> <esc>:call <SID>bail()<CR> + catch + endtry + else + try + nunmap <up> + nunmap <down> + nunmap <left> + nunmap <right> + vunmap <up> + vunmap <down> + vunmap <left> + vunmap <right> + iunmap <up> + iunmap <down> + iunmap <left> + iunmap <right> + catch + endtry + endif +endfunction + +call s:enable_hardmode(0) +command! -bang Hardmode call s:enable_hardmode(<bang>0) diff --git a/.vim/plugin/line.vim b/.vim/plugin/line.vim new file mode 100644 index 0000000..66072c3 --- /dev/null +++ b/.vim/plugin/line.vim @@ -0,0 +1,159 @@ +let g:lightline = {} +let g:lightline.colorscheme = 'papercolor_dim' + +let g:lightline.enable = { 'statusline': 1, 'tabline': 1 } + +let g:lightline.mode_map = { +\ 'n' : 'N', +\ 'i' : 'I', +\ 'R' : 'R', +\ 'v' : 'V', +\ 'V' : 'V-LINE', +\ "\<C-v>": 'V-BLOCK', +\ 'c' : '>', +\ 's' : 'SELECT', +\ 'S' : 'S-LINE', +\ "\<C-s>": 'S-BLOCK', +\ 't': 'T', +\ } + +let g:lightline.active = { +\ 'left': [ +\ ['mode', 'paste'], +\ ['filename', 'vista'], +\ ['neomake', 'coc', 'ctags', 'obsession'], +\ ], +\ 'right': [ +\ ['filetype', 'fileencoding', 'fileformat'], +\ ['lineinfo', 'percent'], +\ ['tabstatus'], +\ ], +\ } + +set showtabline=2 +let g:lightline.tabline = { +\ 'right': [ +\ ['tabs'], +\ ['porcelain'], +\ ], +\ } + +let g:lightline.tab = { +\ 'active': ['tabnum'], +\ 'inactive': ['tabnum'], +\ } + +let g:lightline.component = { +\ 'lineinfo': ' %l:%v', +\ 'filetype': "%{winwidth(0) > 70 ? (strlen(&filetype) ? &filetype : 'no ft') : ''}", +\ 'dir': "%{substitute(expand('%:p:h'), $HOME, '~', '')}", +\ } + +let g:lightline.component_function = { +\ 'filename': 'LightLineFilename', +\ 'fileformat': 'LightLineFileformat', +\ 'fileencoding': 'LightLineFileencoding', +\ 'mode': 'LightLineMode', +\ 'vista': 'LightLineVista', +\ 'o': 'LightLineO', +\ 'porcelain': 'LightLinePorcelain', +\ } + +" \ 'separator': { 'left': "\ue0b8", 'right': "\ue0be" }, +" \ 'subseparator': { 'left': "\ue0b9", 'right': "\ue0b9" }, +" \ 'tabline_separator': { 'left': "\ue0bc", 'right': "\ue0ba" }, +" \ 'tabline_subseparator': { 'left': "\ue0bb", 'right': "\ue0bb" }, +" \ + +let g:lightline.component_expand = {} +let g:lightline.component_type = {} + + +" Modified {{{ +hi ModifiedColor ctermfg=196 guifg=#ff0000 gui=bold +function! LightLineModified() + return &modified ? '+' : &modifiable ? '' : '-' +endfunction +" }}} + +" Readonly {{{ +function! LightLineReadonly() + return &filetype !~? 'help\|vimfiler\|gundo' && &readonly ? '' : '' +endfunction +" }}} + +" Filename {{{ +function! LightLineFilename() + return ('' !=? LightLineReadonly() ? LightLineReadonly() . ' ' : '') . + \ (&filetype ==# 'vimfiler' ? vimfiler#get_status_string() : + \ &filetype ==# 'unite' ? unite#get_status_string() : + \ &filetype ==# 'vimshell' ? vimshell#get_status_string() : + \ '' !=? expand('%:t') ? expand('%:t') : '[No Name]') . + \ ('' !=? LightLineModified() ? ' ' . LightLineModified() : '') +endfunction +" }}} + +" Fileformat {{{ +function! LightLineFileformat() + if (&fileformat == 'unix') + return '' + endif + return winwidth(0) > 70 ? &fileformat : '' +endfunction +" }}} + +" Fileencoding {{{ +function! LightLineFileencoding() + if (&fileencoding == 'utf-8') + return '' + endif + return winwidth(0) > 70 ? (strlen(&fileencoding) ? &fileencoding : &encoding) : '' +endfunction +" }}} + +" Mode {{{ +function! LightLineMode() + return winwidth(0) > 60 ? ( + \ expand('%:t') ==# '__Tagbar__' ? 'Tagbar': + \ &filetype ==# 'vimfiler' ? 'VimFiler' : + \ &filetype ==# 'vimshell' ? 'VimShell' : + \ &filetype ==# 'dirvish' ? 'DIRVISH' : + \ lightline#mode() ) + \ : '' +endfunction +" }}} + +" Tabchar {{{ +function! LightLineTabchar() + return '[' + \ . &tabstop + \ . (&expandtab == 1 ? '->' : '<>') + \ . &shiftwidth + \ . ']' +endfunction +" }}} + +" Vista {{{ +function! LightLineVista() + let l:sym = get(b:, 'vista_nearest_method_or_function', '') + return empty(l:sym) ? '' : g:vista#renderer#icons.function . ' ' . l:sym +endfunction +" }}} + +" Porcelain {{{ +function! LightLinePorcelain() + if &buftype !=# 'terminal' + let gitinfo = system('porcelain -no-color -path=' . expand('%:h')) + return (v:shell_error ? '' : gitinfo) + endif +endfunction +" }}} + +function! LightLineO() + let l:circ_empty="\u25CB" + let l:circ_quart="\u25D4" + let l:circ_half="\u25D1" + let l:circ_threequart="\u25D5" + let l:circ_full="\u25CF" + return ('' != LightLineModified() ? l:circ_full : l:circ_empty) +endfunction diff --git a/.vim/plugin/split_term.vim b/.vim/plugin/split_term.vim new file mode 100644 index 0000000..efb9b86 --- /dev/null +++ b/.vim/plugin/split_term.vim @@ -0,0 +1,11 @@ +" SplitTerm: quickly pop out a terminal + +" skip this while were testing kassio/neoterm +finish + +" lua require('split_term') +" command! LuaTerm :lua spt_toggle()<CR> + +command! -bang -nargs=* SplitTerm call s:split_term_toggle(<bang>0, <f-args>) +cnoreabbrev spt SplitTerm +cnoreabbrev st SplitTerm |