Skip to content

Commit

Permalink
(vim) Write better session funcs; Replace ctrl-space
Browse files Browse the repository at this point in the history
Add CommandT (still working on it, wincent/command-t#354)
Fix ag support
Add recursivity to `path` for better `:find` et al.
  • Loading branch information
parmort committed May 5, 2019
1 parent 512254c commit 997c702
Show file tree
Hide file tree
Showing 4 changed files with 57 additions and 16 deletions.
27 changes: 27 additions & 0 deletions vim/.vim/autoload/custom/mks.vim
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
" mks.vim: A wrapper around the :mksession command
" Maintainer: Nolan Prochnau <parvus.mortalis@gmail.com>

let s:ses_path = "$HOME/.vim/sessions/"
if exists("g:ses_path")
let s:ses_path = g:ses_path
endif

function! custom#mks#mkses(ses_title)
execute "mksession " . s:ses_path . a:ses_title
endfunction

function! custom#mks#rmses(ses_title)
execute "silent" "!rm " . s:ses_path . a:ses_title

if v:shell_error
echo "Could not delete file: " . a:ses_title
endif
endfunction

function! custom#mks#ldses(ses_title)
execute "source " . s:ses_path . a:ses_title
endfunction

function! custom#mks#complete(A,L,P)
return systemlist("ls ".s:ses_path)
endfunction
4 changes: 2 additions & 2 deletions vim/.vim/plugin/ag.vim
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ endif

command! -nargs=+ -complete=file -bar Ag silent! grep! <args>|cwindow|redraw!

set grepprg=ag\ --nogroup\ --nocolor
set grepprg=ag\ --nogroup\ --nocolor\ --hidden
let g:CtrlSpaceGlobCommand = 'ag -l --nocolor -g ""'

nnoremap U :grep! --hidden "\b<C-r><C-w>\b"<CR>:cw<CR>
nnoremap U :grep! "\b<C-r><C-w>\b"<CR>:cw<CR>
7 changes: 0 additions & 7 deletions vim/.vim/plugin/statusline.vim

This file was deleted.

35 changes: 28 additions & 7 deletions vim/.vimrc
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ endif
" Vim-Plug -------------------------------------------------------- {{{
call plug#begin('~/.vim/plugged')
Plug 'christoomey/vim-tmux-navigator'
Plug 'vim-ctrlspace/vim-ctrlspace'
Plug 'jiangmiao/auto-pairs'
Plug 'ledger/vim-ledger', { 'for': 'ledger' }
Plug 'mxw/vim-jsx'
Expand All @@ -41,6 +40,9 @@ call plug#begin('~/.vim/plugged')
Plug 'vimoutliner/vimoutliner', { 'for': 'votl' }
Plug 'vim-scripts/ZoomWin'
Plug 'w0rp/ale'
Plug 'wincent/command-t', {
\ 'do': 'cd ruby/command-t/ext/command-t && ruby extconf.rb && make'
\ }

" Colorscheme
Plug 'nanotech/jellybeans.vim'
Expand All @@ -67,6 +69,10 @@ set clipboard=unnamedplus " Make vim use the C-c clipboard
set scrolloff=3 " Set scrolloff
setglobal spelllang=en_us " Spellchecking

" File Searching {{{{
set path+=**
set wildmenu
" }}}}
" Belloff {{{{
if exists('&belloff')
set belloff=all " Turn off all error sounds
Expand Down Expand Up @@ -150,6 +156,13 @@ hi TabLineFill guibg=#333333
set noshowmode
set laststatus=2
set showtabline=2
hi User1 guifg=#EBCB8B guibg=#333333
hi User2 guifg=#bf5858 guibg=#333333
hi User3 guifg=#ab8e38 guibg=#333333
set statusline=
\%1*%{custom#statusline#mode()}\ %*%{custom#statusline#name()}\ \ %{custom#statusline#git()}%{custom#statusline#mod()}
\%=%{custom#statusline#type()}\ [%2*%{custom#statusline#err()}%*,\ %3*%{custom#statusline#warn()}%*]\
\ [U+%0004.B]\ [%4.l/%Lℓ,\ %3.p%%]
" }}}}
" Deoplete {{{{
let g:deoplete#enable_at_startup = 1
Expand All @@ -172,6 +185,10 @@ command! FocusLine cal custom#misc#focusline()
" Reload configuration without losing filetype specific stuff
command! -bar SourceConf cal custom#misc#sourceConf()

command! -nargs=1 -bar Mksession cal custom#mks#mkses("<args>")
command! -nargs=1 -bar -complete=customlist,custom#mks#complete Rmsession cal custom#mks#rmses("<args>")
command! -nargs=1 -bar -complete=customlist,custom#mks#complete Ldsession cal custom#mks#ldses("<args>")

" }}}
" Mappings -------------------------------------------------------- {{{

Expand Down Expand Up @@ -253,22 +270,26 @@ xmap [ee <plug>unimpairedMoveSelectionUp
nmap ]ee <plug>unimpairedMoveDown
xmap ]ee <plug>unimpairedMoveSelectionDown
nnoremap ]ev :e ~/.vimrc<CR>
nnoremap [ev :tabnew ~/.vimrc<CR>
nnoremap [ev :e ~/.vimrc<CR>
nnoremap ]ev :tabnew ~/.vimrc<CR>
nnoremap ]ea :e ~/.vim/autoload<CR>
nnoremap [ea :tabnew ~/.vim/autoload<CR>
nnoremap [ea :e ~/.vim/autoload<CR>
nnoremap ]ea :tabnew ~/.vim/autoload<CR>
nnoremap [ad :ALEDetail<CR>
onoremap <silent> ic :norm! v<CR>
nnoremap <silent> <C-p> :CtrlSpace O<CR>
tnoremap <ESC> <C-\><C-n>
if has('nvim')
tnoremap <ESC> <C-\><C-n>
endif

nnoremap ga :A<CR>
nnoremap gr :R<CR>
nnoremap <leader>h :CommandTHelp<CR>
" }}}
" Abbrevs --------------------------------------------------------- {{{

Expand All @@ -287,7 +308,7 @@ cnoreabbrev snipe UltiSnipsEdit
cnoreabbrev vs SourceConf

" Shebang
inoreabbrev <expr> #!! "#!/usr/bin/env" . (empty(&filetype) ? '' : ' '.&filetype)
inoreabbrev <expr> #!! "#!/usr/bin/" . (empty(&filetype) ? 'bash' : 'env '.&filetype)

" }}}
" Macros ----------------------------------------------------------- {{{
Expand Down

0 comments on commit 997c702

Please sign in to comment.