Initial vim commit
This commit is contained in:
347
autoload/pathogen.vim
Normal file
347
autoload/pathogen.vim
Normal file
@@ -0,0 +1,347 @@
|
|||||||
|
" pathogen.vim - path option manipulation
|
||||||
|
" Maintainer: Tim Pope <http://tpo.pe/>
|
||||||
|
" Version: 2.3
|
||||||
|
|
||||||
|
" Install in ~/.vim/autoload (or ~\vimfiles\autoload).
|
||||||
|
"
|
||||||
|
" For management of individually installed plugins in ~/.vim/bundle (or
|
||||||
|
" ~\vimfiles\bundle), adding `execute pathogen#infect()` to the top of your
|
||||||
|
" .vimrc is the only other setup necessary.
|
||||||
|
"
|
||||||
|
" The API is documented inline below.
|
||||||
|
|
||||||
|
if exists("g:loaded_pathogen") || &cp
|
||||||
|
finish
|
||||||
|
endif
|
||||||
|
let g:loaded_pathogen = 1
|
||||||
|
|
||||||
|
" Point of entry for basic default usage. Give a relative path to invoke
|
||||||
|
" pathogen#interpose() (defaults to "bundle/{}"), or an absolute path to invoke
|
||||||
|
" pathogen#surround(). Curly braces are expanded with pathogen#expand():
|
||||||
|
" "bundle/{}" finds all subdirectories inside "bundle" inside all directories
|
||||||
|
" in the runtime path.
|
||||||
|
function! pathogen#infect(...) abort
|
||||||
|
for path in a:0 ? filter(reverse(copy(a:000)), 'type(v:val) == type("")') : ['bundle/{}']
|
||||||
|
if path =~# '^\%({\=[$~\\/]\|{\=\w:[\\/]\).*[{}*]'
|
||||||
|
call pathogen#surround(path)
|
||||||
|
elseif path =~# '^\%([$~\\/]\|\w:[\\/]\)'
|
||||||
|
call s:warn('Change pathogen#infect('.string(path).') to pathogen#infect('.string(path.'/{}').')')
|
||||||
|
call pathogen#surround(path . '/{}')
|
||||||
|
elseif path =~# '[{}*]'
|
||||||
|
call pathogen#interpose(path)
|
||||||
|
else
|
||||||
|
call s:warn('Change pathogen#infect('.string(path).') to pathogen#infect('.string(path.'/{}').')')
|
||||||
|
call pathogen#interpose(path . '/{}')
|
||||||
|
endif
|
||||||
|
endfor
|
||||||
|
call pathogen#cycle_filetype()
|
||||||
|
if pathogen#is_disabled($MYVIMRC)
|
||||||
|
return 'finish'
|
||||||
|
endif
|
||||||
|
return ''
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" Split a path into a list.
|
||||||
|
function! pathogen#split(path) abort
|
||||||
|
if type(a:path) == type([]) | return a:path | endif
|
||||||
|
if empty(a:path) | return [] | endif
|
||||||
|
let split = split(a:path,'\\\@<!\%(\\\\\)*\zs,')
|
||||||
|
return map(split,'substitute(v:val,''\\\([\\,]\)'',''\1'',"g")')
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" Convert a list to a path.
|
||||||
|
function! pathogen#join(...) abort
|
||||||
|
if type(a:1) == type(1) && a:1
|
||||||
|
let i = 1
|
||||||
|
let space = ' '
|
||||||
|
else
|
||||||
|
let i = 0
|
||||||
|
let space = ''
|
||||||
|
endif
|
||||||
|
let path = ""
|
||||||
|
while i < a:0
|
||||||
|
if type(a:000[i]) == type([])
|
||||||
|
let list = a:000[i]
|
||||||
|
let j = 0
|
||||||
|
while j < len(list)
|
||||||
|
let escaped = substitute(list[j],'[,'.space.']\|\\[\,'.space.']\@=','\\&','g')
|
||||||
|
let path .= ',' . escaped
|
||||||
|
let j += 1
|
||||||
|
endwhile
|
||||||
|
else
|
||||||
|
let path .= "," . a:000[i]
|
||||||
|
endif
|
||||||
|
let i += 1
|
||||||
|
endwhile
|
||||||
|
return substitute(path,'^,','','')
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" Convert a list to a path with escaped spaces for 'path', 'tag', etc.
|
||||||
|
function! pathogen#legacyjoin(...) abort
|
||||||
|
return call('pathogen#join',[1] + a:000)
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" Turn filetype detection off and back on again if it was already enabled.
|
||||||
|
function! pathogen#cycle_filetype() abort
|
||||||
|
if exists('g:did_load_filetypes')
|
||||||
|
filetype off
|
||||||
|
filetype on
|
||||||
|
endif
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" Check if a bundle is disabled. A bundle is considered disabled if its
|
||||||
|
" basename or full name is included in the list g:pathogen_disabled.
|
||||||
|
function! pathogen#is_disabled(path) abort
|
||||||
|
if a:path =~# '\~$'
|
||||||
|
return 1
|
||||||
|
endif
|
||||||
|
let sep = pathogen#slash()
|
||||||
|
let blacklist = map(
|
||||||
|
\ get(g:, 'pathogen_blacklist', get(g:, 'pathogen_disabled', [])) +
|
||||||
|
\ pathogen#split($VIMBLACKLIST),
|
||||||
|
\ 'substitute(v:val, "[\\/]$", "", "")')
|
||||||
|
return index(blacklist, fnamemodify(a:path, ':t')) != -1 || index(blacklist, a:path) != -1
|
||||||
|
endfunction "}}}1
|
||||||
|
|
||||||
|
" Prepend the given directory to the runtime path and append its corresponding
|
||||||
|
" after directory. Curly braces are expanded with pathogen#expand().
|
||||||
|
function! pathogen#surround(path) abort
|
||||||
|
let sep = pathogen#slash()
|
||||||
|
let rtp = pathogen#split(&rtp)
|
||||||
|
let path = fnamemodify(a:path, ':p:?[\\/]\=$??')
|
||||||
|
let before = filter(pathogen#expand(path), '!pathogen#is_disabled(v:val)')
|
||||||
|
let after = filter(reverse(pathogen#expand(path.sep.'after')), '!pathogen#is_disabled(v:val[0:-7])')
|
||||||
|
call filter(rtp, 'index(before + after, v:val) == -1')
|
||||||
|
let &rtp = pathogen#join(before, rtp, after)
|
||||||
|
return &rtp
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" For each directory in the runtime path, add a second entry with the given
|
||||||
|
" argument appended. Curly braces are expanded with pathogen#expand().
|
||||||
|
function! pathogen#interpose(name) abort
|
||||||
|
let sep = pathogen#slash()
|
||||||
|
let name = a:name
|
||||||
|
if has_key(s:done_bundles, name)
|
||||||
|
return ""
|
||||||
|
endif
|
||||||
|
let s:done_bundles[name] = 1
|
||||||
|
let list = []
|
||||||
|
for dir in pathogen#split(&rtp)
|
||||||
|
if dir =~# '\<after$'
|
||||||
|
let list += reverse(filter(pathogen#expand(dir[0:-6].name.sep.'after'), '!pathogen#is_disabled(v:val[0:-7])')) + [dir]
|
||||||
|
else
|
||||||
|
let list += [dir] + filter(pathogen#expand(dir.sep.name), '!pathogen#is_disabled(v:val)')
|
||||||
|
endif
|
||||||
|
endfor
|
||||||
|
let &rtp = pathogen#join(pathogen#uniq(list))
|
||||||
|
return 1
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
let s:done_bundles = {}
|
||||||
|
|
||||||
|
" Invoke :helptags on all non-$VIM doc directories in runtimepath.
|
||||||
|
function! pathogen#helptags() abort
|
||||||
|
let sep = pathogen#slash()
|
||||||
|
for glob in pathogen#split(&rtp)
|
||||||
|
for dir in map(split(glob(glob), "\n"), 'v:val.sep."/doc/".sep')
|
||||||
|
if (dir)[0 : strlen($VIMRUNTIME)] !=# $VIMRUNTIME.sep && filewritable(dir) == 2 && !empty(split(glob(dir.'*.txt'))) && (!filereadable(dir.'tags') || filewritable(dir.'tags'))
|
||||||
|
silent! execute 'helptags' pathogen#fnameescape(dir)
|
||||||
|
endif
|
||||||
|
endfor
|
||||||
|
endfor
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
command! -bar Helptags :call pathogen#helptags()
|
||||||
|
|
||||||
|
" Execute the given command. This is basically a backdoor for --remote-expr.
|
||||||
|
function! pathogen#execute(...) abort
|
||||||
|
for command in a:000
|
||||||
|
execute command
|
||||||
|
endfor
|
||||||
|
return ''
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" Section: Unofficial
|
||||||
|
|
||||||
|
function! pathogen#is_absolute(path) abort
|
||||||
|
return a:path =~# (has('win32') ? '^\%([\\/]\|\w:\)[\\/]\|^[~$]' : '^[/~$]')
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" Given a string, returns all possible permutations of comma delimited braced
|
||||||
|
" alternatives of that string. pathogen#expand('/{a,b}/{c,d}') yields
|
||||||
|
" ['/a/c', '/a/d', '/b/c', '/b/d']. Empty braces are treated as a wildcard
|
||||||
|
" and globbed. Actual globs are preserved.
|
||||||
|
function! pathogen#expand(pattern) abort
|
||||||
|
if a:pattern =~# '{[^{}]\+}'
|
||||||
|
let [pre, pat, post] = split(substitute(a:pattern, '\(.\{-\}\){\([^{}]\+\)}\(.*\)', "\\1\001\\2\001\\3", ''), "\001", 1)
|
||||||
|
let found = map(split(pat, ',', 1), 'pre.v:val.post')
|
||||||
|
let results = []
|
||||||
|
for pattern in found
|
||||||
|
call extend(results, pathogen#expand(pattern))
|
||||||
|
endfor
|
||||||
|
return results
|
||||||
|
elseif a:pattern =~# '{}'
|
||||||
|
let pat = matchstr(a:pattern, '^.*{}[^*]*\%($\|[\\/]\)')
|
||||||
|
let post = a:pattern[strlen(pat) : -1]
|
||||||
|
return map(split(glob(substitute(pat, '{}', '*', 'g')), "\n"), 'v:val.post')
|
||||||
|
else
|
||||||
|
return [a:pattern]
|
||||||
|
endif
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" \ on Windows unless shellslash is set, / everywhere else.
|
||||||
|
function! pathogen#slash() abort
|
||||||
|
return !exists("+shellslash") || &shellslash ? '/' : '\'
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! pathogen#separator() abort
|
||||||
|
return pathogen#slash()
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" Convenience wrapper around glob() which returns a list.
|
||||||
|
function! pathogen#glob(pattern) abort
|
||||||
|
let files = split(glob(a:pattern),"\n")
|
||||||
|
return map(files,'substitute(v:val,"[".pathogen#slash()."/]$","","")')
|
||||||
|
endfunction "}}}1
|
||||||
|
|
||||||
|
" Like pathogen#glob(), only limit the results to directories.
|
||||||
|
function! pathogen#glob_directories(pattern) abort
|
||||||
|
return filter(pathogen#glob(a:pattern),'isdirectory(v:val)')
|
||||||
|
endfunction "}}}1
|
||||||
|
|
||||||
|
" Remove duplicates from a list.
|
||||||
|
function! pathogen#uniq(list) abort
|
||||||
|
let i = 0
|
||||||
|
let seen = {}
|
||||||
|
while i < len(a:list)
|
||||||
|
if (a:list[i] ==# '' && exists('empty')) || has_key(seen,a:list[i])
|
||||||
|
call remove(a:list,i)
|
||||||
|
elseif a:list[i] ==# ''
|
||||||
|
let i += 1
|
||||||
|
let empty = 1
|
||||||
|
else
|
||||||
|
let seen[a:list[i]] = 1
|
||||||
|
let i += 1
|
||||||
|
endif
|
||||||
|
endwhile
|
||||||
|
return a:list
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" Backport of fnameescape().
|
||||||
|
function! pathogen#fnameescape(string) abort
|
||||||
|
if exists('*fnameescape')
|
||||||
|
return fnameescape(a:string)
|
||||||
|
elseif a:string ==# '-'
|
||||||
|
return '\-'
|
||||||
|
else
|
||||||
|
return substitute(escape(a:string," \t\n*?[{`$\\%#'\"|!<"),'^[+>]','\\&','')
|
||||||
|
endif
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" Like findfile(), but hardcoded to use the runtimepath.
|
||||||
|
function! pathogen#runtime_findfile(file,count) abort "{{{1
|
||||||
|
let rtp = pathogen#join(1,pathogen#split(&rtp))
|
||||||
|
let file = findfile(a:file,rtp,a:count)
|
||||||
|
if file ==# ''
|
||||||
|
return ''
|
||||||
|
else
|
||||||
|
return fnamemodify(file,':p')
|
||||||
|
endif
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" Section: Deprecated
|
||||||
|
|
||||||
|
function! s:warn(msg) abort
|
||||||
|
echohl WarningMsg
|
||||||
|
echomsg a:msg
|
||||||
|
echohl NONE
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" Prepend all subdirectories of path to the rtp, and append all 'after'
|
||||||
|
" directories in those subdirectories. Deprecated.
|
||||||
|
function! pathogen#runtime_prepend_subdirectories(path) abort
|
||||||
|
call s:warn('Change pathogen#runtime_prepend_subdirectories('.string(a:path).') to pathogen#infect('.string(a:path.'/{}').')')
|
||||||
|
return pathogen#surround(a:path . pathogen#slash() . '{}')
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! pathogen#incubate(...) abort
|
||||||
|
let name = a:0 ? a:1 : 'bundle/{}'
|
||||||
|
call s:warn('Change pathogen#incubate('.(a:0 ? string(a:1) : '').') to pathogen#infect('.string(name).')')
|
||||||
|
return pathogen#interpose(name)
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" Deprecated alias for pathogen#interpose().
|
||||||
|
function! pathogen#runtime_append_all_bundles(...) abort
|
||||||
|
if a:0
|
||||||
|
call s:warn('Change pathogen#runtime_append_all_bundles('.string(a:1).') to pathogen#infect('.string(a:1.'/{}').')')
|
||||||
|
else
|
||||||
|
call s:warn('Change pathogen#runtime_append_all_bundles() to pathogen#infect()')
|
||||||
|
endif
|
||||||
|
return pathogen#interpose(a:0 ? a:1 . '/{}' : 'bundle/{}')
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
if exists(':Vedit')
|
||||||
|
finish
|
||||||
|
endif
|
||||||
|
|
||||||
|
let s:vopen_warning = 0
|
||||||
|
|
||||||
|
function! s:find(count,cmd,file,lcd)
|
||||||
|
let rtp = pathogen#join(1,pathogen#split(&runtimepath))
|
||||||
|
let file = pathogen#runtime_findfile(a:file,a:count)
|
||||||
|
if file ==# ''
|
||||||
|
return "echoerr 'E345: Can''t find file \"".a:file."\" in runtimepath'"
|
||||||
|
endif
|
||||||
|
if !s:vopen_warning
|
||||||
|
let s:vopen_warning = 1
|
||||||
|
let warning = '|echohl WarningMsg|echo "Install scriptease.vim to continue using :V'.a:cmd.'"|echohl NONE'
|
||||||
|
else
|
||||||
|
let warning = ''
|
||||||
|
endif
|
||||||
|
if a:lcd
|
||||||
|
let path = file[0:-strlen(a:file)-2]
|
||||||
|
execute 'lcd `=path`'
|
||||||
|
return a:cmd.' '.pathogen#fnameescape(a:file) . warning
|
||||||
|
else
|
||||||
|
return a:cmd.' '.pathogen#fnameescape(file) . warning
|
||||||
|
endif
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! s:Findcomplete(A,L,P)
|
||||||
|
let sep = pathogen#slash()
|
||||||
|
let cheats = {
|
||||||
|
\'a': 'autoload',
|
||||||
|
\'d': 'doc',
|
||||||
|
\'f': 'ftplugin',
|
||||||
|
\'i': 'indent',
|
||||||
|
\'p': 'plugin',
|
||||||
|
\'s': 'syntax'}
|
||||||
|
if a:A =~# '^\w[\\/]' && has_key(cheats,a:A[0])
|
||||||
|
let request = cheats[a:A[0]].a:A[1:-1]
|
||||||
|
else
|
||||||
|
let request = a:A
|
||||||
|
endif
|
||||||
|
let pattern = substitute(request,'/\|\'.sep,'*'.sep,'g').'*'
|
||||||
|
let found = {}
|
||||||
|
for path in pathogen#split(&runtimepath)
|
||||||
|
let path = expand(path, ':p')
|
||||||
|
let matches = split(glob(path.sep.pattern),"\n")
|
||||||
|
call map(matches,'isdirectory(v:val) ? v:val.sep : v:val')
|
||||||
|
call map(matches,'expand(v:val, ":p")[strlen(path)+1:-1]')
|
||||||
|
for match in matches
|
||||||
|
let found[match] = 1
|
||||||
|
endfor
|
||||||
|
endfor
|
||||||
|
return sort(keys(found))
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
command! -bar -bang -range=1 -nargs=1 -complete=customlist,s:Findcomplete Ve :execute s:find(<count>,'edit<bang>',<q-args>,0)
|
||||||
|
command! -bar -bang -range=1 -nargs=1 -complete=customlist,s:Findcomplete Vedit :execute s:find(<count>,'edit<bang>',<q-args>,0)
|
||||||
|
command! -bar -bang -range=1 -nargs=1 -complete=customlist,s:Findcomplete Vopen :execute s:find(<count>,'edit<bang>',<q-args>,1)
|
||||||
|
command! -bar -bang -range=1 -nargs=1 -complete=customlist,s:Findcomplete Vsplit :execute s:find(<count>,'split',<q-args>,<bang>1)
|
||||||
|
command! -bar -bang -range=1 -nargs=1 -complete=customlist,s:Findcomplete Vvsplit :execute s:find(<count>,'vsplit',<q-args>,<bang>1)
|
||||||
|
command! -bar -bang -range=1 -nargs=1 -complete=customlist,s:Findcomplete Vtabedit :execute s:find(<count>,'tabedit',<q-args>,<bang>1)
|
||||||
|
command! -bar -bang -range=1 -nargs=1 -complete=customlist,s:Findcomplete Vpedit :execute s:find(<count>,'pedit',<q-args>,<bang>1)
|
||||||
|
command! -bar -bang -range=1 -nargs=1 -complete=customlist,s:Findcomplete Vread :execute s:find(<count>,'read',<q-args>,<bang>1)
|
||||||
|
|
||||||
|
" vim:set et sw=2 foldmethod=expr foldexpr=getline(v\:lnum)=~'^\"\ Section\:'?'>1'\:getline(v\:lnum)=~#'^fu'?'a1'\:getline(v\:lnum)=~#'^endf'?'s1'\:'=':
|
||||||
276
colors/molokai.vim
Normal file
276
colors/molokai.vim
Normal file
@@ -0,0 +1,276 @@
|
|||||||
|
" Vim color file
|
||||||
|
"
|
||||||
|
" Author: Tomas Restrepo <tomas@winterdom.com>
|
||||||
|
" https://github.com/tomasr/molokai
|
||||||
|
"
|
||||||
|
" Note: Based on the Monokai theme for TextMate
|
||||||
|
" by Wimer Hazenberg and its darker variant
|
||||||
|
" by Hamish Stuart Macpherson
|
||||||
|
"
|
||||||
|
|
||||||
|
hi clear
|
||||||
|
|
||||||
|
if version > 580
|
||||||
|
" no guarantees for version 5.8 and below, but this makes it stop
|
||||||
|
" complaining
|
||||||
|
hi clear
|
||||||
|
if exists("syntax_on")
|
||||||
|
syntax reset
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
let g:colors_name="molokai"
|
||||||
|
|
||||||
|
if exists("g:molokai_original")
|
||||||
|
let s:molokai_original = g:molokai_original
|
||||||
|
else
|
||||||
|
let s:molokai_original = 0
|
||||||
|
endif
|
||||||
|
|
||||||
|
|
||||||
|
hi Boolean guifg=#AE81FF
|
||||||
|
hi Character guifg=#E6DB74
|
||||||
|
hi Number guifg=#AE81FF
|
||||||
|
hi String guifg=#E6DB74
|
||||||
|
hi Conditional guifg=#F92672 gui=bold
|
||||||
|
hi Constant guifg=#AE81FF gui=bold
|
||||||
|
hi Cursor guifg=#000000 guibg=#F8F8F0
|
||||||
|
hi iCursor guifg=#000000 guibg=#F8F8F0
|
||||||
|
hi Debug guifg=#BCA3A3 gui=bold
|
||||||
|
hi Define guifg=#66D9EF
|
||||||
|
hi Delimiter guifg=#8F8F8F
|
||||||
|
hi DiffAdd guibg=#13354A
|
||||||
|
hi DiffChange guifg=#89807D guibg=#4C4745
|
||||||
|
hi DiffDelete guifg=#960050 guibg=#1E0010
|
||||||
|
hi DiffText guibg=#4C4745 gui=italic,bold
|
||||||
|
|
||||||
|
hi Directory guifg=#A6E22E gui=bold
|
||||||
|
hi Error guifg=#E6DB74 guibg=#1E0010
|
||||||
|
hi ErrorMsg guifg=#F92672 guibg=#232526 gui=bold
|
||||||
|
hi Exception guifg=#A6E22E gui=bold
|
||||||
|
hi Float guifg=#AE81FF
|
||||||
|
hi FoldColumn guifg=#465457 guibg=#000000
|
||||||
|
hi Folded guifg=#465457 guibg=#000000
|
||||||
|
hi Function guifg=#A6E22E
|
||||||
|
hi Identifier guifg=#FD971F
|
||||||
|
hi Ignore guifg=#808080 guibg=bg
|
||||||
|
hi IncSearch guifg=#C4BE89 guibg=#000000
|
||||||
|
|
||||||
|
hi Keyword guifg=#F92672 gui=bold
|
||||||
|
hi Label guifg=#E6DB74 gui=none
|
||||||
|
hi Macro guifg=#C4BE89 gui=italic
|
||||||
|
hi SpecialKey guifg=#66D9EF gui=italic
|
||||||
|
|
||||||
|
hi MatchParen guifg=#000000 guibg=#FD971F gui=bold
|
||||||
|
hi ModeMsg guifg=#E6DB74
|
||||||
|
hi MoreMsg guifg=#E6DB74
|
||||||
|
hi Operator guifg=#F92672
|
||||||
|
|
||||||
|
" complete menu
|
||||||
|
hi Pmenu guifg=#66D9EF guibg=#000000
|
||||||
|
hi PmenuSel guibg=#808080
|
||||||
|
hi PmenuSbar guibg=#080808
|
||||||
|
hi PmenuThumb guifg=#66D9EF
|
||||||
|
|
||||||
|
hi PreCondit guifg=#A6E22E gui=bold
|
||||||
|
hi PreProc guifg=#A6E22E
|
||||||
|
hi Question guifg=#66D9EF
|
||||||
|
hi Repeat guifg=#F92672 gui=bold
|
||||||
|
hi Search guifg=#000000 guibg=#FFE792
|
||||||
|
" marks
|
||||||
|
hi SignColumn guifg=#A6E22E guibg=#232526
|
||||||
|
hi SpecialChar guifg=#F92672 gui=bold
|
||||||
|
hi SpecialComment guifg=#7E8E91 gui=bold
|
||||||
|
hi Special guifg=#66D9EF guibg=bg gui=italic
|
||||||
|
if has("spell")
|
||||||
|
hi SpellBad guisp=#FF0000 gui=undercurl
|
||||||
|
hi SpellCap guisp=#7070F0 gui=undercurl
|
||||||
|
hi SpellLocal guisp=#70F0F0 gui=undercurl
|
||||||
|
hi SpellRare guisp=#FFFFFF gui=undercurl
|
||||||
|
endif
|
||||||
|
hi Statement guifg=#F92672 gui=bold
|
||||||
|
hi StatusLine guifg=#455354 guibg=fg
|
||||||
|
hi StatusLineNC guifg=#808080 guibg=#080808
|
||||||
|
hi StorageClass guifg=#FD971F gui=italic
|
||||||
|
hi Structure guifg=#66D9EF
|
||||||
|
hi Tag guifg=#F92672 gui=italic
|
||||||
|
hi Title guifg=#ef5939
|
||||||
|
hi Todo guifg=#FFFFFF guibg=bg gui=bold
|
||||||
|
|
||||||
|
hi Typedef guifg=#66D9EF
|
||||||
|
hi Type guifg=#66D9EF gui=none
|
||||||
|
hi Underlined guifg=#808080 gui=underline
|
||||||
|
|
||||||
|
hi VertSplit guifg=#808080 guibg=#080808 gui=bold
|
||||||
|
hi VisualNOS guibg=#403D3D
|
||||||
|
hi Visual guibg=#403D3D
|
||||||
|
hi WarningMsg guifg=#FFFFFF guibg=#333333 gui=bold
|
||||||
|
hi WildMenu guifg=#66D9EF guibg=#000000
|
||||||
|
|
||||||
|
hi TabLineFill guifg=#1B1D1E guibg=#1B1D1E
|
||||||
|
hi TabLine guibg=#1B1D1E guifg=#808080 gui=none
|
||||||
|
|
||||||
|
if s:molokai_original == 1
|
||||||
|
hi Normal guifg=#F8F8F2 guibg=#272822
|
||||||
|
hi Comment guifg=#75715E
|
||||||
|
hi CursorLine guibg=#3E3D32
|
||||||
|
hi CursorLineNr guifg=#FD971F gui=none
|
||||||
|
hi CursorColumn guibg=#3E3D32
|
||||||
|
hi ColorColumn guibg=#3B3A32
|
||||||
|
hi LineNr guifg=#BCBCBC guibg=#3B3A32
|
||||||
|
hi NonText guifg=#75715E
|
||||||
|
hi SpecialKey guifg=#75715E
|
||||||
|
else
|
||||||
|
hi Normal guifg=#F8F8F2 guibg=#1B1D1E
|
||||||
|
hi Comment guifg=#7E8E91
|
||||||
|
hi CursorLine guibg=#293739
|
||||||
|
hi CursorLineNr guifg=#FD971F gui=none
|
||||||
|
hi CursorColumn guibg=#293739
|
||||||
|
hi ColorColumn guibg=#232526
|
||||||
|
hi LineNr guifg=#465457 guibg=#232526
|
||||||
|
hi NonText guifg=#465457
|
||||||
|
hi SpecialKey guifg=#465457
|
||||||
|
end
|
||||||
|
|
||||||
|
"
|
||||||
|
" Support for 256-color terminal
|
||||||
|
"
|
||||||
|
if &t_Co > 255
|
||||||
|
if s:molokai_original == 1
|
||||||
|
hi Normal ctermbg=234
|
||||||
|
hi CursorLine ctermbg=235 cterm=none
|
||||||
|
hi CursorLineNr ctermfg=208 cterm=none
|
||||||
|
else
|
||||||
|
hi Normal ctermfg=252 ctermbg=233
|
||||||
|
hi CursorLine ctermbg=234 cterm=none
|
||||||
|
hi CursorLineNr ctermfg=208 cterm=none
|
||||||
|
endif
|
||||||
|
hi Boolean ctermfg=135
|
||||||
|
hi Character ctermfg=144
|
||||||
|
hi Number ctermfg=135
|
||||||
|
hi String ctermfg=144
|
||||||
|
hi Conditional ctermfg=161 cterm=bold
|
||||||
|
hi Constant ctermfg=135 cterm=bold
|
||||||
|
hi Cursor ctermfg=16 ctermbg=253
|
||||||
|
hi Debug ctermfg=225 cterm=bold
|
||||||
|
hi Define ctermfg=81
|
||||||
|
hi Delimiter ctermfg=241
|
||||||
|
|
||||||
|
hi DiffAdd ctermbg=24
|
||||||
|
hi DiffChange ctermfg=181 ctermbg=239
|
||||||
|
hi DiffDelete ctermfg=162 ctermbg=53
|
||||||
|
hi DiffText ctermbg=102 cterm=bold
|
||||||
|
|
||||||
|
hi Directory ctermfg=118 cterm=bold
|
||||||
|
hi Error ctermfg=219 ctermbg=89
|
||||||
|
hi ErrorMsg ctermfg=199 ctermbg=16 cterm=bold
|
||||||
|
hi Exception ctermfg=118 cterm=bold
|
||||||
|
hi Float ctermfg=135
|
||||||
|
hi FoldColumn ctermfg=67 ctermbg=16
|
||||||
|
hi Folded ctermfg=67 ctermbg=16
|
||||||
|
hi Function ctermfg=118
|
||||||
|
hi Identifier ctermfg=208 cterm=none
|
||||||
|
hi Ignore ctermfg=244 ctermbg=232
|
||||||
|
hi IncSearch ctermfg=193 ctermbg=16
|
||||||
|
|
||||||
|
hi keyword ctermfg=161 cterm=bold
|
||||||
|
hi Label ctermfg=229 cterm=none
|
||||||
|
hi Macro ctermfg=193
|
||||||
|
hi SpecialKey ctermfg=81
|
||||||
|
|
||||||
|
hi MatchParen ctermfg=233 ctermbg=208 cterm=bold
|
||||||
|
hi ModeMsg ctermfg=229
|
||||||
|
hi MoreMsg ctermfg=229
|
||||||
|
hi Operator ctermfg=161
|
||||||
|
|
||||||
|
" complete menu
|
||||||
|
hi Pmenu ctermfg=81 ctermbg=16
|
||||||
|
hi PmenuSel ctermfg=255 ctermbg=242
|
||||||
|
hi PmenuSbar ctermbg=232
|
||||||
|
hi PmenuThumb ctermfg=81
|
||||||
|
|
||||||
|
hi PreCondit ctermfg=118 cterm=bold
|
||||||
|
hi PreProc ctermfg=118
|
||||||
|
hi Question ctermfg=81
|
||||||
|
hi Repeat ctermfg=161 cterm=bold
|
||||||
|
hi Search ctermfg=0 ctermbg=222 cterm=NONE
|
||||||
|
|
||||||
|
" marks column
|
||||||
|
hi SignColumn ctermfg=118 ctermbg=235
|
||||||
|
hi SpecialChar ctermfg=161 cterm=bold
|
||||||
|
hi SpecialComment ctermfg=245 cterm=bold
|
||||||
|
hi Special ctermfg=81
|
||||||
|
if has("spell")
|
||||||
|
hi SpellBad ctermbg=52
|
||||||
|
hi SpellCap ctermbg=17
|
||||||
|
hi SpellLocal ctermbg=17
|
||||||
|
hi SpellRare ctermfg=none ctermbg=none cterm=reverse
|
||||||
|
endif
|
||||||
|
hi Statement ctermfg=161 cterm=bold
|
||||||
|
hi StatusLine ctermfg=238 ctermbg=253
|
||||||
|
hi StatusLineNC ctermfg=244 ctermbg=232
|
||||||
|
hi StorageClass ctermfg=208
|
||||||
|
hi Structure ctermfg=81
|
||||||
|
hi Tag ctermfg=161
|
||||||
|
hi Title ctermfg=166
|
||||||
|
hi Todo ctermfg=231 ctermbg=232 cterm=bold
|
||||||
|
|
||||||
|
hi Typedef ctermfg=81
|
||||||
|
hi Type ctermfg=81 cterm=none
|
||||||
|
hi Underlined ctermfg=244 cterm=underline
|
||||||
|
|
||||||
|
hi VertSplit ctermfg=244 ctermbg=232 cterm=bold
|
||||||
|
hi VisualNOS ctermbg=238
|
||||||
|
hi Visual ctermbg=235
|
||||||
|
hi WarningMsg ctermfg=231 ctermbg=238 cterm=bold
|
||||||
|
hi WildMenu ctermfg=81 ctermbg=16
|
||||||
|
|
||||||
|
hi Comment ctermfg=59
|
||||||
|
hi CursorColumn ctermbg=236
|
||||||
|
hi ColorColumn ctermbg=236
|
||||||
|
hi LineNr ctermfg=250 ctermbg=236
|
||||||
|
hi NonText ctermfg=59
|
||||||
|
|
||||||
|
hi SpecialKey ctermfg=59
|
||||||
|
|
||||||
|
if exists("g:rehash256") && g:rehash256 == 1
|
||||||
|
hi Normal ctermfg=252 ctermbg=234
|
||||||
|
hi CursorLine ctermbg=236 cterm=none
|
||||||
|
hi CursorLineNr ctermfg=208 cterm=none
|
||||||
|
|
||||||
|
hi Boolean ctermfg=141
|
||||||
|
hi Character ctermfg=222
|
||||||
|
hi Number ctermfg=141
|
||||||
|
hi String ctermfg=222
|
||||||
|
hi Conditional ctermfg=197 cterm=bold
|
||||||
|
hi Constant ctermfg=141 cterm=bold
|
||||||
|
|
||||||
|
hi DiffDelete ctermfg=125 ctermbg=233
|
||||||
|
|
||||||
|
hi Directory ctermfg=154 cterm=bold
|
||||||
|
hi Error ctermfg=222 ctermbg=233
|
||||||
|
hi Exception ctermfg=154 cterm=bold
|
||||||
|
hi Float ctermfg=141
|
||||||
|
hi Function ctermfg=154
|
||||||
|
hi Identifier ctermfg=208
|
||||||
|
|
||||||
|
hi Keyword ctermfg=197 cterm=bold
|
||||||
|
hi Operator ctermfg=197
|
||||||
|
hi PreCondit ctermfg=154 cterm=bold
|
||||||
|
hi PreProc ctermfg=154
|
||||||
|
hi Repeat ctermfg=197 cterm=bold
|
||||||
|
|
||||||
|
hi Statement ctermfg=197 cterm=bold
|
||||||
|
hi Tag ctermfg=197
|
||||||
|
hi Title ctermfg=203
|
||||||
|
hi Visual ctermbg=238
|
||||||
|
|
||||||
|
hi Comment ctermfg=244
|
||||||
|
hi LineNr ctermfg=239 ctermbg=235
|
||||||
|
hi NonText ctermfg=239
|
||||||
|
hi SpecialKey ctermfg=239
|
||||||
|
endif
|
||||||
|
end
|
||||||
|
|
||||||
|
" Must be at the end, because of ctermbg=234 bug.
|
||||||
|
" https://groups.google.com/forum/#!msg/vim_dev/afPqwAFNdrU/nqh6tOM87QUJ
|
||||||
|
set background=dark
|
||||||
1291
doc/NERD_tree.txt
Normal file
1291
doc/NERD_tree.txt
Normal file
File diff suppressed because it is too large
Load Diff
87
doc/tags
Normal file
87
doc/tags
Normal file
@@ -0,0 +1,87 @@
|
|||||||
|
'NERDChristmasTree' NERD_tree.txt /*'NERDChristmasTree'*
|
||||||
|
'NERDTreeAutoCenter' NERD_tree.txt /*'NERDTreeAutoCenter'*
|
||||||
|
'NERDTreeAutoCenterThreshold' NERD_tree.txt /*'NERDTreeAutoCenterThreshold'*
|
||||||
|
'NERDTreeBookmarksFile' NERD_tree.txt /*'NERDTreeBookmarksFile'*
|
||||||
|
'NERDTreeCaseSensitiveSort' NERD_tree.txt /*'NERDTreeCaseSensitiveSort'*
|
||||||
|
'NERDTreeChDirMode' NERD_tree.txt /*'NERDTreeChDirMode'*
|
||||||
|
'NERDTreeDirArrows' NERD_tree.txt /*'NERDTreeDirArrows'*
|
||||||
|
'NERDTreeHighlightCursorline' NERD_tree.txt /*'NERDTreeHighlightCursorline'*
|
||||||
|
'NERDTreeHijackNetrw' NERD_tree.txt /*'NERDTreeHijackNetrw'*
|
||||||
|
'NERDTreeIgnore' NERD_tree.txt /*'NERDTreeIgnore'*
|
||||||
|
'NERDTreeMinimalUI' NERD_tree.txt /*'NERDTreeMinimalUI'*
|
||||||
|
'NERDTreeMouseMode' NERD_tree.txt /*'NERDTreeMouseMode'*
|
||||||
|
'NERDTreeQuitOnOpen' NERD_tree.txt /*'NERDTreeQuitOnOpen'*
|
||||||
|
'NERDTreeShowBookmarks' NERD_tree.txt /*'NERDTreeShowBookmarks'*
|
||||||
|
'NERDTreeShowFiles' NERD_tree.txt /*'NERDTreeShowFiles'*
|
||||||
|
'NERDTreeShowHidden' NERD_tree.txt /*'NERDTreeShowHidden'*
|
||||||
|
'NERDTreeShowLineNumbers' NERD_tree.txt /*'NERDTreeShowLineNumbers'*
|
||||||
|
'NERDTreeSortOrder' NERD_tree.txt /*'NERDTreeSortOrder'*
|
||||||
|
'NERDTreeStatusline' NERD_tree.txt /*'NERDTreeStatusline'*
|
||||||
|
'NERDTreeWinPos' NERD_tree.txt /*'NERDTreeWinPos'*
|
||||||
|
'NERDTreeWinSize' NERD_tree.txt /*'NERDTreeWinSize'*
|
||||||
|
'loaded_nerd_tree' NERD_tree.txt /*'loaded_nerd_tree'*
|
||||||
|
:NERDTree NERD_tree.txt /*:NERDTree*
|
||||||
|
:NERDTreeClose NERD_tree.txt /*:NERDTreeClose*
|
||||||
|
:NERDTreeFind NERD_tree.txt /*:NERDTreeFind*
|
||||||
|
:NERDTreeFromBookmark NERD_tree.txt /*:NERDTreeFromBookmark*
|
||||||
|
:NERDTreeMirror NERD_tree.txt /*:NERDTreeMirror*
|
||||||
|
:NERDTreeToggle NERD_tree.txt /*:NERDTreeToggle*
|
||||||
|
NERDTree NERD_tree.txt /*NERDTree*
|
||||||
|
NERDTree-? NERD_tree.txt /*NERDTree-?*
|
||||||
|
NERDTree-A NERD_tree.txt /*NERDTree-A*
|
||||||
|
NERDTree-B NERD_tree.txt /*NERDTree-B*
|
||||||
|
NERDTree-C NERD_tree.txt /*NERDTree-C*
|
||||||
|
NERDTree-C-J NERD_tree.txt /*NERDTree-C-J*
|
||||||
|
NERDTree-C-K NERD_tree.txt /*NERDTree-C-K*
|
||||||
|
NERDTree-D NERD_tree.txt /*NERDTree-D*
|
||||||
|
NERDTree-F NERD_tree.txt /*NERDTree-F*
|
||||||
|
NERDTree-I NERD_tree.txt /*NERDTree-I*
|
||||||
|
NERDTree-J NERD_tree.txt /*NERDTree-J*
|
||||||
|
NERDTree-K NERD_tree.txt /*NERDTree-K*
|
||||||
|
NERDTree-O NERD_tree.txt /*NERDTree-O*
|
||||||
|
NERDTree-P NERD_tree.txt /*NERDTree-P*
|
||||||
|
NERDTree-R NERD_tree.txt /*NERDTree-R*
|
||||||
|
NERDTree-T NERD_tree.txt /*NERDTree-T*
|
||||||
|
NERDTree-U NERD_tree.txt /*NERDTree-U*
|
||||||
|
NERDTree-X NERD_tree.txt /*NERDTree-X*
|
||||||
|
NERDTree-cd NERD_tree.txt /*NERDTree-cd*
|
||||||
|
NERDTree-contents NERD_tree.txt /*NERDTree-contents*
|
||||||
|
NERDTree-e NERD_tree.txt /*NERDTree-e*
|
||||||
|
NERDTree-f NERD_tree.txt /*NERDTree-f*
|
||||||
|
NERDTree-gi NERD_tree.txt /*NERDTree-gi*
|
||||||
|
NERDTree-go NERD_tree.txt /*NERDTree-go*
|
||||||
|
NERDTree-gs NERD_tree.txt /*NERDTree-gs*
|
||||||
|
NERDTree-i NERD_tree.txt /*NERDTree-i*
|
||||||
|
NERDTree-m NERD_tree.txt /*NERDTree-m*
|
||||||
|
NERDTree-o NERD_tree.txt /*NERDTree-o*
|
||||||
|
NERDTree-p NERD_tree.txt /*NERDTree-p*
|
||||||
|
NERDTree-q NERD_tree.txt /*NERDTree-q*
|
||||||
|
NERDTree-r NERD_tree.txt /*NERDTree-r*
|
||||||
|
NERDTree-s NERD_tree.txt /*NERDTree-s*
|
||||||
|
NERDTree-t NERD_tree.txt /*NERDTree-t*
|
||||||
|
NERDTree-u NERD_tree.txt /*NERDTree-u*
|
||||||
|
NERDTree-x NERD_tree.txt /*NERDTree-x*
|
||||||
|
NERDTreeAPI NERD_tree.txt /*NERDTreeAPI*
|
||||||
|
NERDTreeAbout NERD_tree.txt /*NERDTreeAbout*
|
||||||
|
NERDTreeAddKeyMap() NERD_tree.txt /*NERDTreeAddKeyMap()*
|
||||||
|
NERDTreeAddMenuItem() NERD_tree.txt /*NERDTreeAddMenuItem()*
|
||||||
|
NERDTreeAddMenuSeparator() NERD_tree.txt /*NERDTreeAddMenuSeparator()*
|
||||||
|
NERDTreeAddSubmenu() NERD_tree.txt /*NERDTreeAddSubmenu()*
|
||||||
|
NERDTreeBookmarkCommands NERD_tree.txt /*NERDTreeBookmarkCommands*
|
||||||
|
NERDTreeBookmarkTable NERD_tree.txt /*NERDTreeBookmarkTable*
|
||||||
|
NERDTreeBookmarks NERD_tree.txt /*NERDTreeBookmarks*
|
||||||
|
NERDTreeChangelog NERD_tree.txt /*NERDTreeChangelog*
|
||||||
|
NERDTreeCredits NERD_tree.txt /*NERDTreeCredits*
|
||||||
|
NERDTreeFunctionality NERD_tree.txt /*NERDTreeFunctionality*
|
||||||
|
NERDTreeGlobalCommands NERD_tree.txt /*NERDTreeGlobalCommands*
|
||||||
|
NERDTreeInvalidBookmarks NERD_tree.txt /*NERDTreeInvalidBookmarks*
|
||||||
|
NERDTreeKeymapAPI NERD_tree.txt /*NERDTreeKeymapAPI*
|
||||||
|
NERDTreeLicense NERD_tree.txt /*NERDTreeLicense*
|
||||||
|
NERDTreeMappings NERD_tree.txt /*NERDTreeMappings*
|
||||||
|
NERDTreeMenu NERD_tree.txt /*NERDTreeMenu*
|
||||||
|
NERDTreeMenuAPI NERD_tree.txt /*NERDTreeMenuAPI*
|
||||||
|
NERDTreeOptionDetails NERD_tree.txt /*NERDTreeOptionDetails*
|
||||||
|
NERDTreeOptionSummary NERD_tree.txt /*NERDTreeOptionSummary*
|
||||||
|
NERDTreeOptions NERD_tree.txt /*NERDTreeOptions*
|
||||||
|
NERDTreeRender() NERD_tree.txt /*NERDTreeRender()*
|
||||||
|
NERD_tree.txt NERD_tree.txt /*NERD_tree.txt*
|
||||||
41
nerdtree_plugin/exec_menuitem.vim
Normal file
41
nerdtree_plugin/exec_menuitem.vim
Normal file
@@ -0,0 +1,41 @@
|
|||||||
|
" ============================================================================
|
||||||
|
" File: exec_menuitem.vim
|
||||||
|
" Description: plugin for NERD Tree that provides an execute file menu item
|
||||||
|
" Maintainer: Martin Grenfell <martin.grenfell at gmail dot com>
|
||||||
|
" Last Change: 22 July, 2009
|
||||||
|
" License: This program is free software. It comes without any warranty,
|
||||||
|
" to the extent permitted by applicable law. You can redistribute
|
||||||
|
" it and/or modify it under the terms of the Do What The Fuck You
|
||||||
|
" Want To Public License, Version 2, as published by Sam Hocevar.
|
||||||
|
" See http://sam.zoy.org/wtfpl/COPYING for more details.
|
||||||
|
"
|
||||||
|
" ============================================================================
|
||||||
|
if exists("g:loaded_nerdtree_exec_menuitem")
|
||||||
|
finish
|
||||||
|
endif
|
||||||
|
let g:loaded_nerdtree_exec_menuitem = 1
|
||||||
|
|
||||||
|
call NERDTreeAddMenuItem({
|
||||||
|
\ 'text': '(!)Execute file',
|
||||||
|
\ 'shortcut': '!',
|
||||||
|
\ 'callback': 'NERDTreeExecFile',
|
||||||
|
\ 'isActiveCallback': 'NERDTreeExecFileActive' })
|
||||||
|
|
||||||
|
function! NERDTreeExecFileActive()
|
||||||
|
let node = g:NERDTreeFileNode.GetSelected()
|
||||||
|
return !node.path.isDirectory && node.path.isExecutable
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! NERDTreeExecFile()
|
||||||
|
let treenode = g:NERDTreeFileNode.GetSelected()
|
||||||
|
echo "==========================================================\n"
|
||||||
|
echo "Complete the command to execute (add arguments etc):\n"
|
||||||
|
let cmd = treenode.path.str({'escape': 1})
|
||||||
|
let cmd = input(':!', cmd . ' ')
|
||||||
|
|
||||||
|
if cmd != ''
|
||||||
|
exec ':!' . cmd
|
||||||
|
else
|
||||||
|
echo "Aborted"
|
||||||
|
endif
|
||||||
|
endfunction
|
||||||
224
nerdtree_plugin/fs_menu.vim
Normal file
224
nerdtree_plugin/fs_menu.vim
Normal file
@@ -0,0 +1,224 @@
|
|||||||
|
" ============================================================================
|
||||||
|
" File: fs_menu.vim
|
||||||
|
" Description: plugin for the NERD Tree that provides a file system menu
|
||||||
|
" Maintainer: Martin Grenfell <martin.grenfell at gmail dot com>
|
||||||
|
" Last Change: 17 July, 2009
|
||||||
|
" License: This program is free software. It comes without any warranty,
|
||||||
|
" to the extent permitted by applicable law. You can redistribute
|
||||||
|
" it and/or modify it under the terms of the Do What The Fuck You
|
||||||
|
" Want To Public License, Version 2, as published by Sam Hocevar.
|
||||||
|
" See http://sam.zoy.org/wtfpl/COPYING for more details.
|
||||||
|
"
|
||||||
|
" ============================================================================
|
||||||
|
if exists("g:loaded_nerdtree_fs_menu")
|
||||||
|
finish
|
||||||
|
endif
|
||||||
|
let g:loaded_nerdtree_fs_menu = 1
|
||||||
|
|
||||||
|
call NERDTreeAddMenuItem({'text': '(a)dd a childnode', 'shortcut': 'a', 'callback': 'NERDTreeAddNode'})
|
||||||
|
call NERDTreeAddMenuItem({'text': '(m)ove the current node', 'shortcut': 'm', 'callback': 'NERDTreeMoveNode'})
|
||||||
|
call NERDTreeAddMenuItem({'text': '(d)elete the current node', 'shortcut': 'd', 'callback': 'NERDTreeDeleteNode'})
|
||||||
|
|
||||||
|
if has("gui_mac") || has("gui_macvim")
|
||||||
|
call NERDTreeAddMenuItem({'text': '(r)eveal in Finder the current node', 'shortcut': 'r', 'callback': 'NERDTreeRevealInFinder'})
|
||||||
|
call NERDTreeAddMenuItem({'text': '(o)pen the current node with system editor', 'shortcut': 'o', 'callback': 'NERDTreeExecuteFile'})
|
||||||
|
call NERDTreeAddMenuItem({'text': '(q)uicklook the current node', 'shortcut': 'q', 'callback': 'NERDTreeQuickLook'})
|
||||||
|
endif
|
||||||
|
|
||||||
|
if g:NERDTreePath.CopyingSupported()
|
||||||
|
call NERDTreeAddMenuItem({'text': '(c)copy the current node', 'shortcut': 'c', 'callback': 'NERDTreeCopyNode'})
|
||||||
|
endif
|
||||||
|
|
||||||
|
"FUNCTION: s:echo(msg){{{1
|
||||||
|
function! s:echo(msg)
|
||||||
|
redraw
|
||||||
|
echomsg "NERDTree: " . a:msg
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
"FUNCTION: s:echoWarning(msg){{{1
|
||||||
|
function! s:echoWarning(msg)
|
||||||
|
echohl warningmsg
|
||||||
|
call s:echo(a:msg)
|
||||||
|
echohl normal
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
"FUNCTION: s:promptToDelBuffer(bufnum, msg){{{1
|
||||||
|
"prints out the given msg and, if the user responds by pushing 'y' then the
|
||||||
|
"buffer with the given bufnum is deleted
|
||||||
|
"
|
||||||
|
"Args:
|
||||||
|
"bufnum: the buffer that may be deleted
|
||||||
|
"msg: a message that will be echoed to the user asking them if they wish to
|
||||||
|
" del the buffer
|
||||||
|
function! s:promptToDelBuffer(bufnum, msg)
|
||||||
|
echo a:msg
|
||||||
|
if nr2char(getchar()) ==# 'y'
|
||||||
|
exec "silent bdelete! " . a:bufnum
|
||||||
|
endif
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
"FUNCTION: NERDTreeAddNode(){{{1
|
||||||
|
function! NERDTreeAddNode()
|
||||||
|
let curDirNode = g:NERDTreeDirNode.GetSelected()
|
||||||
|
|
||||||
|
let newNodeName = input("Add a childnode\n".
|
||||||
|
\ "==========================================================\n".
|
||||||
|
\ "Enter the dir/file name to be created. Dirs end with a '/'\n" .
|
||||||
|
\ "", curDirNode.path.str() . g:NERDTreePath.Slash(), "file")
|
||||||
|
|
||||||
|
if newNodeName ==# ''
|
||||||
|
call s:echo("Node Creation Aborted.")
|
||||||
|
return
|
||||||
|
endif
|
||||||
|
|
||||||
|
try
|
||||||
|
let newPath = g:NERDTreePath.Create(newNodeName)
|
||||||
|
let parentNode = b:NERDTreeRoot.findNode(newPath.getParent())
|
||||||
|
|
||||||
|
let newTreeNode = g:NERDTreeFileNode.New(newPath)
|
||||||
|
if parentNode.isOpen || !empty(parentNode.children)
|
||||||
|
call parentNode.addChild(newTreeNode, 1)
|
||||||
|
call NERDTreeRender()
|
||||||
|
call newTreeNode.putCursorHere(1, 0)
|
||||||
|
endif
|
||||||
|
catch /^NERDTree/
|
||||||
|
call s:echoWarning("Node Not Created.")
|
||||||
|
endtry
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
"FUNCTION: NERDTreeMoveNode(){{{1
|
||||||
|
function! NERDTreeMoveNode()
|
||||||
|
let curNode = g:NERDTreeFileNode.GetSelected()
|
||||||
|
let newNodePath = input("Rename the current node\n" .
|
||||||
|
\ "==========================================================\n" .
|
||||||
|
\ "Enter the new path for the node: \n" .
|
||||||
|
\ "", curNode.path.str(), "file")
|
||||||
|
|
||||||
|
if newNodePath ==# ''
|
||||||
|
call s:echo("Node Renaming Aborted.")
|
||||||
|
return
|
||||||
|
endif
|
||||||
|
|
||||||
|
try
|
||||||
|
let bufnum = bufnr(curNode.path.str())
|
||||||
|
|
||||||
|
call curNode.rename(newNodePath)
|
||||||
|
call NERDTreeRender()
|
||||||
|
|
||||||
|
"if the node is open in a buffer, ask the user if they want to
|
||||||
|
"close that buffer
|
||||||
|
if bufnum != -1
|
||||||
|
let prompt = "\nNode renamed.\n\nThe old file is open in buffer ". bufnum . (bufwinnr(bufnum) ==# -1 ? " (hidden)" : "") .". Delete this buffer? (yN)"
|
||||||
|
call s:promptToDelBuffer(bufnum, prompt)
|
||||||
|
endif
|
||||||
|
|
||||||
|
call curNode.putCursorHere(1, 0)
|
||||||
|
|
||||||
|
redraw
|
||||||
|
catch /^NERDTree/
|
||||||
|
call s:echoWarning("Node Not Renamed.")
|
||||||
|
endtry
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" FUNCTION: NERDTreeDeleteNode() {{{1
|
||||||
|
function! NERDTreeDeleteNode()
|
||||||
|
let currentNode = g:NERDTreeFileNode.GetSelected()
|
||||||
|
let confirmed = 0
|
||||||
|
|
||||||
|
if currentNode.path.isDirectory
|
||||||
|
let choice =input("Delete the current node\n" .
|
||||||
|
\ "==========================================================\n" .
|
||||||
|
\ "STOP! To delete this entire directory, type 'yes'\n" .
|
||||||
|
\ "" . currentNode.path.str() . ": ")
|
||||||
|
let confirmed = choice ==# 'yes'
|
||||||
|
else
|
||||||
|
echo "Delete the current node\n" .
|
||||||
|
\ "==========================================================\n".
|
||||||
|
\ "Are you sure you wish to delete the node:\n" .
|
||||||
|
\ "" . currentNode.path.str() . " (yN):"
|
||||||
|
let choice = nr2char(getchar())
|
||||||
|
let confirmed = choice ==# 'y'
|
||||||
|
endif
|
||||||
|
|
||||||
|
|
||||||
|
if confirmed
|
||||||
|
try
|
||||||
|
call currentNode.delete()
|
||||||
|
call NERDTreeRender()
|
||||||
|
|
||||||
|
"if the node is open in a buffer, ask the user if they want to
|
||||||
|
"close that buffer
|
||||||
|
let bufnum = bufnr(currentNode.path.str())
|
||||||
|
if buflisted(bufnum)
|
||||||
|
let prompt = "\nNode deleted.\n\nThe file is open in buffer ". bufnum . (bufwinnr(bufnum) ==# -1 ? " (hidden)" : "") .". Delete this buffer? (yN)"
|
||||||
|
call s:promptToDelBuffer(bufnum, prompt)
|
||||||
|
endif
|
||||||
|
|
||||||
|
redraw
|
||||||
|
catch /^NERDTree/
|
||||||
|
call s:echoWarning("Could not remove node")
|
||||||
|
endtry
|
||||||
|
else
|
||||||
|
call s:echo("delete aborted")
|
||||||
|
endif
|
||||||
|
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" FUNCTION: NERDTreeCopyNode() {{{1
|
||||||
|
function! NERDTreeCopyNode()
|
||||||
|
let currentNode = g:NERDTreeFileNode.GetSelected()
|
||||||
|
let newNodePath = input("Copy the current node\n" .
|
||||||
|
\ "==========================================================\n" .
|
||||||
|
\ "Enter the new path to copy the node to: \n" .
|
||||||
|
\ "", currentNode.path.str(), "file")
|
||||||
|
|
||||||
|
if newNodePath != ""
|
||||||
|
"strip trailing slash
|
||||||
|
let newNodePath = substitute(newNodePath, '\/$', '', '')
|
||||||
|
|
||||||
|
let confirmed = 1
|
||||||
|
if currentNode.path.copyingWillOverwrite(newNodePath)
|
||||||
|
call s:echo("Warning: copying may overwrite files! Continue? (yN)")
|
||||||
|
let choice = nr2char(getchar())
|
||||||
|
let confirmed = choice ==# 'y'
|
||||||
|
endif
|
||||||
|
|
||||||
|
if confirmed
|
||||||
|
try
|
||||||
|
let newNode = currentNode.copy(newNodePath)
|
||||||
|
if !empty(newNode)
|
||||||
|
call NERDTreeRender()
|
||||||
|
call newNode.putCursorHere(0, 0)
|
||||||
|
endif
|
||||||
|
catch /^NERDTree/
|
||||||
|
call s:echoWarning("Could not copy node")
|
||||||
|
endtry
|
||||||
|
endif
|
||||||
|
else
|
||||||
|
call s:echo("Copy aborted.")
|
||||||
|
endif
|
||||||
|
redraw
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! NERDTreeQuickLook()
|
||||||
|
let treenode = g:NERDTreeFileNode.GetSelected()
|
||||||
|
if treenode != {}
|
||||||
|
call system("qlmanage -p 2>/dev/null '" . treenode.path.str() . "'")
|
||||||
|
endif
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! NERDTreeRevealInFinder()
|
||||||
|
let treenode = g:NERDTreeFileNode.GetSelected()
|
||||||
|
if treenode != {}
|
||||||
|
let x = system("open -R '" . treenode.path.str() . "'")
|
||||||
|
endif
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! NERDTreeExecuteFile()
|
||||||
|
let treenode = g:NERDTreeFileNode.GetSelected()
|
||||||
|
if treenode != {}
|
||||||
|
let x = system("open '" . treenode.path.str() . "'")
|
||||||
|
endif
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" vim: set sw=4 sts=4 et fdm=marker:
|
||||||
4017
plugin/NERD_tree.vim
Normal file
4017
plugin/NERD_tree.vim
Normal file
File diff suppressed because it is too large
Load Diff
88
syntax/nerdtree.vim
Normal file
88
syntax/nerdtree.vim
Normal file
@@ -0,0 +1,88 @@
|
|||||||
|
let s:tree_up_dir_line = '.. (up a dir)'
|
||||||
|
"NERDTreeFlags are syntax items that should be invisible, but give clues as to
|
||||||
|
"how things should be highlighted
|
||||||
|
syn match NERDTreeFlag #\~#
|
||||||
|
syn match NERDTreeFlag #\[RO\]#
|
||||||
|
|
||||||
|
"highlighting for the .. (up dir) line at the top of the tree
|
||||||
|
execute "syn match NERDTreeUp #\\V". s:tree_up_dir_line ."#"
|
||||||
|
|
||||||
|
"highlighting for the ~/+ symbols for the directory nodes
|
||||||
|
syn match NERDTreeClosable #\~\<#
|
||||||
|
syn match NERDTreeClosable #\~\.#
|
||||||
|
syn match NERDTreeOpenable #+\<#
|
||||||
|
syn match NERDTreeOpenable #+\.#he=e-1
|
||||||
|
|
||||||
|
"highlighting for the tree structural parts
|
||||||
|
syn match NERDTreePart #|#
|
||||||
|
syn match NERDTreePart #`#
|
||||||
|
syn match NERDTreePartFile #[|`]-#hs=s+1 contains=NERDTreePart
|
||||||
|
|
||||||
|
"quickhelp syntax elements
|
||||||
|
syn match NERDTreeHelpKey #" \{1,2\}[^ ]*:#hs=s+2,he=e-1
|
||||||
|
syn match NERDTreeHelpKey #" \{1,2\}[^ ]*,#hs=s+2,he=e-1
|
||||||
|
syn match NERDTreeHelpTitle #" .*\~#hs=s+2,he=e-1 contains=NERDTreeFlag
|
||||||
|
syn match NERDTreeToggleOn #".*(on)#hs=e-2,he=e-1 contains=NERDTreeHelpKey
|
||||||
|
syn match NERDTreeToggleOff #".*(off)#hs=e-3,he=e-1 contains=NERDTreeHelpKey
|
||||||
|
syn match NERDTreeHelpCommand #" :.\{-}\>#hs=s+3
|
||||||
|
syn match NERDTreeHelp #^".*# contains=NERDTreeHelpKey,NERDTreeHelpTitle,NERDTreeFlag,NERDTreeToggleOff,NERDTreeToggleOn,NERDTreeHelpCommand
|
||||||
|
|
||||||
|
"highlighting for readonly files
|
||||||
|
syn match NERDTreeRO #.*\[RO\]#hs=s+2 contains=NERDTreeFlag,NERDTreeBookmark,NERDTreePart,NERDTreePartFile
|
||||||
|
|
||||||
|
"highlighting for sym links
|
||||||
|
syn match NERDTreeLink #[^-| `].* -> # contains=NERDTreeBookmark,NERDTreeOpenable,NERDTreeClosable,NERDTreeDirSlash
|
||||||
|
|
||||||
|
"highlighing for directory nodes and file nodes
|
||||||
|
syn match NERDTreeDirSlash #/#
|
||||||
|
syn match NERDTreeDir #[^-| `].*/# contains=NERDTreeLink,NERDTreeDirSlash,NERDTreeOpenable,NERDTreeClosable
|
||||||
|
syn match NERDTreeExecFile #[|` ].*\*\($\| \)# contains=NERDTreeLink,NERDTreePart,NERDTreeRO,NERDTreePartFile,NERDTreeBookmark
|
||||||
|
syn match NERDTreeFile #|-.*# contains=NERDTreeLink,NERDTreePart,NERDTreeRO,NERDTreePartFile,NERDTreeBookmark,NERDTreeExecFile
|
||||||
|
syn match NERDTreeFile #`-.*# contains=NERDTreeLink,NERDTreePart,NERDTreeRO,NERDTreePartFile,NERDTreeBookmark,NERDTreeExecFile
|
||||||
|
syn match NERDTreeCWD #^[</].*$#
|
||||||
|
|
||||||
|
"highlighting for bookmarks
|
||||||
|
syn match NERDTreeBookmark # {.*}#hs=s+1
|
||||||
|
|
||||||
|
"highlighting for the bookmarks table
|
||||||
|
syn match NERDTreeBookmarksLeader #^>#
|
||||||
|
syn match NERDTreeBookmarksHeader #^>-\+Bookmarks-\+$# contains=NERDTreeBookmarksLeader
|
||||||
|
syn match NERDTreeBookmarkName #^>.\{-} #he=e-1 contains=NERDTreeBookmarksLeader
|
||||||
|
syn match NERDTreeBookmark #^>.*$# contains=NERDTreeBookmarksLeader,NERDTreeBookmarkName,NERDTreeBookmarksHeader
|
||||||
|
|
||||||
|
if exists("g:NERDChristmasTree") && g:NERDChristmasTree
|
||||||
|
hi def link NERDTreePart Special
|
||||||
|
hi def link NERDTreePartFile Type
|
||||||
|
hi def link NERDTreeFile Normal
|
||||||
|
hi def link NERDTreeExecFile Title
|
||||||
|
hi def link NERDTreeDirSlash Identifier
|
||||||
|
hi def link NERDTreeClosable Type
|
||||||
|
else
|
||||||
|
hi def link NERDTreePart Normal
|
||||||
|
hi def link NERDTreePartFile Normal
|
||||||
|
hi def link NERDTreeFile Normal
|
||||||
|
hi def link NERDTreeClosable Title
|
||||||
|
endif
|
||||||
|
|
||||||
|
hi def link NERDTreeBookmarksHeader statement
|
||||||
|
hi def link NERDTreeBookmarksLeader ignore
|
||||||
|
hi def link NERDTreeBookmarkName Identifier
|
||||||
|
hi def link NERDTreeBookmark normal
|
||||||
|
|
||||||
|
hi def link NERDTreeHelp String
|
||||||
|
hi def link NERDTreeHelpKey Identifier
|
||||||
|
hi def link NERDTreeHelpCommand Identifier
|
||||||
|
hi def link NERDTreeHelpTitle Macro
|
||||||
|
hi def link NERDTreeToggleOn Question
|
||||||
|
hi def link NERDTreeToggleOff WarningMsg
|
||||||
|
|
||||||
|
hi def link NERDTreeDir Directory
|
||||||
|
hi def link NERDTreeUp Directory
|
||||||
|
hi def link NERDTreeCWD Statement
|
||||||
|
hi def link NERDTreeLink Macro
|
||||||
|
hi def link NERDTreeOpenable Title
|
||||||
|
hi def link NERDTreeFlag ignore
|
||||||
|
hi def link NERDTreeRO WarningMsg
|
||||||
|
hi def link NERDTreeBookmark Statement
|
||||||
|
|
||||||
|
hi def link NERDTreeCurrentNode Search
|
||||||
410
vimrc
Normal file
410
vimrc
Normal file
@@ -0,0 +1,410 @@
|
|||||||
|
" All system-wide defaults are set in $VIMRUNTIME/debian.vim and sourced by
|
||||||
|
" the call to :runtime you can find below. If you wish to change any of those
|
||||||
|
" settings, you should do it in this file (/etc/vim/vimrc), since debian.vim
|
||||||
|
" will be overwritten everytime an upgrade of the vim packages is performed.
|
||||||
|
" It is recommended to make changes after sourcing debian.vim since it alters
|
||||||
|
" the value of the 'compatible' option.
|
||||||
|
|
||||||
|
" This line should not be removed as it ensures that various options are
|
||||||
|
" properly set to work with the Vim-related packages available in Debian.
|
||||||
|
runtime! debian.vim
|
||||||
|
|
||||||
|
" Uncomment the next line to make Vim more Vi-compatible
|
||||||
|
" NOTE: debian.vim sets 'nocompatible'. Setting 'compatible' changes numerous
|
||||||
|
" options, so any other options should be set AFTER setting 'compatible'.
|
||||||
|
"set compatible
|
||||||
|
|
||||||
|
" If using a dark background within the editing area and syntax highlighting
|
||||||
|
" turn on this option as well
|
||||||
|
"set background=dark
|
||||||
|
|
||||||
|
" Uncomment the following to have Vim jump to the last position when
|
||||||
|
" reopening a file
|
||||||
|
"if has("autocmd")
|
||||||
|
" au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif
|
||||||
|
"endif
|
||||||
|
|
||||||
|
" Source a global configuration file if available
|
||||||
|
if filereadable("/etc/vim/vimrc.local")
|
||||||
|
source /etc/vim/vimrc.local
|
||||||
|
endif
|
||||||
|
|
||||||
|
" Use pathogen to easily modify the runtime path to include all plugins under
|
||||||
|
" the ~/.vim/bundle directory
|
||||||
|
filetype off " force reloading *after* pathogen loaded
|
||||||
|
call pathogen#infect()
|
||||||
|
call pathogen#helptags()
|
||||||
|
filetype plugin indent on " enable detection, plugins and indenting in one step
|
||||||
|
syntax on
|
||||||
|
|
||||||
|
" Change the mapleader from \ to ,
|
||||||
|
let mapleader=","
|
||||||
|
let maplocalleader="\\"
|
||||||
|
|
||||||
|
" Editing behaviour {{{
|
||||||
|
set showmode " always show what mode we're currently editing in
|
||||||
|
set nowrap " don't wrap lines
|
||||||
|
|
||||||
|
set tabstop=4 " a tab is four spaces"set softtabstop=4 " when hitting <BS>, pretend like a tab is removed, even if spaces
|
||||||
|
set softtabstop=4 " when hitting <BS>, pretend like a tab is removed, even if spaces
|
||||||
|
set expandtab " expand tabs by default (overloadable per file type later)
|
||||||
|
set shiftwidth=4 " number of spaces to use for autoindenting
|
||||||
|
set shiftround " use multiple of shiftwidth when indenting with '<' and '>'
|
||||||
|
|
||||||
|
set backspace=indent,eol,start " allow backspacing over everything in insert mode
|
||||||
|
set autoindent " always set autoindenting on
|
||||||
|
set copyindent " copy the previous indentation on autoindenting
|
||||||
|
set number " always show line numbers
|
||||||
|
set showmatch " set show matching parenthesis
|
||||||
|
set ignorecase " ignore case when searching
|
||||||
|
set smartcase " ignore case if search pattern is all lowercase,
|
||||||
|
" case-sensitive otherwise
|
||||||
|
set smarttab " insert tabs on the start of a line according to
|
||||||
|
" shiftwidth, not tabstop
|
||||||
|
set scrolloff=4 " keep 4 lines off the edges of the screen when scrolling
|
||||||
|
set virtualedit=all " allow the cursor to go in to "invalid" places
|
||||||
|
set hlsearch " highlight search terms
|
||||||
|
set incsearch " show search matches as you type
|
||||||
|
set gdefault " search/replace "globally" (on a line) by default
|
||||||
|
set listchars=tab:▸\ ,trail:·,extends:#,nbsp:·
|
||||||
|
|
||||||
|
set nolist " don't show invisible characters by default,
|
||||||
|
" but it is enabled for some file types (see later)
|
||||||
|
set pastetoggle=<F2> " when in insert mode, press <F2> to go to
|
||||||
|
" paste mode, where you can paste mass data
|
||||||
|
" that won't be autoindented
|
||||||
|
set mouse=a " enable using the mouse if terminal emulator
|
||||||
|
" supports it (xterm does)
|
||||||
|
set fileformats="unix,dos,mac"
|
||||||
|
set formatoptions+=1 " When wrapping paragraphs, don't end lines
|
||||||
|
" with 1-letter words (looks stupid)
|
||||||
|
|
||||||
|
set nrformats= " make <C-a> and <C-x> play well with
|
||||||
|
" zero-padded numbers (i.e. don't consider
|
||||||
|
" them octal or hex)
|
||||||
|
|
||||||
|
set shortmess+=I " hide the launch screen
|
||||||
|
set clipboard=unnamed " normal OS clipboard interaction
|
||||||
|
set autoread " automatically reload files changed outside of Vim
|
||||||
|
|
||||||
|
" Toggle show/hide invisible chars
|
||||||
|
nnoremap <leader>i :set list!<cr>
|
||||||
|
|
||||||
|
" Toggle line numbers
|
||||||
|
nnoremap <leader>N :setlocal number!<cr>
|
||||||
|
|
||||||
|
" Thanks to Steve Losh for this liberating tip
|
||||||
|
" See http://stevelosh.com/blog/2010/09/coming-home-to-vim
|
||||||
|
nnoremap / /\v
|
||||||
|
vnoremap / /\v
|
||||||
|
|
||||||
|
" Speed up scrolling of the viewport slightly
|
||||||
|
nnoremap <C-e> 2<C-e>
|
||||||
|
nnoremap <C-y> 2<C-y>
|
||||||
|
" }}}
|
||||||
|
|
||||||
|
" Folding rules {{{
|
||||||
|
set foldenable " enable folding
|
||||||
|
set foldcolumn=2 " add a fold column
|
||||||
|
set foldmethod=marker " detect triple-{ style fold markers
|
||||||
|
set foldlevelstart=99 " start out with everything unfolded
|
||||||
|
set foldopen=block,hor,insert,jump,mark,percent,quickfix,search,tag,undo
|
||||||
|
" which commands trigger auto-unfold
|
||||||
|
function! MyFoldText()
|
||||||
|
let line = getline(v:foldstart)
|
||||||
|
|
||||||
|
let nucolwidth = &fdc + &number * &numberwidth
|
||||||
|
let windowwidth = winwidth(0) - nucolwidth - 3
|
||||||
|
let foldedlinecount = v:foldend - v:foldstart
|
||||||
|
|
||||||
|
" expand tabs into spaces
|
||||||
|
let onetab = strpart(' ', 0, &tabstop)
|
||||||
|
let line = substitute(line, '\t', onetab, 'g')
|
||||||
|
|
||||||
|
let line = strpart(line, 0, windowwidth - 2 -len(foldedlinecount))
|
||||||
|
let fillcharcount = windowwidth - len(line) - len(foldedlinecount) - 4
|
||||||
|
return line . ' …' . repeat(" ",fillcharcount) . foldedlinecount . ' '
|
||||||
|
endfunction
|
||||||
|
set foldtext=MyFoldText()
|
||||||
|
|
||||||
|
" Mappings to easily toggle fold levels
|
||||||
|
nnoremap z0 :set foldlevel=0<cr>
|
||||||
|
nnoremap z1 :set foldlevel=1<cr>
|
||||||
|
nnoremap z2 :set foldlevel=2<cr>
|
||||||
|
nnoremap z3 :set foldlevel=3<cr>
|
||||||
|
nnoremap z4 :set foldlevel=4<cr>
|
||||||
|
nnoremap z5 :set foldlevel=5<cr>
|
||||||
|
" }}}
|
||||||
|
|
||||||
|
" Editor layout {{{
|
||||||
|
set termencoding=utf-8
|
||||||
|
set encoding=utf-8
|
||||||
|
set lazyredraw " don't update the display while executing macros
|
||||||
|
set laststatus=2 " tell VIM to always put a status line in, even
|
||||||
|
" if there is only one window
|
||||||
|
set cmdheight=2 " use a status bar that is 2 rows high
|
||||||
|
" }}}
|
||||||
|
|
||||||
|
" Vim behaviour {{{
|
||||||
|
set hidden " hide buffers instead of closing them this
|
||||||
|
" means that the current buffer can be put
|
||||||
|
" to background without being written; and
|
||||||
|
" that marks and undo history are preserved
|
||||||
|
set switchbuf=useopen " reveal already opened files from the
|
||||||
|
" quickfix window instead of opening new
|
||||||
|
" buffers
|
||||||
|
set history=1000 " remember more commands and search history
|
||||||
|
set undolevels=1000 " use many muchos levels of undo
|
||||||
|
if v:version >= 730
|
||||||
|
set undofile " keep a persistent backup file
|
||||||
|
set undodir=~/.vim/.undo,~/tmp,/tmp
|
||||||
|
endif
|
||||||
|
set nobackup " do not keep backup files, it's 70's style cluttering
|
||||||
|
set noswapfile " do not write annoying intermediate swap files,
|
||||||
|
" who did ever restore from swap files anyway?
|
||||||
|
set directory=~/.vim/.tmp,~/tmp,/tmp
|
||||||
|
" store swap files in one of these directories
|
||||||
|
" (in case swapfile is ever turned on)
|
||||||
|
set viminfo='20,\"80 " read/write a .viminfo file, don't store more
|
||||||
|
" than 80 lines of registers
|
||||||
|
set wildmenu " make tab completion for files/buffers act like bash
|
||||||
|
set wildmode=list:full " show a list when pressing tab and complete
|
||||||
|
" first full match
|
||||||
|
set wildignore=*.swp,*.bak,*.pyc,*.class
|
||||||
|
set title " change the terminal's title
|
||||||
|
set visualbell " don't beep
|
||||||
|
set noerrorbells " don't beep
|
||||||
|
set showcmd " show (partial) command in the last line of the screen
|
||||||
|
" this also shows visual selection info
|
||||||
|
set nomodeline " disable mode lines (security measure)
|
||||||
|
"set ttyfast " always use a fast terminal
|
||||||
|
set cursorline " underline the current line, for quick orientation
|
||||||
|
" }}}
|
||||||
|
|
||||||
|
|
||||||
|
" Toggle the quickfix window {{{
|
||||||
|
" From Steve Losh, http://learnvimscriptthehardway.stevelosh.com/chapters/38.html
|
||||||
|
nnoremap <C-q> :call <SID>QuickfixToggle()<cr>
|
||||||
|
|
||||||
|
let g:quickfix_is_open = 0
|
||||||
|
|
||||||
|
function! s:QuickfixToggle()
|
||||||
|
if g:quickfix_is_open
|
||||||
|
cclose
|
||||||
|
let g:quickfix_is_open = 0
|
||||||
|
execute g:quickfix_return_to_window . "wincmd w"
|
||||||
|
else
|
||||||
|
let g:quickfix_return_to_window = winnr()
|
||||||
|
copen
|
||||||
|
let g:quickfix_is_open = 1
|
||||||
|
endif
|
||||||
|
endfunction
|
||||||
|
" }}}
|
||||||
|
|
||||||
|
" Toggle the foldcolumn {{{
|
||||||
|
nnoremap <leader>f :call FoldColumnToggle()<cr>
|
||||||
|
|
||||||
|
let g:last_fold_column_width = 4 " Pick a sane default for the foldcolumn
|
||||||
|
|
||||||
|
function! FoldColumnToggle()
|
||||||
|
if &foldcolumn
|
||||||
|
let g:last_fold_column_width = &foldcolumn
|
||||||
|
setlocal foldcolumn=0
|
||||||
|
else
|
||||||
|
let &l:foldcolumn = g:last_fold_column_width
|
||||||
|
endif
|
||||||
|
endfunction
|
||||||
|
" }}}
|
||||||
|
|
||||||
|
" Highlighting {{{
|
||||||
|
if &t_Co > 2 || has("gui_running")
|
||||||
|
syntax on " switch syntax highlighting on, when the terminal has colors
|
||||||
|
endif
|
||||||
|
" }}}
|
||||||
|
|
||||||
|
" Shortcut mappings {{{
|
||||||
|
" Since I never use the ; key anyway, this is a real optimization for almost
|
||||||
|
" all Vim commands, as I don't have to press the Shift key to form chords to
|
||||||
|
" enter ex mode.
|
||||||
|
nnoremap ; :
|
||||||
|
nnoremap <leader>; ;
|
||||||
|
|
||||||
|
" Avoid accidental hits of <F1> while aiming for <Esc>
|
||||||
|
noremap! <F1> <Esc>
|
||||||
|
|
||||||
|
nnoremap <leader>Q :q<CR> " Quickly close the current window
|
||||||
|
nnoremap <leader>q :bd<CR> " Quickly close the current buffer
|
||||||
|
|
||||||
|
" Use Q for formatting the current paragraph (or visual selection)
|
||||||
|
vnoremap Q gq
|
||||||
|
nnoremap Q gqap
|
||||||
|
" set breakindent on " keep paragraph indentation when re-wrapping text
|
||||||
|
|
||||||
|
" Sort paragraphs
|
||||||
|
vnoremap <leader>s !sort -f<CR>gv
|
||||||
|
nnoremap <leader>s vip!sort -f<CR><Esc>
|
||||||
|
|
||||||
|
" make p in Visual mode replace the selected text with the yank register
|
||||||
|
vnoremap p <Esc>:let current_reg = @"<CR>gvdi<C-R>=current_reg<CR><Esc>
|
||||||
|
|
||||||
|
" Shortcut to make
|
||||||
|
nnoremap mk :make<CR>
|
||||||
|
|
||||||
|
" Swap implementations of ` and ' jump to markers
|
||||||
|
" By default, ' jumps to the marked line, ` jumps to the marked line and
|
||||||
|
" column, so swap them
|
||||||
|
nnoremap ' `
|
||||||
|
nnoremap ` '
|
||||||
|
|
||||||
|
" Use the damn hjkl keys
|
||||||
|
noremap <up> <nop>
|
||||||
|
noremap <down> <nop>
|
||||||
|
noremap <left> <nop>
|
||||||
|
noremap <right> <nop>
|
||||||
|
|
||||||
|
" Remap j and k to act as expected when used on long, wrapped, lines
|
||||||
|
nnoremap j gj
|
||||||
|
nnoremap k gk
|
||||||
|
|
||||||
|
" Easy window navigation
|
||||||
|
noremap <C-h> <C-w>h
|
||||||
|
noremap <C-j> <C-w>j
|
||||||
|
noremap <C-k> <C-w>k
|
||||||
|
noremap <C-l> <C-w>l
|
||||||
|
nnoremap <leader>w <C-w>v<C-w>l
|
||||||
|
|
||||||
|
" Complete whole filenames/lines with a quicker shortcut key in insert mode
|
||||||
|
inoremap <C-f> <C-x><C-f>
|
||||||
|
inoremap <C-l> <C-x><C-l>
|
||||||
|
|
||||||
|
" Use ,d (or ,dd or ,dj or 20,dd) to delete a line without adding it to the
|
||||||
|
" yanked stack (also, in visual mode)
|
||||||
|
nnoremap <silent> <leader>d "_d
|
||||||
|
vnoremap <silent> <leader>d "_d
|
||||||
|
|
||||||
|
" Quick yanking to the end of the line
|
||||||
|
nnoremap Y y$
|
||||||
|
|
||||||
|
" YankRing stuff
|
||||||
|
let g:yankring_history_dir = '$HOME/.vim/.tmp'
|
||||||
|
nnoremap <leader>r :YRShow<CR>
|
||||||
|
|
||||||
|
" Edit the vimrc file
|
||||||
|
nnoremap <silent> <leader>ev :e /etc/vim/vimrc<CR>
|
||||||
|
nnoremap <silent> <leader>sv :so /etc/vim/vimrc<CR>
|
||||||
|
|
||||||
|
" Clears the search register
|
||||||
|
nnoremap <silent> <leader>/ :nohlsearch<CR>
|
||||||
|
|
||||||
|
" Pull word under cursor into LHS of a substitute (for quick search and
|
||||||
|
" replace)
|
||||||
|
nnoremap <leader>z :%s#\<<C-r>=expand("<cword>")<CR>\>#
|
||||||
|
|
||||||
|
" Keep search matches in the middle of the window and pulse the line when moving
|
||||||
|
" to them.
|
||||||
|
nnoremap n n:call PulseCursorLine()<cr>
|
||||||
|
nnoremap N N:call PulseCursorLine()<cr>
|
||||||
|
|
||||||
|
" Quickly get out of insert mode without your fingers having to leave the
|
||||||
|
" home row (either use 'jj' or 'jk')
|
||||||
|
inoremap jj <Esc>
|
||||||
|
|
||||||
|
" Quick alignment of text
|
||||||
|
" nnoremap <leader>al :left<CR>
|
||||||
|
" nnoremap <leader>ar :right<CR>
|
||||||
|
" nnoremap <leader>ac :center<CR>
|
||||||
|
|
||||||
|
" Sudo to write
|
||||||
|
cnoremap w!! w !sudo tee % >/dev/null
|
||||||
|
|
||||||
|
" Ctrl+W to redraw
|
||||||
|
nnoremap <C-w> :redraw!<cr>
|
||||||
|
|
||||||
|
" Jump to matching pairs easily, with Tab
|
||||||
|
nnoremap <Tab> %
|
||||||
|
vnoremap <Tab> %
|
||||||
|
|
||||||
|
" Folding
|
||||||
|
nnoremap <Space> za
|
||||||
|
vnoremap <Space> za
|
||||||
|
|
||||||
|
" Strip all trailing whitespace from a file, using ,W
|
||||||
|
nnoremap <leader>W :%s/\s\+$//<CR>:let @/=''<CR>
|
||||||
|
|
||||||
|
" Use The Silver Searcher over grep, iff possible
|
||||||
|
if executable('ag')
|
||||||
|
" Use ag over grep
|
||||||
|
set grepprg=ag\ --nogroup\ --nocolor
|
||||||
|
|
||||||
|
" Use ag in CtrlP for listing files. Lightning fast and respects .gitignore
|
||||||
|
let g:ctrlp_user_command = 'ag %s -l --nocolor -g ""'
|
||||||
|
|
||||||
|
" ag is fast enough that CtrlP doesn't need to cache
|
||||||
|
let g:ctrlp_use_caching = 0
|
||||||
|
endif
|
||||||
|
|
||||||
|
" grep/Ack/Ag for the word under cursor
|
||||||
|
vnoremap <leader>a y:grep! "\b<c-r>"\b"<cr>:cw<cr>
|
||||||
|
nnoremap <leader>a :grep! "\b<c-r><c-w>\b"
|
||||||
|
nnoremap K *N:grep! "\b<c-r><c-w>\b"<cr>:cw<cr>
|
||||||
|
|
||||||
|
" Allow quick additions to the spelling dict
|
||||||
|
nnoremap <leader>g :spellgood <c-r><c-w>
|
||||||
|
|
||||||
|
" Define "Ag" command
|
||||||
|
command -nargs=+ -complete=file -bar Ag silent! grep! <args> | cwindow | redraw!
|
||||||
|
|
||||||
|
" bind \ (backward slash) to grep shortcut
|
||||||
|
nnoremap \ :Ag<SPACE>
|
||||||
|
|
||||||
|
" Creating folds for tags in HTML
|
||||||
|
"nnoremap <leader>ft Vatzf
|
||||||
|
|
||||||
|
" Reselect text that was just pasted with ,v
|
||||||
|
nnoremap <leader>v V`]
|
||||||
|
|
||||||
|
" Gundo.vim
|
||||||
|
nnoremap <F5> :GundoToggle<CR>
|
||||||
|
" }}}
|
||||||
|
|
||||||
|
" NERDTree settings {{{
|
||||||
|
nnoremap <leader>n :NERDTree<CR>
|
||||||
|
nnoremap <leader>m :NERDTreeClose<CR>:NERDTreeFind<CR>
|
||||||
|
nnoremap <leader>N :NERDTreeClose<CR>
|
||||||
|
|
||||||
|
" Store the bookmarks file
|
||||||
|
"let NERDTreeBookmarksFile=expand("$HOME/.vim/NERDTreeBookmarks")
|
||||||
|
let NERDTreeBookmarksFile=expand("/etc/vim/NERDTreeBookmarks")
|
||||||
|
|
||||||
|
" Show the bookmarks table on startup
|
||||||
|
let NERDTreeShowBookmarks=1
|
||||||
|
|
||||||
|
" Show hidden files, too
|
||||||
|
let NERDTreeShowFiles=1
|
||||||
|
let NERDTreeShowHidden=1
|
||||||
|
|
||||||
|
" Quit on opening files from the tree
|
||||||
|
let NERDTreeQuitOnOpen=1
|
||||||
|
|
||||||
|
" Highlight the selected entry in the tree
|
||||||
|
let NERDTreeHighlightCursorline=1
|
||||||
|
|
||||||
|
" Use a single click to fold/unfold directories and a double click to open
|
||||||
|
" files
|
||||||
|
let NERDTreeMouseMode=2
|
||||||
|
|
||||||
|
" Don't display these kinds of files
|
||||||
|
let NERDTreeIgnore=[ '\.pyc$', '\.pyo$', '\.py\$class$', '\.obj$',
|
||||||
|
\ '\.o$', '\.so$', '\.egg$', '^\.git$' ]
|
||||||
|
|
||||||
|
" }}}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
let g:molokai_original = 1
|
||||||
58
vimrc-original
Normal file
58
vimrc-original
Normal file
@@ -0,0 +1,58 @@
|
|||||||
|
" All system-wide defaults are set in $VIMRUNTIME/debian.vim and sourced by
|
||||||
|
" the call to :runtime you can find below. If you wish to change any of those
|
||||||
|
" settings, you should do it in this file (/etc/vim/vimrc), since debian.vim
|
||||||
|
" will be overwritten everytime an upgrade of the vim packages is performed.
|
||||||
|
" It is recommended to make changes after sourcing debian.vim since it alters
|
||||||
|
" the value of the 'compatible' option.
|
||||||
|
|
||||||
|
" This line should not be removed as it ensures that various options are
|
||||||
|
" properly set to work with the Vim-related packages available in Debian.
|
||||||
|
runtime! debian.vim
|
||||||
|
|
||||||
|
" Uncomment the next line to make Vim more Vi-compatible
|
||||||
|
" NOTE: debian.vim sets 'nocompatible'. Setting 'compatible' changes numerous
|
||||||
|
" options, so any other options should be set AFTER setting 'compatible'.
|
||||||
|
"set compatible
|
||||||
|
|
||||||
|
" Vim5 and later versions support syntax highlighting. Uncommenting the next
|
||||||
|
" line enables syntax highlighting by default.
|
||||||
|
"syntax on
|
||||||
|
|
||||||
|
" If using a dark background within the editing area and syntax highlighting
|
||||||
|
" turn on this option as well
|
||||||
|
"set background=dark
|
||||||
|
|
||||||
|
" Uncomment the following to have Vim jump to the last position when
|
||||||
|
" reopening a file
|
||||||
|
"if has("autocmd")
|
||||||
|
" au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif
|
||||||
|
"endif
|
||||||
|
|
||||||
|
" Uncomment the following to have Vim load indentation rules and plugins
|
||||||
|
" according to the detected filetype.
|
||||||
|
"if has("autocmd")
|
||||||
|
" filetype plugin indent on
|
||||||
|
"endif
|
||||||
|
|
||||||
|
" The following are commented out as they cause vim to behave a lot
|
||||||
|
" differently from regular Vi. They are highly recommended though.
|
||||||
|
"set showcmd " Show (partial) command in status line.
|
||||||
|
"set showmatch " Show matching brackets.
|
||||||
|
"set ignorecase " Do case insensitive matching
|
||||||
|
"set smartcase " Do smart case matching
|
||||||
|
"set incsearch " Incremental search
|
||||||
|
"set autowrite " Automatically save before commands like :next and :make
|
||||||
|
"set hidden " Hide buffers when they are abandoned
|
||||||
|
"set mouse=a " Enable mouse usage (all modes)
|
||||||
|
|
||||||
|
" Source a global configuration file if available
|
||||||
|
if filereadable("/etc/vim/vimrc.local")
|
||||||
|
source /etc/vim/vimrc.local
|
||||||
|
endif
|
||||||
|
|
||||||
|
set tabstop=4
|
||||||
|
set ts=4
|
||||||
|
set sw=4
|
||||||
|
set nowrap
|
||||||
|
syntax enable
|
||||||
|
set ignorecase
|
||||||
854
vimrc-vincent
Normal file
854
vimrc-vincent
Normal file
@@ -0,0 +1,854 @@
|
|||||||
|
"
|
||||||
|
" Personal preference .vimrc file
|
||||||
|
" Maintained by Vincent Driessen <vincent@datafox.nl>
|
||||||
|
"
|
||||||
|
" My personally preferred version of vim is the one with the "big" feature
|
||||||
|
" set, in addition to the following configure options:
|
||||||
|
"
|
||||||
|
" ./configure --with-features=BIG
|
||||||
|
" --enable-pythoninterp --enable-rubyinterp
|
||||||
|
" --enable-enablemultibyte --enable-gui=no --with-x --enable-cscope
|
||||||
|
" --with-compiledby="Vincent Driessen <vincent@datafox.nl>"
|
||||||
|
" --prefix=/usr
|
||||||
|
"
|
||||||
|
" To start vim without using this .vimrc file, use:
|
||||||
|
" vim -u NORC
|
||||||
|
"
|
||||||
|
" To start vim without loading any .vimrc or plugins, use:
|
||||||
|
" vim -u NONE
|
||||||
|
"
|
||||||
|
|
||||||
|
" Use vim settings, rather then vi settings (much better!)
|
||||||
|
" This must be first, because it changes other options as a side effect.
|
||||||
|
set nocompatible
|
||||||
|
|
||||||
|
" Use pathogen to easily modify the runtime path to include all plugins under
|
||||||
|
" the ~/.vim/bundle directory
|
||||||
|
filetype off " force reloading *after* pathogen loaded
|
||||||
|
call pathogen#infect()
|
||||||
|
call pathogen#helptags()
|
||||||
|
filetype plugin indent on " enable detection, plugins and indenting in one step
|
||||||
|
syntax on
|
||||||
|
|
||||||
|
" Change shell
|
||||||
|
set shell=bash " Vim expects a POSIX-compliant shell, which Fish (my default shell) is not
|
||||||
|
|
||||||
|
" Change the mapleader from \ to ,
|
||||||
|
let mapleader=","
|
||||||
|
let maplocalleader="\\"
|
||||||
|
|
||||||
|
" Editing behaviour {{{
|
||||||
|
set showmode " always show what mode we're currently editing in
|
||||||
|
set nowrap " don't wrap lines
|
||||||
|
set tabstop=4 " a tab is four spaces
|
||||||
|
set softtabstop=4 " when hitting <BS>, pretend like a tab is removed, even if spaces
|
||||||
|
set expandtab " expand tabs by default (overloadable per file type later)
|
||||||
|
set shiftwidth=4 " number of spaces to use for autoindenting
|
||||||
|
set shiftround " use multiple of shiftwidth when indenting with '<' and '>'
|
||||||
|
set backspace=indent,eol,start " allow backspacing over everything in insert mode
|
||||||
|
set autoindent " always set autoindenting on
|
||||||
|
set copyindent " copy the previous indentation on autoindenting
|
||||||
|
set number " always show line numbers
|
||||||
|
set showmatch " set show matching parenthesis
|
||||||
|
set ignorecase " ignore case when searching
|
||||||
|
set smartcase " ignore case if search pattern is all lowercase,
|
||||||
|
" case-sensitive otherwise
|
||||||
|
set smarttab " insert tabs on the start of a line according to
|
||||||
|
" shiftwidth, not tabstop
|
||||||
|
set scrolloff=4 " keep 4 lines off the edges of the screen when scrolling
|
||||||
|
set virtualedit=all " allow the cursor to go in to "invalid" places
|
||||||
|
set hlsearch " highlight search terms
|
||||||
|
set incsearch " show search matches as you type
|
||||||
|
set gdefault " search/replace "globally" (on a line) by default
|
||||||
|
set listchars=tab:▸\ ,trail:·,extends:#,nbsp:·
|
||||||
|
|
||||||
|
set nolist " don't show invisible characters by default,
|
||||||
|
" but it is enabled for some file types (see later)
|
||||||
|
set pastetoggle=<F2> " when in insert mode, press <F2> to go to
|
||||||
|
" paste mode, where you can paste mass data
|
||||||
|
" that won't be autoindented
|
||||||
|
set mouse=a " enable using the mouse if terminal emulator
|
||||||
|
" supports it (xterm does)
|
||||||
|
set fileformats="unix,dos,mac"
|
||||||
|
set formatoptions+=1 " When wrapping paragraphs, don't end lines
|
||||||
|
" with 1-letter words (looks stupid)
|
||||||
|
|
||||||
|
set nrformats= " make <C-a> and <C-x> play well with
|
||||||
|
" zero-padded numbers (i.e. don't consider
|
||||||
|
" them octal or hex)
|
||||||
|
|
||||||
|
set shortmess+=I " hide the launch screen
|
||||||
|
set clipboard=unnamed " normal OS clipboard interaction
|
||||||
|
set autoread " automatically reload files changed outside of Vim
|
||||||
|
|
||||||
|
" Toggle show/hide invisible chars
|
||||||
|
nnoremap <leader>i :set list!<cr>
|
||||||
|
|
||||||
|
" Toggle line numbers
|
||||||
|
nnoremap <leader>N :setlocal number!<cr>
|
||||||
|
|
||||||
|
" Thanks to Steve Losh for this liberating tip
|
||||||
|
" See http://stevelosh.com/blog/2010/09/coming-home-to-vim
|
||||||
|
nnoremap / /\v
|
||||||
|
vnoremap / /\v
|
||||||
|
|
||||||
|
" Speed up scrolling of the viewport slightly
|
||||||
|
nnoremap <C-e> 2<C-e>
|
||||||
|
nnoremap <C-y> 2<C-y>
|
||||||
|
" }}}
|
||||||
|
|
||||||
|
" Folding rules {{{
|
||||||
|
set foldenable " enable folding
|
||||||
|
set foldcolumn=2 " add a fold column
|
||||||
|
set foldmethod=marker " detect triple-{ style fold markers
|
||||||
|
set foldlevelstart=99 " start out with everything unfolded
|
||||||
|
set foldopen=block,hor,insert,jump,mark,percent,quickfix,search,tag,undo
|
||||||
|
" which commands trigger auto-unfold
|
||||||
|
function! MyFoldText()
|
||||||
|
let line = getline(v:foldstart)
|
||||||
|
|
||||||
|
let nucolwidth = &fdc + &number * &numberwidth
|
||||||
|
let windowwidth = winwidth(0) - nucolwidth - 3
|
||||||
|
let foldedlinecount = v:foldend - v:foldstart
|
||||||
|
|
||||||
|
" expand tabs into spaces
|
||||||
|
let onetab = strpart(' ', 0, &tabstop)
|
||||||
|
let line = substitute(line, '\t', onetab, 'g')
|
||||||
|
|
||||||
|
let line = strpart(line, 0, windowwidth - 2 -len(foldedlinecount))
|
||||||
|
let fillcharcount = windowwidth - len(line) - len(foldedlinecount) - 4
|
||||||
|
return line . ' …' . repeat(" ",fillcharcount) . foldedlinecount . ' '
|
||||||
|
endfunction
|
||||||
|
set foldtext=MyFoldText()
|
||||||
|
|
||||||
|
" Mappings to easily toggle fold levels
|
||||||
|
nnoremap z0 :set foldlevel=0<cr>
|
||||||
|
nnoremap z1 :set foldlevel=1<cr>
|
||||||
|
nnoremap z2 :set foldlevel=2<cr>
|
||||||
|
nnoremap z3 :set foldlevel=3<cr>
|
||||||
|
nnoremap z4 :set foldlevel=4<cr>
|
||||||
|
nnoremap z5 :set foldlevel=5<cr>
|
||||||
|
" }}}
|
||||||
|
|
||||||
|
" Editor layout {{{
|
||||||
|
set termencoding=utf-8
|
||||||
|
set encoding=utf-8
|
||||||
|
set lazyredraw " don't update the display while executing macros
|
||||||
|
set laststatus=2 " tell VIM to always put a status line in, even
|
||||||
|
" if there is only one window
|
||||||
|
set cmdheight=2 " use a status bar that is 2 rows high
|
||||||
|
" }}}
|
||||||
|
|
||||||
|
" Vim behaviour {{{
|
||||||
|
set hidden " hide buffers instead of closing them this
|
||||||
|
" means that the current buffer can be put
|
||||||
|
" to background without being written; and
|
||||||
|
" that marks and undo history are preserved
|
||||||
|
set switchbuf=useopen " reveal already opened files from the
|
||||||
|
" quickfix window instead of opening new
|
||||||
|
" buffers
|
||||||
|
set history=1000 " remember more commands and search history
|
||||||
|
set undolevels=1000 " use many muchos levels of undo
|
||||||
|
if v:version >= 730
|
||||||
|
set undofile " keep a persistent backup file
|
||||||
|
set undodir=~/.vim/.undo,~/tmp,/tmp
|
||||||
|
endif
|
||||||
|
set nobackup " do not keep backup files, it's 70's style cluttering
|
||||||
|
set noswapfile " do not write annoying intermediate swap files,
|
||||||
|
" who did ever restore from swap files anyway?
|
||||||
|
set directory=~/.vim/.tmp,~/tmp,/tmp
|
||||||
|
" store swap files in one of these directories
|
||||||
|
" (in case swapfile is ever turned on)
|
||||||
|
set viminfo='20,\"80 " read/write a .viminfo file, don't store more
|
||||||
|
" than 80 lines of registers
|
||||||
|
set wildmenu " make tab completion for files/buffers act like bash
|
||||||
|
set wildmode=list:full " show a list when pressing tab and complete
|
||||||
|
" first full match
|
||||||
|
set wildignore=*.swp,*.bak,*.pyc,*.class
|
||||||
|
set title " change the terminal's title
|
||||||
|
set visualbell " don't beep
|
||||||
|
set noerrorbells " don't beep
|
||||||
|
set showcmd " show (partial) command in the last line of the screen
|
||||||
|
" this also shows visual selection info
|
||||||
|
set nomodeline " disable mode lines (security measure)
|
||||||
|
"set ttyfast " always use a fast terminal
|
||||||
|
set cursorline " underline the current line, for quick orientation
|
||||||
|
" }}}
|
||||||
|
|
||||||
|
" Toggle the quickfix window {{{
|
||||||
|
" From Steve Losh, http://learnvimscriptthehardway.stevelosh.com/chapters/38.html
|
||||||
|
nnoremap <C-q> :call <SID>QuickfixToggle()<cr>
|
||||||
|
|
||||||
|
let g:quickfix_is_open = 0
|
||||||
|
|
||||||
|
function! s:QuickfixToggle()
|
||||||
|
if g:quickfix_is_open
|
||||||
|
cclose
|
||||||
|
let g:quickfix_is_open = 0
|
||||||
|
execute g:quickfix_return_to_window . "wincmd w"
|
||||||
|
else
|
||||||
|
let g:quickfix_return_to_window = winnr()
|
||||||
|
copen
|
||||||
|
let g:quickfix_is_open = 1
|
||||||
|
endif
|
||||||
|
endfunction
|
||||||
|
" }}}
|
||||||
|
|
||||||
|
" Toggle the foldcolumn {{{
|
||||||
|
nnoremap <leader>f :call FoldColumnToggle()<cr>
|
||||||
|
|
||||||
|
let g:last_fold_column_width = 4 " Pick a sane default for the foldcolumn
|
||||||
|
|
||||||
|
function! FoldColumnToggle()
|
||||||
|
if &foldcolumn
|
||||||
|
let g:last_fold_column_width = &foldcolumn
|
||||||
|
setlocal foldcolumn=0
|
||||||
|
else
|
||||||
|
let &l:foldcolumn = g:last_fold_column_width
|
||||||
|
endif
|
||||||
|
endfunction
|
||||||
|
" }}}
|
||||||
|
|
||||||
|
" Highlighting {{{
|
||||||
|
if &t_Co > 2 || has("gui_running")
|
||||||
|
syntax on " switch syntax highlighting on, when the terminal has colors
|
||||||
|
endif
|
||||||
|
" }}}
|
||||||
|
|
||||||
|
" Shortcut mappings {{{
|
||||||
|
" Since I never use the ; key anyway, this is a real optimization for almost
|
||||||
|
" all Vim commands, as I don't have to press the Shift key to form chords to
|
||||||
|
" enter ex mode.
|
||||||
|
nnoremap ; :
|
||||||
|
nnoremap <leader>; ;
|
||||||
|
|
||||||
|
" Avoid accidental hits of <F1> while aiming for <Esc>
|
||||||
|
noremap! <F1> <Esc>
|
||||||
|
|
||||||
|
nnoremap <leader>Q :q<CR> " Quickly close the current window
|
||||||
|
nnoremap <leader>q :bd<CR> " Quickly close the current buffer
|
||||||
|
|
||||||
|
" Use Q for formatting the current paragraph (or visual selection)
|
||||||
|
vnoremap Q gq
|
||||||
|
nnoremap Q gqap
|
||||||
|
" set breakindent on " keep paragraph indentation when re-wrapping text
|
||||||
|
|
||||||
|
" Sort paragraphs
|
||||||
|
vnoremap <leader>s !sort -f<CR>gv
|
||||||
|
nnoremap <leader>s vip!sort -f<CR><Esc>
|
||||||
|
|
||||||
|
" make p in Visual mode replace the selected text with the yank register
|
||||||
|
vnoremap p <Esc>:let current_reg = @"<CR>gvdi<C-R>=current_reg<CR><Esc>
|
||||||
|
|
||||||
|
" Shortcut to make
|
||||||
|
nnoremap mk :make<CR>
|
||||||
|
|
||||||
|
" Swap implementations of ` and ' jump to markers
|
||||||
|
" By default, ' jumps to the marked line, ` jumps to the marked line and
|
||||||
|
" column, so swap them
|
||||||
|
nnoremap ' `
|
||||||
|
nnoremap ` '
|
||||||
|
|
||||||
|
" Use the damn hjkl keys
|
||||||
|
" noremap <up> <nop>
|
||||||
|
" noremap <down> <nop>
|
||||||
|
" noremap <left> <nop>
|
||||||
|
" noremap <right> <nop>
|
||||||
|
|
||||||
|
" Remap j and k to act as expected when used on long, wrapped, lines
|
||||||
|
nnoremap j gj
|
||||||
|
nnoremap k gk
|
||||||
|
|
||||||
|
" Easy window navigation
|
||||||
|
noremap <C-h> <C-w>h
|
||||||
|
noremap <C-j> <C-w>j
|
||||||
|
noremap <C-k> <C-w>k
|
||||||
|
noremap <C-l> <C-w>l
|
||||||
|
nnoremap <leader>w <C-w>v<C-w>l
|
||||||
|
|
||||||
|
" Complete whole filenames/lines with a quicker shortcut key in insert mode
|
||||||
|
inoremap <C-f> <C-x><C-f>
|
||||||
|
inoremap <C-l> <C-x><C-l>
|
||||||
|
|
||||||
|
" Use ,d (or ,dd or ,dj or 20,dd) to delete a line without adding it to the
|
||||||
|
" yanked stack (also, in visual mode)
|
||||||
|
nnoremap <silent> <leader>d "_d
|
||||||
|
vnoremap <silent> <leader>d "_d
|
||||||
|
|
||||||
|
" Quick yanking to the end of the line
|
||||||
|
nnoremap Y y$
|
||||||
|
|
||||||
|
" YankRing stuff
|
||||||
|
let g:yankring_history_dir = '$HOME/.vim/.tmp'
|
||||||
|
nnoremap <leader>r :YRShow<CR>
|
||||||
|
|
||||||
|
" Edit the vimrc file
|
||||||
|
nnoremap <silent> <leader>ev :e $MYVIMRC<CR>
|
||||||
|
nnoremap <silent> <leader>sv :so $MYVIMRC<CR>
|
||||||
|
|
||||||
|
" Clears the search register
|
||||||
|
nnoremap <silent> <leader>/ :nohlsearch<CR>
|
||||||
|
|
||||||
|
" Pull word under cursor into LHS of a substitute (for quick search and
|
||||||
|
" replace)
|
||||||
|
nnoremap <leader>z :%s#\<<C-r>=expand("<cword>")<CR>\>#
|
||||||
|
|
||||||
|
" Keep search matches in the middle of the window and pulse the line when moving
|
||||||
|
" to them.
|
||||||
|
nnoremap n n:call PulseCursorLine()<cr>
|
||||||
|
nnoremap N N:call PulseCursorLine()<cr>
|
||||||
|
|
||||||
|
" Quickly get out of insert mode without your fingers having to leave the
|
||||||
|
" home row (either use 'jj' or 'jk')
|
||||||
|
inoremap jj <Esc>
|
||||||
|
|
||||||
|
" Quick alignment of text
|
||||||
|
" nnoremap <leader>al :left<CR>
|
||||||
|
" nnoremap <leader>ar :right<CR>
|
||||||
|
" nnoremap <leader>ac :center<CR>
|
||||||
|
|
||||||
|
" Sudo to write
|
||||||
|
cnoremap w!! w !sudo tee % >/dev/null
|
||||||
|
|
||||||
|
" Ctrl+W to redraw
|
||||||
|
nnoremap <C-w> :redraw!<cr>
|
||||||
|
|
||||||
|
" Jump to matching pairs easily, with Tab
|
||||||
|
nnoremap <Tab> %
|
||||||
|
vnoremap <Tab> %
|
||||||
|
|
||||||
|
" Folding
|
||||||
|
nnoremap <Space> za
|
||||||
|
vnoremap <Space> za
|
||||||
|
|
||||||
|
" Strip all trailing whitespace from a file, using ,W
|
||||||
|
nnoremap <leader>W :%s/\s\+$//<CR>:let @/=''<CR>
|
||||||
|
|
||||||
|
" Use The Silver Searcher over grep, iff possible
|
||||||
|
if executable('ag')
|
||||||
|
" Use ag over grep
|
||||||
|
set grepprg=ag\ --nogroup\ --nocolor
|
||||||
|
|
||||||
|
" Use ag in CtrlP for listing files. Lightning fast and respects .gitignore
|
||||||
|
let g:ctrlp_user_command = 'ag %s -l --nocolor -g ""'
|
||||||
|
|
||||||
|
" ag is fast enough that CtrlP doesn't need to cache
|
||||||
|
let g:ctrlp_use_caching = 0
|
||||||
|
endif
|
||||||
|
|
||||||
|
" grep/Ack/Ag for the word under cursor
|
||||||
|
vnoremap <leader>a y:grep! "\b<c-r>"\b"<cr>:cw<cr>
|
||||||
|
nnoremap <leader>a :grep! "\b<c-r><c-w>\b"
|
||||||
|
nnoremap K *N:grep! "\b<c-r><c-w>\b"<cr>:cw<cr>
|
||||||
|
|
||||||
|
" Allow quick additions to the spelling dict
|
||||||
|
nnoremap <leader>g :spellgood <c-r><c-w>
|
||||||
|
|
||||||
|
" Define "Ag" command
|
||||||
|
command -nargs=+ -complete=file -bar Ag silent! grep! <args> | cwindow | redraw!
|
||||||
|
|
||||||
|
" bind \ (backward slash) to grep shortcut
|
||||||
|
nnoremap \ :Ag<SPACE>
|
||||||
|
|
||||||
|
" Creating folds for tags in HTML
|
||||||
|
"nnoremap <leader>ft Vatzf
|
||||||
|
|
||||||
|
" Reselect text that was just pasted with ,v
|
||||||
|
nnoremap <leader>v V`]
|
||||||
|
|
||||||
|
" Gundo.vim
|
||||||
|
nnoremap <F5> :GundoToggle<CR>
|
||||||
|
" }}}
|
||||||
|
|
||||||
|
" NERDTree settings {{{
|
||||||
|
nnoremap <leader>n :NERDTreeFocus<CR>
|
||||||
|
nnoremap <leader>m :NERDTreeClose<CR>:NERDTreeFind<CR>
|
||||||
|
nnoremap <leader>N :NERDTreeClose<CR>
|
||||||
|
|
||||||
|
" Store the bookmarks file
|
||||||
|
let NERDTreeBookmarksFile=expand("$HOME/.vim/NERDTreeBookmarks")
|
||||||
|
|
||||||
|
" Show the bookmarks table on startup
|
||||||
|
let NERDTreeShowBookmarks=1
|
||||||
|
|
||||||
|
" Show hidden files, too
|
||||||
|
let NERDTreeShowFiles=1
|
||||||
|
let NERDTreeShowHidden=1
|
||||||
|
|
||||||
|
" Quit on opening files from the tree
|
||||||
|
let NERDTreeQuitOnOpen=1
|
||||||
|
|
||||||
|
" Highlight the selected entry in the tree
|
||||||
|
let NERDTreeHighlightCursorline=1
|
||||||
|
|
||||||
|
" Use a single click to fold/unfold directories and a double click to open
|
||||||
|
" files
|
||||||
|
let NERDTreeMouseMode=2
|
||||||
|
|
||||||
|
" Don't display these kinds of files
|
||||||
|
let NERDTreeIgnore=[ '\.pyc$', '\.pyo$', '\.py\$class$', '\.obj$',
|
||||||
|
\ '\.o$', '\.so$', '\.egg$', '^\.git$' ]
|
||||||
|
|
||||||
|
" }}}
|
||||||
|
|
||||||
|
" TagList settings {{{
|
||||||
|
nnoremap <leader>l :TlistClose<CR>:TlistToggle<CR>
|
||||||
|
nnoremap <leader>L :TlistClose<CR>
|
||||||
|
|
||||||
|
" quit Vim when the TagList window is the last open window
|
||||||
|
let Tlist_Exit_OnlyWindow=1 " quit when TagList is the last open window
|
||||||
|
let Tlist_GainFocus_On_ToggleOpen=1 " put focus on the TagList window when it opens
|
||||||
|
"let Tlist_Process_File_Always=1 " process files in the background, even when the TagList window isn't open
|
||||||
|
"let Tlist_Show_One_File=1 " only show tags from the current buffer, not all open buffers
|
||||||
|
let Tlist_WinWidth=40 " set the width
|
||||||
|
let Tlist_Inc_Winwidth=1 " increase window by 1 when growing
|
||||||
|
|
||||||
|
" shorten the time it takes to highlight the current tag (default is 4 secs)
|
||||||
|
" note that this setting influences Vim's behaviour when saving swap files,
|
||||||
|
" but we have already turned off swap files (earlier)
|
||||||
|
"set updatetime=1000
|
||||||
|
|
||||||
|
" the default ctags in /usr/bin on the Mac is GNU ctags, so change it to the
|
||||||
|
" exuberant ctags version in /usr/local/bin
|
||||||
|
let Tlist_Ctags_Cmd = '/usr/local/bin/ctags'
|
||||||
|
|
||||||
|
" show function/method prototypes in the list
|
||||||
|
let Tlist_Display_Prototype=1
|
||||||
|
|
||||||
|
" don't show scope info
|
||||||
|
let Tlist_Display_Tag_Scope=0
|
||||||
|
|
||||||
|
" show TagList window on the right
|
||||||
|
let Tlist_Use_Right_Window=1
|
||||||
|
|
||||||
|
" }}}
|
||||||
|
|
||||||
|
" vim-flake8 default configuration
|
||||||
|
let g:flake8_show_in_gutter=1
|
||||||
|
|
||||||
|
" Conflict markers {{{
|
||||||
|
" highlight conflict markers
|
||||||
|
match ErrorMsg '^\(<\|=\|>\)\{7\}\([^=].\+\)\?$'
|
||||||
|
|
||||||
|
" shortcut to jump to next conflict marker
|
||||||
|
nnoremap <silent> <leader>c /^\(<\\|=\\|>\)\{7\}\([^=].\+\)\?$<CR>
|
||||||
|
" }}}
|
||||||
|
|
||||||
|
" Filetype specific handling {{{
|
||||||
|
" only do this part when compiled with support for autocommands
|
||||||
|
if has("autocmd")
|
||||||
|
augroup invisible_chars "{{{
|
||||||
|
au!
|
||||||
|
|
||||||
|
" Show invisible characters in all of these files
|
||||||
|
autocmd filetype vim setlocal list
|
||||||
|
autocmd filetype python,rst setlocal list
|
||||||
|
autocmd filetype ruby setlocal list
|
||||||
|
autocmd filetype javascript,css setlocal list
|
||||||
|
augroup end "}}}
|
||||||
|
|
||||||
|
augroup vim_files "{{{
|
||||||
|
au!
|
||||||
|
|
||||||
|
" Bind <F1> to show the keyword under cursor
|
||||||
|
" general help can still be entered manually, with :h
|
||||||
|
autocmd filetype vim noremap <buffer> <F1> <Esc>:help <C-r><C-w><CR>
|
||||||
|
autocmd filetype vim noremap! <buffer> <F1> <Esc>:help <C-r><C-w><CR>
|
||||||
|
augroup end "}}}
|
||||||
|
|
||||||
|
augroup html_files "{{{
|
||||||
|
au!
|
||||||
|
|
||||||
|
" This function detects, based on HTML content, whether this is a
|
||||||
|
" Django template, or a plain HTML file, and sets filetype accordingly
|
||||||
|
fun! s:DetectHTMLVariant()
|
||||||
|
let n = 1
|
||||||
|
while n < 50 && n < line("$")
|
||||||
|
" check for django
|
||||||
|
if getline(n) =~ '{%\s*\(extends\|load\|block\|if\|for\|include\|trans\)\>'
|
||||||
|
set ft=htmldjango.html
|
||||||
|
return
|
||||||
|
endif
|
||||||
|
let n = n + 1
|
||||||
|
endwhile
|
||||||
|
" go with html
|
||||||
|
set ft=html
|
||||||
|
endfun
|
||||||
|
|
||||||
|
" Auto-tidy selection
|
||||||
|
vnoremap <leader>x :!tidy -q -i --show-errors 0 --show-body-only 1 --wrap 0<cr><cr>
|
||||||
|
|
||||||
|
autocmd BufNewFile,BufRead *.html,*.htm,*.j2 call s:DetectHTMLVariant()
|
||||||
|
|
||||||
|
" Auto-closing of HTML/XML tags
|
||||||
|
let g:closetag_default_xml=1
|
||||||
|
autocmd filetype html,htmldjango let b:closetag_html_style=1
|
||||||
|
autocmd filetype html,xhtml,xml source ~/.vim/scripts/closetag.vim
|
||||||
|
augroup end " }}}
|
||||||
|
|
||||||
|
augroup python_files "{{{
|
||||||
|
au!
|
||||||
|
|
||||||
|
" This function detects, based on Python content, whether this is a
|
||||||
|
" Django file, which may enabling snippet completion for it
|
||||||
|
fun! s:DetectPythonVariant()
|
||||||
|
let n = 1
|
||||||
|
while n < 50 && n < line("$")
|
||||||
|
" check for django
|
||||||
|
if getline(n) =~ 'import\s\+\<django\>' || getline(n) =~ 'from\s\+\<django\>\s\+import'
|
||||||
|
set ft=python.django
|
||||||
|
"set syntax=python
|
||||||
|
return
|
||||||
|
endif
|
||||||
|
let n = n + 1
|
||||||
|
endwhile
|
||||||
|
" go with html
|
||||||
|
set ft=python
|
||||||
|
endfun
|
||||||
|
autocmd BufNewFile,BufRead *.py call s:DetectPythonVariant()
|
||||||
|
|
||||||
|
" PEP8 compliance (set 1 tab = 4 chars explicitly, even if set
|
||||||
|
" earlier, as it is important)
|
||||||
|
autocmd filetype python setlocal textwidth=78
|
||||||
|
autocmd filetype python match ErrorMsg '\%>120v.\+'
|
||||||
|
|
||||||
|
" But disable autowrapping as it is super annoying
|
||||||
|
autocmd filetype python setlocal formatoptions-=t
|
||||||
|
|
||||||
|
" Folding for Python (uses syntax/python.vim for fold definitions)
|
||||||
|
"autocmd filetype python,rst setlocal nofoldenable
|
||||||
|
"autocmd filetype python setlocal foldmethod=expr
|
||||||
|
|
||||||
|
" Python runners
|
||||||
|
autocmd filetype python noremap <buffer> <F5> :w<CR>:!python %<CR>
|
||||||
|
autocmd filetype python inoremap <buffer> <F5> <Esc>:w<CR>:!python %<CR>
|
||||||
|
autocmd filetype python noremap <buffer> <S-F5> :w<CR>:!ipython %<CR>
|
||||||
|
autocmd filetype python inoremap <buffer> <S-F5> <Esc>:w<CR>:!ipython %<CR>
|
||||||
|
|
||||||
|
" Toggling True/False
|
||||||
|
autocmd filetype python nnoremap <silent> <C-t> mmviw:s/True\\|False/\={'True':'False','False':'True'}[submatch(0)]/<CR>`m:nohlsearch<CR>
|
||||||
|
|
||||||
|
" Run a quick static syntax check every time we save a Python file
|
||||||
|
autocmd BufWritePost *.py call Flake8()
|
||||||
|
|
||||||
|
" Defer to isort for sorting headers (instead of using Unix sort)
|
||||||
|
autocmd filetype python nnoremap <leader>s :Isort<cr>
|
||||||
|
augroup end " }}}
|
||||||
|
|
||||||
|
augroup supervisord_files "{{{
|
||||||
|
au!
|
||||||
|
|
||||||
|
autocmd BufNewFile,BufRead supervisord.conf set ft=dosini
|
||||||
|
augroup end " }}}
|
||||||
|
|
||||||
|
augroup markdown_files "{{{
|
||||||
|
au!
|
||||||
|
|
||||||
|
autocmd filetype markdown noremap <buffer> <leader>p :w<CR>:!open -a Marked %<CR><CR>
|
||||||
|
augroup end " }}}
|
||||||
|
|
||||||
|
augroup ruby_files "{{{
|
||||||
|
au!
|
||||||
|
|
||||||
|
augroup end " }}}
|
||||||
|
|
||||||
|
augroup rst_files "{{{
|
||||||
|
au!
|
||||||
|
|
||||||
|
" Auto-wrap text around 74 chars
|
||||||
|
autocmd filetype rst setlocal textwidth=74
|
||||||
|
autocmd filetype rst setlocal formatoptions+=nqt
|
||||||
|
autocmd filetype rst match ErrorMsg '\%>74v.\+'
|
||||||
|
augroup end " }}}
|
||||||
|
|
||||||
|
augroup css_files "{{{
|
||||||
|
au!
|
||||||
|
|
||||||
|
autocmd filetype css,less setlocal foldmethod=marker foldmarker={,}
|
||||||
|
augroup end "}}}
|
||||||
|
|
||||||
|
augroup javascript_files "{{{
|
||||||
|
au!
|
||||||
|
|
||||||
|
autocmd filetype javascript setlocal expandtab
|
||||||
|
autocmd filetype javascript setlocal listchars=trail:·,extends:#,nbsp:·
|
||||||
|
autocmd filetype javascript setlocal foldmethod=marker foldmarker={,}
|
||||||
|
|
||||||
|
" Toggling True/False
|
||||||
|
autocmd filetype javascript nnoremap <silent> <C-t> mmviw:s/true\\|false/\={'true':'false','false':'true'}[submatch(0)]/<CR>`m:nohlsearch<CR>
|
||||||
|
|
||||||
|
" Enable insertion of "debugger" statement in JS files
|
||||||
|
autocmd filetype javascript nnoremap <leader>b Odebugger;<esc>
|
||||||
|
augroup end "}}}
|
||||||
|
|
||||||
|
augroup textile_files "{{{
|
||||||
|
au!
|
||||||
|
|
||||||
|
autocmd filetype textile set tw=78 wrap
|
||||||
|
|
||||||
|
" Render YAML front matter inside Textile documents as comments
|
||||||
|
autocmd filetype textile syntax region frontmatter start=/\%^---$/ end=/^---$/
|
||||||
|
autocmd filetype textile highlight link frontmatter Comment
|
||||||
|
augroup end "}}}
|
||||||
|
endif
|
||||||
|
" }}}
|
||||||
|
|
||||||
|
" Skeleton processing {{{
|
||||||
|
|
||||||
|
if has("autocmd")
|
||||||
|
|
||||||
|
"if !exists('*LoadTemplate')
|
||||||
|
"function LoadTemplate(file)
|
||||||
|
"" Add skeleton fillings for Python (normal and unittest) files
|
||||||
|
"if a:file =~ 'test_.*\.py$'
|
||||||
|
"execute "0r ~/.vim/skeleton/test_template.py"
|
||||||
|
"elseif a:file =~ '.*\.py$'
|
||||||
|
"execute "0r ~/.vim/skeleton/template.py"
|
||||||
|
"endif
|
||||||
|
"endfunction
|
||||||
|
"endif
|
||||||
|
|
||||||
|
"autocmd BufNewFile * call LoadTemplate(@%)
|
||||||
|
|
||||||
|
endif " has("autocmd")
|
||||||
|
|
||||||
|
" }}}
|
||||||
|
|
||||||
|
" Restore cursor position upon reopening files {{{
|
||||||
|
autocmd BufReadPost *
|
||||||
|
\ if line("'\"") > 0 && line("'\"") <= line("$") |
|
||||||
|
\ exe "normal! g`\"" |
|
||||||
|
\ endif
|
||||||
|
" }}}
|
||||||
|
|
||||||
|
" Common abbreviations / misspellings {{{
|
||||||
|
source ~/.vim/autocorrect.vim
|
||||||
|
" }}}
|
||||||
|
|
||||||
|
" Extra vi-compatibility {{{
|
||||||
|
" set extra vi-compatible options
|
||||||
|
set cpoptions+=$ " when changing a line, don't redisplay, but put a '$' at
|
||||||
|
" the end during the change
|
||||||
|
set formatoptions-=o " don't start new lines w/ comment leader on pressing 'o'
|
||||||
|
au filetype vim set formatoptions-=o
|
||||||
|
" somehow, during vim filetype detection, this gets set
|
||||||
|
" for vim files, so explicitly unset it again
|
||||||
|
" }}}
|
||||||
|
|
||||||
|
" Extra user or machine specific settings {{{
|
||||||
|
source ~/.vim/user.vim
|
||||||
|
" }}}
|
||||||
|
|
||||||
|
" Creating underline/overline headings for markup languages
|
||||||
|
" Inspired by http://sphinx.pocoo.org/rest.html#sections
|
||||||
|
nnoremap <leader>1 yyPVr=jyypVr=
|
||||||
|
nnoremap <leader>2 yyPVr*jyypVr*
|
||||||
|
nnoremap <leader>3 yypVr=
|
||||||
|
nnoremap <leader>4 yypVr-
|
||||||
|
nnoremap <leader>5 yypVr^
|
||||||
|
nnoremap <leader>6 yypVr"
|
||||||
|
|
||||||
|
iab lorem Lorem ipsum dolor sit amet, consectetur adipiscing elit
|
||||||
|
iab llorem Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam lacus ligula, accumsan id imperdiet rhoncus, dapibus vitae arcu. Nulla non quam erat, luctus consequat nisi
|
||||||
|
iab lllorem Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam lacus ligula, accumsan id imperdiet rhoncus, dapibus vitae arcu. Nulla non quam erat, luctus consequat nisi. Integer hendrerit lacus sagittis erat fermentum tincidunt. Cras vel dui neque. In sagittis commodo luctus. Mauris non metus dolor, ut suscipit dui. Aliquam mauris lacus, laoreet et consequat quis, bibendum id ipsum. Donec gravida, diam id imperdiet cursus, nunc nisl bibendum sapien, eget tempor neque elit in tortor
|
||||||
|
|
||||||
|
"set guifont=Anonymous\ for\ Powerline:h12 linespace=2
|
||||||
|
"set guifont=Droid\ Sans\ Mono:h14 linespace=0
|
||||||
|
"set guifont=Mensch\ for\ Powerline:h14 linespace=0
|
||||||
|
"set guifont=saxMono:h14 linespace=3
|
||||||
|
"set guifont=Ubuntu\ Mono:h18 linespace=3
|
||||||
|
set guifont=Source\ Code\ Pro\ Light:h10 linespace=0
|
||||||
|
if has("gui_running")
|
||||||
|
|
||||||
|
"colorscheme molokai
|
||||||
|
"colorscheme railscat
|
||||||
|
"colorscheme kellys
|
||||||
|
"colorscheme wombat256
|
||||||
|
"colorscheme mustang
|
||||||
|
"colorscheme mustang_silent
|
||||||
|
"colorscheme badwolf
|
||||||
|
"colorscheme jellybeans
|
||||||
|
|
||||||
|
" Remove toolbar, left scrollbar and right scrollbar
|
||||||
|
set guioptions-=T
|
||||||
|
set guioptions-=l
|
||||||
|
set guioptions-=L
|
||||||
|
set guioptions-=r
|
||||||
|
set guioptions-=R
|
||||||
|
else
|
||||||
|
set bg=dark
|
||||||
|
|
||||||
|
"colorscheme molokai
|
||||||
|
"colorscheme railscat
|
||||||
|
"colorscheme molokai_deep
|
||||||
|
"colorscheme wombat256
|
||||||
|
"colorscheme mustang
|
||||||
|
"colorscheme mustang_silent
|
||||||
|
"colorscheme badwolf
|
||||||
|
colorscheme jellybeans
|
||||||
|
endif
|
||||||
|
|
||||||
|
" Pulse ------------------------------------------------------------------- {{{
|
||||||
|
|
||||||
|
function! PulseCursorLine()
|
||||||
|
let current_window = winnr()
|
||||||
|
|
||||||
|
windo set nocursorline
|
||||||
|
execute current_window . 'wincmd w'
|
||||||
|
|
||||||
|
setlocal cursorline
|
||||||
|
|
||||||
|
redir => old_hi
|
||||||
|
silent execute 'hi CursorLine'
|
||||||
|
redir END
|
||||||
|
let old_hi = split(old_hi, '\n')[0]
|
||||||
|
let old_hi = substitute(old_hi, 'xxx', '', '')
|
||||||
|
|
||||||
|
hi CursorLine guibg=#3a3a3a
|
||||||
|
redraw
|
||||||
|
sleep 20m
|
||||||
|
|
||||||
|
hi CursorLine guibg=#4a4a4a
|
||||||
|
redraw
|
||||||
|
sleep 30m
|
||||||
|
|
||||||
|
hi CursorLine guibg=#3a3a3a
|
||||||
|
redraw
|
||||||
|
sleep 30m
|
||||||
|
|
||||||
|
hi CursorLine guibg=#2a2a2a
|
||||||
|
redraw
|
||||||
|
sleep 20m
|
||||||
|
|
||||||
|
execute 'hi ' . old_hi
|
||||||
|
|
||||||
|
windo set cursorline
|
||||||
|
execute current_window . 'wincmd w'
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" }}}
|
||||||
|
|
||||||
|
" Powerline configuration ------------------------------------------------- {{{
|
||||||
|
|
||||||
|
let g:Powerline_symbols = 'compatible'
|
||||||
|
"let g:Powerline_symbols = 'fancy'
|
||||||
|
|
||||||
|
" }}}
|
||||||
|
|
||||||
|
" Python mode configuration ----------------------------------------------- {{{
|
||||||
|
|
||||||
|
" Don't run pylint on every save
|
||||||
|
let g:pymode = 0
|
||||||
|
let g:pymode_breakpoint = 0
|
||||||
|
let g:pymode_breakpoint_bind = '<leader>b'
|
||||||
|
let g:pymode_doc = 0
|
||||||
|
let g:pymode_doc_bind = 'K'
|
||||||
|
let g:pymode_folding = 0
|
||||||
|
let g:pymode_indent = 0
|
||||||
|
let g:pymode_lint = 0
|
||||||
|
let g:pymode_lint_checkers = ['pyflakes', 'pep8', 'mccabe']
|
||||||
|
let g:pymode_lint_cwindow = 1
|
||||||
|
let g:pymode_lint_ignore = ''
|
||||||
|
let g:pymode_lint_message = 1
|
||||||
|
let g:pymode_lint_on_fly = 0
|
||||||
|
let g:pymode_lint_on_write = 0
|
||||||
|
let g:pymode_lint_select = ''
|
||||||
|
let g:pymode_lint_signs = 1
|
||||||
|
let g:pymode_motion = 0
|
||||||
|
let g:pymode_options = 0
|
||||||
|
let g:pymode_paths = []
|
||||||
|
let g:pymode_quickfix_maxheight = 6
|
||||||
|
let g:pymode_quickfix_minheight = 3
|
||||||
|
let g:pymode_rope = 0
|
||||||
|
let g:pymode_run = 0
|
||||||
|
let g:pymode_run_bind = '<leader>r'
|
||||||
|
let g:pymode_trim_whitespaces = 0
|
||||||
|
|
||||||
|
" }}}
|
||||||
|
|
||||||
|
" Linters configuration -------------------------------------------------- {{{
|
||||||
|
|
||||||
|
" Don't run linters for Python (conflicts with vim-flake8 and lint.vim plugins)
|
||||||
|
let g:linters_disabled_filetypes = ['python', 'html']
|
||||||
|
|
||||||
|
" To add more linters, do this:
|
||||||
|
"
|
||||||
|
" let g:linters_extra = []
|
||||||
|
|
||||||
|
" if executable('jshint')
|
||||||
|
" let g:linters_extra += [
|
||||||
|
" \ ['javascript', 'jshint %s > %s', ["%f: line %l, col %c, %m"]],
|
||||||
|
" \]
|
||||||
|
" endif
|
||||||
|
|
||||||
|
" }}}
|
||||||
|
|
||||||
|
" Ignore common directories
|
||||||
|
let g:ctrlp_custom_ignore = {
|
||||||
|
\ 'dir': 'node_modules\|bower_components',
|
||||||
|
\ }
|
||||||
|
|
||||||
|
" Invoke CtrlP, but CommandT style
|
||||||
|
nnoremap <leader>t :CtrlP<cr>
|
||||||
|
nnoremap <leader>. :CtrlPTag<cr>
|
||||||
|
nnoremap <leader>b :CtrlPBuffer<cr>
|
||||||
|
|
||||||
|
" Learn Vim Script the Hard Way Exercises
|
||||||
|
"noremap - ddp
|
||||||
|
"noremap _ ddkP
|
||||||
|
|
||||||
|
" C-U in insert/normal mode, to uppercase the word under cursor
|
||||||
|
inoremap <c-u> <esc>viwUea
|
||||||
|
nnoremap <c-u> viwUe
|
||||||
|
|
||||||
|
iabbr m@@ me@nvie.com
|
||||||
|
iabbr v@@ vincent@3rdcloud.com
|
||||||
|
iabbr ssig --<cr>Vincent Driessen<cr>vincent@3rdcloud.com
|
||||||
|
|
||||||
|
" Quote words under cursor
|
||||||
|
nnoremap <leader>" viW<esc>a"<esc>gvo<esc>i"<esc>gvo<esc>3l
|
||||||
|
nnoremap <leader>' viW<esc>a'<esc>gvo<esc>i'<esc>gvo<esc>3l
|
||||||
|
|
||||||
|
" Quote current selection
|
||||||
|
" TODO: This only works for selections that are created "forwardly"
|
||||||
|
vnoremap <leader>" <esc>a"<esc>gvo<esc>i"<esc>gvo<esc>ll
|
||||||
|
vnoremap <leader>' <esc>a'<esc>gvo<esc>i'<esc>gvo<esc>ll
|
||||||
|
|
||||||
|
" Use shift-H and shift-L for move to beginning/end
|
||||||
|
nnoremap H 0
|
||||||
|
nnoremap L $
|
||||||
|
|
||||||
|
" Define operator-pending mappings to quickly apply commands to function names
|
||||||
|
" and/or parameter lists in the current line
|
||||||
|
onoremap inf :<c-u>normal! 0f(hviw<cr>
|
||||||
|
onoremap anf :<c-u>normal! 0f(hvaw<cr>
|
||||||
|
onoremap in( :<c-u>normal! 0f(vi(<cr>
|
||||||
|
onoremap an( :<c-u>normal! 0f(va(<cr>
|
||||||
|
|
||||||
|
" "Next" tag
|
||||||
|
onoremap int :<c-u>normal! 0f<vit<cr>
|
||||||
|
onoremap ant :<c-u>normal! 0f<vat<cr>
|
||||||
|
|
||||||
|
" Function argument selection (change "around argument", change "inside argument")
|
||||||
|
onoremap ia :<c-u>execute "normal! ?[,(]\rwv/[),]\rh"<cr>
|
||||||
|
vnoremap ia :<c-u>execute "normal! ?[,(]\rwv/[),]\rh"<cr>
|
||||||
|
|
||||||
|
" Split previously opened file ('#') in a split window
|
||||||
|
nnoremap <leader>sh :execute "leftabove vsplit" bufname('#')<cr>
|
||||||
|
nnoremap <leader>sl :execute "rightbelow vsplit" bufname('#')<cr>
|
||||||
|
|
||||||
|
" Grep searches
|
||||||
|
"nnoremap <leader>g :silent execute "grep! -R " . shellescape('<cword>') . " ."<cr>:copen 12<cr>
|
||||||
|
"nnoremap <leader>G :silent execute "grep! -R " . shellescape('<cWORD>') . " ."<cr>:copen 12<cr>
|
||||||
|
|
||||||
|
" Run tests
|
||||||
|
inoremap <leader>w <esc>:write<cr>:!./run_tests.sh %<cr>
|
||||||
|
nnoremap <leader>w :!./run_tests.sh<cr>
|
||||||
|
|
||||||
|
" Rope config
|
||||||
|
nnoremap <leader>A :RopeAutoImport<cr>
|
||||||
|
|
||||||
|
" Switch from block-cursor to vertical-line-cursor when going into/out of
|
||||||
|
" insert mode
|
||||||
|
let &t_SI = "\<Esc>]50;CursorShape=1\x7"
|
||||||
|
let &t_EI = "\<Esc>]50;CursorShape=0\x7"
|
||||||
59
vimrc.dpkg-old
Normal file
59
vimrc.dpkg-old
Normal file
@@ -0,0 +1,59 @@
|
|||||||
|
" All system-wide defaults are set in $VIMRUNTIME/debian.vim (usually just
|
||||||
|
" /usr/share/vim/vimcurrent/debian.vim) and sourced by the call to :runtime
|
||||||
|
" you can find below. If you wish to change any of those settings, you should
|
||||||
|
" do it in this file (/etc/vim/vimrc), since debian.vim will be overwritten
|
||||||
|
" everytime an upgrade of the vim packages is performed. It is recommended to
|
||||||
|
" make changes after sourcing debian.vim since it alters the value of the
|
||||||
|
" 'compatible' option.
|
||||||
|
|
||||||
|
" This line should not be removed as it ensures that various options are
|
||||||
|
" properly set to work with the Vim-related packages available in Debian.
|
||||||
|
runtime! debian.vim
|
||||||
|
|
||||||
|
" Uncomment the next line to make Vim more Vi-compatible
|
||||||
|
" NOTE: debian.vim sets 'nocompatible'. Setting 'compatible' changes numerous
|
||||||
|
" options, so any other options should be set AFTER setting 'compatible'.
|
||||||
|
"set compatible
|
||||||
|
|
||||||
|
" Vim5 and later versions support syntax highlighting. Uncommenting the next
|
||||||
|
" line enables syntax highlighting by default.
|
||||||
|
"syntax on
|
||||||
|
|
||||||
|
" If using a dark background within the editing area and syntax highlighting
|
||||||
|
" turn on this option as well
|
||||||
|
"set background=dark
|
||||||
|
|
||||||
|
" Uncomment the following to have Vim jump to the last position when
|
||||||
|
" reopening a file
|
||||||
|
"if has("autocmd")
|
||||||
|
" au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif
|
||||||
|
"endif
|
||||||
|
|
||||||
|
" Uncomment the following to have Vim load indentation rules and plugins
|
||||||
|
" according to the detected filetype.
|
||||||
|
"if has("autocmd")
|
||||||
|
" filetype plugin indent on
|
||||||
|
"endif
|
||||||
|
|
||||||
|
" The following are commented out as they cause vim to behave a lot
|
||||||
|
" differently from regular Vi. They are highly recommended though.
|
||||||
|
"set showcmd " Show (partial) command in status line.
|
||||||
|
"set showmatch " Show matching brackets.
|
||||||
|
"set ignorecase " Do case insensitive matching
|
||||||
|
"set smartcase " Do smart case matching
|
||||||
|
"set incsearch " Incremental search
|
||||||
|
"set autowrite " Automatically save before commands like :next and :make
|
||||||
|
"set hidden " Hide buffers when they are abandoned
|
||||||
|
"set mouse=a " Enable mouse usage (all modes)
|
||||||
|
|
||||||
|
" Source a global configuration file if available
|
||||||
|
if filereadable("/etc/vim/vimrc.local")
|
||||||
|
source /etc/vim/vimrc.local
|
||||||
|
endif
|
||||||
|
|
||||||
|
set tabstop=4
|
||||||
|
set ts=4
|
||||||
|
set sw=4
|
||||||
|
set nowrap
|
||||||
|
syntax enable
|
||||||
|
set ignorecase
|
||||||
13
vimrc.tiny
Normal file
13
vimrc.tiny
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
" Vim configuration file, in effect when invoked as "vi". The aim of this
|
||||||
|
" configuration file is to provide a Vim environment as compatible with the
|
||||||
|
" original vi as possible. Note that ~/.vimrc configuration files as other
|
||||||
|
" configuration files in the runtimepath are still sourced.
|
||||||
|
" When Vim is invoked differently ("vim", "view", "evim", ...) this file is
|
||||||
|
" _not_ sourced; /etc/vim/vimrc and/or /etc/vim/gvimrc are.
|
||||||
|
|
||||||
|
" Debian system-wide default configuration Vim
|
||||||
|
set runtimepath=~/.vim,/var/lib/vim/addons,/usr/share/vim/vimfiles,/usr/share/vim/vim74,/usr/share/vim/vimfiles/after,/var/lib/vim/addons/after,~/.vim/after
|
||||||
|
|
||||||
|
set compatible
|
||||||
|
|
||||||
|
" vim: set ft=vim:
|
||||||
Reference in New Issue
Block a user