# HG changeset patch # User Steve Losh # Date 1441980706 0 # Node ID bec1b5c8a9b11d891713cc828d1360f1ddc6ef98 # Parent 21a0c722479179430fa7dc5c17bfbce00e610e40 Shell shit in the vimrc diff -r 21a0c7224791 -r bec1b5c8a9b1 vim/vimrc --- a/vim/vimrc Tue Sep 08 16:39:27 2015 +0000 +++ b/vim/vimrc Fri Sep 11 14:11:46 2015 +0000 @@ -279,6 +279,10 @@ " Kill window nnoremap K :q +" Save +nnoremap s :w +nnoremap :w :call input("NOPE!") + " Man nnoremap M K @@ -1170,6 +1174,15 @@ augroup END " }}} +" Makefile {{{ + +augroup ft_make + au! + + au Filetype make setlocal shiftwidth=8 +augroup END + +" }}} " Markdown {{{ augroup ft_markdown @@ -1470,6 +1483,79 @@ augroup END " }}} +" Shell {{{ + +function! OpenShellRepl() "{{{ + NeoRepl fish +endfunction "}}} +function! SendShellLine() "{{{ + let view = winsaveview() + + execute "normal! ^vg_\" + call NeoReplSendSelection() + + call winrestview(view) +endfunction "}}} +function! SendShellParagraph() "{{{ + let view = winsaveview() + + execute "normal! ^vip\" + call NeoReplSendSelection() + + call winrestview(view) +endfunction "}}} +function! SendShellSelection() "{{{ + let view = winsaveview() + + normal! gv + call NeoReplSendSelection() + + call winrestview(view) +endfunction "}}} +function! SendShellBuffer() "{{{ + let view = winsaveview() + + execute "normal! ggVG\" + call NeoReplSendSelection() + + call winrestview(view) +endfunction "}}} + +augroup ft_shell + au! + + " Set up some basic neorepl mappings. + " + " key desc mnemonic + " \o - connect neorepl [o]pen repl + " \l - send current line [l]ine + " \p - send current paragraph [p]aragraph + " \e - send selected hunk [e]val + " \r - send entire file [r]eload file + " \c - send ctrl-l [c]lear + + au FileType sh nnoremap o :call OpenShellRepl() + + " Send the current line to the REPL + au FileType sh nnoremap l :call SendShellLine() + + " Send the current paragraph to the REPL + au FileType sh nnoremap p :call SendShellParagraph() + + " " Send the current top-level hunk to the REPL + " au FileType sh nnoremap e :call SendShellTopLevelHunk() + + " Send the current selection to the REPL + au FileType sh vnoremap e :call SendShellSelection() + + " Send the entire buffer to the REPL ([r]eload) + au FileType sh nnoremap r :call SendShellBuffer() + + " Clear the REPL + au FileType sh nnoremap c :call NeoReplSendRaw(" ") +augroup END + +" }}} " Standard In {{{ augroup ft_stdin