From fe12003629a9a87105ded2da2bd83ab9d2f32777 Mon Sep 17 00:00:00 2001 From: Alexander Karle Date: Sun, 25 Nov 2018 23:04:35 -0500 Subject: [PATCH] vim: Minor improvements to commands and mappings 1. now pastes unformatted from clipboard (instead of toggling paste). I found myself only using paste-toggle to paste from clipboard, so here we are... 2. :GitGrep now opens the quickfix window after calling. Previously it was hard to tell when it was done --- vim/vimrc | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/vim/vimrc b/vim/vimrc index ad000d5..ed4c36b 100644 --- a/vim/vimrc +++ b/vim/vimrc @@ -188,6 +188,12 @@ function! s:InGitRepo() abort return 0 endfunction +function! SetPasteAndPasteFromClipboard() abort + set paste + normal! "*p + set nopaste +endfunction + function! s:warn(msg) abort echohl WarningMsg echo 'vimrc: ' . a:msg @@ -215,13 +221,11 @@ if has('terminal') || has('nvim') tnoremap endif -"Map ctrl-p to toggle paste mode -nnoremap :set paste! +" Paste from clipboard without any formatting issues +nnoremap :call SetPasteAndPasteFromClipboard() -" Elim Whitespace (through regexp) +" Clear trailing whitespace (through regexp) nnoremap :call CMDPreserve("%s/\\s\\+$//e") -" save session -" nnoremap s :mksession! " edit in current buffer dir nnoremap e :e %:h/ @@ -266,7 +270,7 @@ nnoremap y gg"*yG " }}} " COMMANDS {{{ -command! -nargs=1 GitGrep call GitGrep('') +command! -nargs=1 GitGrep call GitGrep('') | copen command! CD exe 'cd ' . expand('%:h') " }}} -- libgit2 0.28.4