]> code.delx.au - dotfiles/blobdiff - .vim/macros.vim
vim: Don't stay in visual mode after indent
[dotfiles] / .vim / macros.vim
index 327eb81b219cfcfccffcf96f05e03052d095bb15..c84c515e05d0e78be914b55a77da18950ec45d69 100644 (file)
@@ -7,7 +7,7 @@ map <F10> :call WrapToggle()<CR>
 imap <F10> <C-o>:call WrapToggle()<CR>
 
 " Python Calculator
-command! -nargs=+ Calc :r! python -c "from math import *; print <args>"
+command -nargs=+ Calc :r! python -c "from math import *; print <args>"
 
 " Unhighlight search results and redraw the screen
 nmap <C-l> :nohlsearch<CR>:redraw!<CR>
@@ -33,28 +33,26 @@ nmap <Esc>[Z <C-w>W
 " Q to reformat paragraph. I never use ex mode anyway (default binding for Q)
 nmap Q gwip
 
-" Stay in visual after indenting
-vnoremap < <gv
-vnoremap > >gv
-
+" Save using sudo
+command SudoWrite call SudoWriteFunction()
 
 " I frequently type :Q or :WQ, etc instead of :q, :wq
-command! WQA :wqa
-command! WqA :wqa
-command! WQa :wqa
-command! Wqa :wqa
-command! WA :wa
-command! Wa :wa
-command! WQ :wq
-command! Wq :wq
-command! W :w
-command! Wn :wn
-command! WN :wn
-command! Wp :wp
-command! WP :wp
-command! QA :qa
-command! Qa :qa
-command! Q :q
+command WQA :wqa
+command WqA :wqa
+command WQa :wqa
+command Wqa :wqa
+command WA :wa
+command Wa :wa
+command WQ :wq
+command Wq :wq
+command W :w
+command Wn :wn
+command WN :wn
+command Wp :wp
+command WP :wp
+command QA :qa
+command Qa :qa
+command Q :q
 
 " Make the number pad work
 map \eOX =
@@ -160,3 +158,10 @@ function ToggleSpelling()
        endif
 endfunction
 
+
+" Save using sudo
+function SudoWriteFunction()
+       :w !sudo tee %
+       :e!
+endfunction
+