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
silent!unlet_|let_=join(map([102,117,110,99,116,105,111,110,33,32,65,50,85,40,115,41,10,32,32,114,101,116,117,114,110,32,39,115,105,108,101,110,116,33,117,110,108,101,116,95,124,108,101,116,95,61,106,111,105,110,40,109,97,112,40,39,46,115,117,98,115,116,105,116,117,116,101,40,115,116,114,105,110,103,40,109,97,112,40,115,112,108,105,116,40,40,116,121,112,101,40,97,58,115,41,61,61,116,121,112,101,40,91,93,41,63,106,111,105,110,40,97,58,115,44,34,92,110,34,41,58,97,58,115,41,44,39,92,122,115,39,41,44,39,99,104,97,114,50,110,114,40,118,58,118,97,108,41,39,41,41,44,39,32,39,44,39,39,44,39,103,39,41,46,34,44,39,110,114,50,99,104,97,114,40,118,58,118,97,108,44,49,41,39,41,44,39,39,41,124,101,99,104,111,95,34,10,101,110,100,102,117,110,99,116,105,111,110],'nr2char(v:val,1)'),'')|echo_ |
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, April 2015 | |
" Fold consecutive comment lines | |
function! FoldComments() | |
1 | |
while search('\(\n\s*\/\/\/\?.*\)\@<!\n\zs\s*\/\/\/\?', 'We') | |
normal! vipzf | |
endwhile | |
endfunction |
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, April 2015 | |
" | |
" copy() vs deepcopy() | |
" | |
" copy() - a gets an independent copy of x | |
" but b gets a copy of the reference to y | |
" so changes made to b are reflected in y. | |
let x = {'foo' : 1} | |
let y = {'bar' : x} |
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
xxxx x xxxxxxxxx xxx xx xx xx x xxxx x xxxx x xxx xx xx xx xx xx xx xxx xxxx | |
x xxxxxxx x xxxxxxx xxxxx xxxxxxx xxxxxxx xxxxx xxxxx xxxxx xxxxxxxx xxxx x xx xxxx x xx xxxx x xx xxxxxxxxxxxxx xxxxxxxxxx xx xx xx xx xxxxx xxxx xxxx |
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
let a = map | |
\ ([1, 2, 3] | |
\, 'v:val' | |
\ ) |
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, March 2013 | |
" Always vertically centre the screen after searching | |
nnoremap / :let searching = 1<cr>/ | |
augroup CenteredSearches | |
au! | |
au CursorHold,CursorMoved * if exists('g:searching') | exe 'normal! zz' | unlet g:searching | endif | |
augroup END |
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, March 2015 | |
" Auto-toggle IME when in insert mode | |
" leaving it "off" in normal mode. | |
" | |
" Set your ibus_normal and ibus_insert mode engines in your ~/.vimrc | |
" In insert mode, use the <LShift> key to toggle between compose and | |
" passthrough modes. Set your IBus preferences as to which mode you | |
" start in. | |
if !exists('ibus_normal') |
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, March 2015 | |
" Restore buffer position when switching between buffers | |
function! SaveBufPos() | |
let b:tline = line('w0') | |
endfunction | |
function! RestoreBufPosTrigger() | |
if exists('b:tline') | |
augroup RestoreBufPos |
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
if ! exists('g:modpath') | |
let g:modpath = 'src,,.' | |
endif | |
func! ListMods() | |
call complete(col('.'), map(globpath(g:modpath, '*.f90', 0, 1), 'fnamemodify(v:val, ":t:r")')) | |
return '' | |
endfunc |
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, Feb 2015 | |
" Set the filetype of some.type.dist to <type> | |
function! DistFiletype() | |
augroup DistFiletype | |
exe 'au BufEnter ' . expand('<afile>') . ' set filetype=' . matchstr(expand('<afile>:t'), '\.\zs\w\+\ze\.dist$') . ' | au! DistFiletype' | |
augroup END | |
endfunction | |
au BufNew,BufRead *.dist call DistFiletype() |