[vim] -powerline, -selecta, +nvim

pull/28/head
Alpha Chen 7 years ago
parent 1378002c34
commit b821f5f2ab

@ -25,6 +25,7 @@ set wildmode=list:longest,full
set background=dark set background=dark
let g:solarized_termcolors=256 let g:solarized_termcolors=256
colorscheme solarized colorscheme solarized
set background=dark
fun! s:highlight() fun! s:highlight()
highlight Normal ctermbg=235 highlight Normal ctermbg=235
@ -57,8 +58,11 @@ augroup END
""" Editing """ Editing
" set hidden " set hidden
if !has("nvim")
set noesckeys set noesckeys
endif
set virtualedit=block set virtualedit=block
set noshowmode
function! RestoreCursor() function! RestoreCursor()
if line("'\"") <= line("$") if line("'\"") <= line("$")
@ -93,7 +97,9 @@ end
set guicursor+=a:blinkon0 " disable blinking set guicursor+=a:blinkon0 " disable blinking
set guifont=Source\ Code\ Pro\ for\ Powerline:h13 set guifont=Source\ Code\ Pro\ for\ Powerline:h13
set guioptions-=T set guioptions-=T
if !has("nvim")
set macmeta set macmeta
endif
set mousehide set mousehide
""" Persistence """ Persistence
@ -126,11 +132,6 @@ map # <Plug>(incsearch-nohl-#)
map g* <Plug>(incsearch-nohl-g*) map g* <Plug>(incsearch-nohl-g*)
map g# <Plug>(incsearch-nohl-g#) map g# <Plug>(incsearch-nohl-g#)
" Powerline
python from powerline.vim import setup as powerline_setup
python powerline_setup()
python del powerline_setup
" ripgrep " ripgrep
if executable('rg') if executable('rg')
set grepprg=rg\ --no-heading\ --vimgrep set grepprg=rg\ --no-heading\ --vimgrep
@ -140,23 +141,30 @@ endif
" projectionist " projectionist
nnoremap <leader>a :A<cr> nnoremap <leader>a :A<cr>
""" Selecta " dispatch
nnoremap <leader>d :Dispatch<cr>
" Run a given vim command on the results of fuzzy selecting from a given shell
" command. See usage below. " lightline
function! SelectaCommand(choice_command, selecta_args, vim_command) let g:lightline = {
try \ 'component': {
let selection = system(a:choice_command . " | selecta " . a:selecta_args) \ 'lineinfo': ' %3l:%-2v',
catch /Vim:Interrupt/ \ },
" Swallow the ^C so that the redraw below happens; otherwise there will be \ 'component_function': {
" leftovers from selecta on the screen \ 'readonly': 'LightlineReadonly',
redraw! \ 'fugitive': 'LightlineFugitive'
return \ },
endtry \ 'separator': { 'left': '', 'right': '' },
redraw! \ 'subseparator': { 'left': '', 'right': '' }
exec a:vim_command . " " . selection \ }
function! LightlineReadonly()
return &readonly ? '' : ''
endfunction endfunction
" Find all files in all non-dot directories starting in the working directory. function! LightlineFugitive()
" Fuzzy select one of those. Open the selected file with :e. if exists('*fugitive#head')
nnoremap <leader>f :call SelectaCommand("find * -type f", "", ":e")<cr> let branch = fugitive#head()
return branch !=# '' ? ''.branch : ''
endif
return ''
endfunction

Loading…
Cancel
Save