This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" toggle colorcolumn | |
" at cursor (mnemonic: indicate cursor) | |
nnoremap <leader>ic :exe 'set cc'.(&cc =~ virtcol('.')?'-=':'+=').virtcol('.')<cr> | |
" at start of line (mnemonic: indicate indent) | |
nnoremap <leader>ii :exe "normal m`^\<leader>ic``"<cr> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" Echo Bash Alias beneath cursor | |
" Barry Arthur, July 2015 | |
let aliases = {} | |
for a in split(system('/bin/bash -ic alias'), '\n') | |
let [k,v] = matchlist(a, 'alias \(\S\+\)=\(.*\)')[1:2] | |
call extend(aliases, {k : v}) | |
endfor | |
function! EchoAlias() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" poor man's make | |
" Barry Arthur, July 2015 | |
function! MK() | |
cclose | |
write | |
let res = system('gcc -std=c++11 ' . shellescape(expand("%"))) | |
if ! v:shell_error | |
exe "! ./a.out" | |
else |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" Barry Arthur, June 2015 | |
" The start of a Hex editor in Vim | |
function! HexInit() | |
let lines = getline(1, '$') | |
let s:idx = [] | |
let s:hex = [] | |
let s:asc = [] | |
for l in lines | |
call add(s:idx, strpart(l, 0, 8)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" Barry Arthur, June 2015 | |
" Auto manage Begin/End blocks in log file | |
" Manual function to create new block | |
function! SpasmLogAuto() | |
if ! exists('b:spasm') | |
let b:spasm = 1 | |
$ | |
let now = strftime('%c') | |
let last_entry = search('^\(Begin\)\|^\(End\)', 'bcpW') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" Barry Arthur, June 2015 | |
" Don't store empty lines in implicit numbered registers. | |
let s:reg_9 = '' | |
function! FilterBlankReg1() | |
let regs = map(range(9), "getreg(v:val+1)") | |
if regs[0] == "\n" | |
for reg in range(8) | |
call setreg(reg+1, getreg(reg+2)) | |
endfor |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" Barry Arthur May 2015 | |
" Plot Vim's startup time data | |
" | |
" Install in ~/.vim/plugin/ | |
" | |
" Usage: | |
" vim --startuptime foo +q | |
" vim -c "Startuptime foo" +q | |
function! Startuptime(file) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" Barry Arthur May 2015 | |
function! VisualWrap(front, back) | |
exe "'<s/\\%V/" . a:front | |
exe "'>s/\\%V.*\\%V.\\zs/" . a:back | |
exe "'>s/\\ze\\n/" . a:back | |
endfunction | |
vnoremap <leader>x :<c-u>call VisualWrap('front', 'back')<cr> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
yeah | |
I keep meaning to learn viml | |
but it's awful | |
I don't really grok python (ruby is my thing) but it might be | |
more useful for me | |
but the vast majority of plugins are viml, so it doesn't really | |
help you to fix bugs in them or extend them | |
I was hoping timl would get developed some more, but seems not to be | |
yeah |