diff options
Diffstat (limited to 'vim/.vim')
44 files changed, 1185 insertions, 0 deletions
diff --git a/vim/.vim/after/ftplugin/rust.vim b/vim/.vim/after/ftplugin/rust.vim new file mode 100644 index 0000000..f30a884 --- /dev/null +++ b/vim/.vim/after/ftplugin/rust.vim @@ -0,0 +1 @@ +set tw=78 diff --git a/vim/.vim/colors/local.vim b/vim/.vim/colors/local.vim new file mode 100644 index 0000000..7e22c18 --- /dev/null +++ b/vim/.vim/colors/local.vim @@ -0,0 +1,126 @@ +highlight clear +syntax reset +set background=dark +let g:colors_name = expand('<sfile>:t:r') + +let s:g = { + \"black": "#000000", + \"red": "#ed5f74", + \"green": "#1ea672", + \"yellow": "#d97917", + \"blue": "#688ef1", + \"magenta": "#c96ed0", + \"cyan": "#3a97d4", + \"white": "#e3e8ee", + \"brightblack": "#697386", + \"brightred": "#fbb5b2", + \"brightgreen": "#85d996", + \"brightyellow": "#efc078", + \"brightblue": "#9fcdff", + \"brightmagenta": "#f0b4e4", + \"brightcyan": "#7fd3ed", + \"brightwhite": "#ffffff", + \"darkblack": "#000000", + \"darkred": "#742833", + \"darkgreen": "#00643c", + \"darkyellow": "#6e3500", + \"darkblue": "#2c4074", + \"darkmagenta": "#602864", + \"darkcyan": "#144c71", + \"darkwhite": "#3e4043", + \"darkerwhite": "#090e14", +\} + +let s:c = { + \"black": "0", + \"red": "1", + \"green": "2", + \"yellow": "3", + \"blue": "4", + \"magenta": "5", + \"cyan": "6", + \"white": "7", + \"brightblack": "8", + \"brightred": "9", + \"brightgreen": "10", + \"brightyellow": "11", + \"brightblue": "12", + \"brightmagenta": "13", + \"brightcyan": "14", + \"brightwhite": "15", +\} + +function s:hi(name, fg, bg) + if a:fg == "" + let ctermfg = "" + let guifg = "" + elseif a:fg =~ "^#" + let ctermfg = "" + let guifg = "guifg=" . a:fg + else + let ctermfg = "ctermfg=" . s:c[a:fg] + let guifg = "guifg=" . s:g[a:fg] + endif + + if a:bg == "" + let ctermbg = "" + let guibg = "" + elseif a:bg =~ "^#" + let ctermbg = "" + let guibg = "guibg=" . a:bg + else + let ctermbg = "ctermbg=" . s:c[a:bg] + let guibg = "guibg=" . s:g[a:bg] + endif + + silent exe "highlight clear " . a:name + if a:fg != "" || a:bg != "" + silent exe "highlight " . a:name . " " . ctermfg . " " . ctermbg . " " . guifg . " " . guibg + endif +endfunction + +" text +call <sid>hi("Comment", "brightblack", "") +call <sid>hi("Constant", "red", "") +call <sid>hi("Delimiter", "blue", "") +call <sid>hi("Error", "black", "brightmagenta") +call <sid>hi("Function", "brightcyan", "") +call <sid>hi("Identifier", "", "") +call <sid>hi("Include", "blue", "") +call <sid>hi("Operator", "", "") +call <sid>hi("PreProc", "magenta", "") +call <sid>hi("Special", "magenta", "") +call <sid>hi("SpecialKey", "magenta", "") +call <sid>hi("Statement", "yellow", "") +call <sid>hi("Title", "magenta", "") +call <sid>hi("Todo", "black", "brightyellow") +call <sid>hi("Type", "green", "") + +autocmd FileType go call <sid>hi("goBuiltins", "yellow", "") +autocmd FileType go call <sid>hi("goFunctionCall", "brightcyan", "") +autocmd FileType markdown call <sid>hi("mkdListItem", "yellow", "") +autocmd FileType perl call <sid>hi("Identifier", "brightcyan", "") +autocmd FileType puppet call <sid>hi("puppetStringDelimiter", "red", "") +autocmd FileType ruby call <sid>hi("rubyInterpolationDelimiter", "magenta", "") +autocmd FileType ruby call <sid>hi("rubyPercentStringDelimiter", "yellow", "") +autocmd FileType ruby call <sid>hi("rubyStringDelimiter", "red", "") +autocmd FileType ruby call <sid>hi("rubyRegexDelimiter", "red", "") +autocmd FileType sh call <sid>hi("shQuote", "red", "") +autocmd FileType vim call <sid>hi("vimBracket", "magenta", "") +autocmd FileType vim call <sid>hi("vimMapMod", "magenta", "") + +" ui +call <sid>hi("DiffAdd", "", s:g["darkgreen"]) +call <sid>hi("DiffChange", "", s:g["darkblue"]) +call <sid>hi("DiffDelete", "", s:g["darkred"]) +call <sid>hi("DiffText", "", s:g["darkmagenta"]) +call <sid>hi("Folded", "brightgreen", s:g["darkgreen"]) +call <sid>hi("MatchParen", "brightcyan", s:g["darkcyan"]) +call <sid>hi("MoreMsg", "green", s:g["darkgreen"]) +call <sid>hi("NonText", "brightblue", s:g["darkerwhite"]) +call <sid>hi("Search", "", s:g["darkmagenta"]) +call <sid>hi("SpellBad", "", s:g["darkred"]) +call <sid>hi("SpellCap", "", s:g["darkblue"]) +call <sid>hi("SpellRare", "", s:g["darkgreen"]) +call <sid>hi("SpellLocal", "", s:g["darkmagenta"]) +call <sid>hi("Visual", "", s:g["darkwhite"]) diff --git a/vim/.vim/ftdetect/c.vim b/vim/.vim/ftdetect/c.vim new file mode 100644 index 0000000..8dac68b --- /dev/null +++ b/vim/.vim/ftdetect/c.vim @@ -0,0 +1 @@ +let c_syntax_for_h = 1 diff --git a/vim/.vim/ftdetect/levdes.vim b/vim/.vim/ftdetect/levdes.vim new file mode 100644 index 0000000..c016fd8 --- /dev/null +++ b/vim/.vim/ftdetect/levdes.vim @@ -0,0 +1 @@ +au! BufRead,BufNewFile *crawl*/*.des set filetype=levdes diff --git a/vim/.vim/ftdetect/nhdes.vim b/vim/.vim/ftdetect/nhdes.vim new file mode 100644 index 0000000..5886d51 --- /dev/null +++ b/vim/.vim/ftdetect/nhdes.vim @@ -0,0 +1 @@ +au! BufRead,BufNewFile *nethack*/*.des set filetype=nhdes diff --git a/vim/.vim/ftplugin/c.vim b/vim/.vim/ftplugin/c.vim new file mode 100644 index 0000000..13c7d4a --- /dev/null +++ b/vim/.vim/ftplugin/c.vim @@ -0,0 +1 @@ +setlocal cinoptions+=:0,l1,g0,(0,W1s diff --git a/vim/.vim/ftplugin/cpp.vim b/vim/.vim/ftplugin/cpp.vim new file mode 100644 index 0000000..83d7802 --- /dev/null +++ b/vim/.vim/ftplugin/cpp.vim @@ -0,0 +1,2 @@ +let b:load_doxygen_syntax = 1 +setlocal cinoptions+=:0,l1,g0,(0,W1s diff --git a/vim/.vim/ftplugin/gitcommit.vim b/vim/.vim/ftplugin/gitcommit.vim new file mode 100644 index 0000000..b1c1450 --- /dev/null +++ b/vim/.vim/ftplugin/gitcommit.vim @@ -0,0 +1,9 @@ +setlocal viminfo= +augroup local_gitcommit + autocmd! + autocmd BufWinEnter <buffer> + \ if getline(1) == '' | + \ exe "normal! ggO" | + \ startinsert | + \ endif +augroup END diff --git a/vim/.vim/ftplugin/go.vim b/vim/.vim/ftplugin/go.vim new file mode 100644 index 0000000..c4c065b --- /dev/null +++ b/vim/.vim/ftplugin/go.vim @@ -0,0 +1,5 @@ +setlocal ts=4 +let b:ale_fixers = {"go": ["gofmt"]} +let b:ale_fix_on_save = 1 + +map <buffer> <CR> :ALEGoToDefinition<CR> diff --git a/vim/.vim/ftplugin/help.vim b/vim/.vim/ftplugin/help.vim new file mode 100644 index 0000000..475e0a7 --- /dev/null +++ b/vim/.vim/ftplugin/help.vim @@ -0,0 +1,3 @@ +setlocal keywordprg=:help +nnoremap <buffer> K K +vnoremap <buffer> K K diff --git a/vim/.vim/ftplugin/javascript.vim b/vim/.vim/ftplugin/javascript.vim new file mode 100644 index 0000000..e5b284f --- /dev/null +++ b/vim/.vim/ftplugin/javascript.vim @@ -0,0 +1,4 @@ +let b:ale_fixers = {"javascript": ["eslint", "prettier"]} +let b:ale_fix_on_save = 1 +let b:ale_javascript_eslint_executable = "node_modules/.bin/eslint" +let b:ale_javascript_prettier_executable = "node_modules/.bin/prettier" diff --git a/vim/.vim/ftplugin/perl.vim b/vim/.vim/ftplugin/perl.vim new file mode 100644 index 0000000..3571e98 --- /dev/null +++ b/vim/.vim/ftplugin/perl.vim @@ -0,0 +1,11 @@ +let b:ale_linters = { 'perl': ['perlcritic'] } +" rainbow parens break syntax-based indent +autocmd vimrc BufEnter <buffer> let b:indent_use_syntax = 0 + +" look up words in perldoc rather than man for K +function! s:perldoc(word) + exe 'silent read! perldoc -o PlainText -f "' . a:word . '" 2>/dev/null || perldoc -o PlainText "' . a:word . '"' + setlocal ft=man +endfunction +nnoremap <buffer> <silent>K :call Help(0, [':'], '<SID>perldoc')<CR> +vnoremap <buffer> <silent>K :call Help(1, [':'], '<SID>perldoc')<CR> diff --git a/vim/.vim/ftplugin/puppet.vim b/vim/.vim/ftplugin/puppet.vim new file mode 100644 index 0000000..d1652a3 --- /dev/null +++ b/vim/.vim/ftplugin/puppet.vim @@ -0,0 +1 @@ +let g:puppet_align_hashes = 0 diff --git a/vim/.vim/ftplugin/python.vim b/vim/.vim/ftplugin/python.vim new file mode 100644 index 0000000..5bf8dba --- /dev/null +++ b/vim/.vim/ftplugin/python.vim @@ -0,0 +1,19 @@ +" look up words in pydoc rather than man for K +function! s:pydoc(word) + let l:pydoc_manpager = $MANPAGER + let l:pydoc_pager = $PAGER + let $MANPAGER = 'cat' + let $PAGER = 'cat' + exe 'silent read! pydoc "' . a:word . '" 2>/dev/null' + let $MANPAGER = l:pydoc_manpager + let $PAGER = l:pydoc_pager + setlocal ft=man +endfunction +nnoremap <buffer> <silent>K :call Help(0, ['.'], '<SID>pydoc')<CR> +vnoremap <buffer> <silent>K :call Help(1, ['.'], '<SID>pydoc')<CR> + +map <buffer> <CR> :ALEGoToDefinition<CR> + +let b:ale_fixers = { 'python': ['black', 'isort'] } +let b:ale_fix_on_save = 1 +let b:ale_python_flake8_options = '--max-line-length 1000 --ignore=E203,W503 --extend-select=W504'
\ No newline at end of file diff --git a/vim/.vim/ftplugin/ruby.vim b/vim/.vim/ftplugin/ruby.vim new file mode 100644 index 0000000..035f432 --- /dev/null +++ b/vim/.vim/ftplugin/ruby.vim @@ -0,0 +1,25 @@ +function! s:rubocop_in_bundler() + let l:gemfiles = glob("*.gemspec", 1, 1) + if filereadable("Gemfile") + let l:gemfiles += ["Gemfile"] + endif + for l:file in l:gemfiles + for l:line in readfile(l:file) + if l:line =~ 'gem.*rubocop' + return 1 + endif + endfor + endfor + return 0 +endfunction +if s:rubocop_in_bundler() + let b:ale_ruby_rubocop_executable = 'bundle' +endif + +" look up words in ri rather than man for K +function! s:ri(word) + exe 'silent read! ri -T -f rdoc "' . a:word . '" 2>/dev/null' + setlocal ft= +endfunction +nnoremap <buffer> <silent>K :call Help(0, [':', '.'], '<SID>ri')<CR> +vnoremap <buffer> <silent>K :call Help(1, [':', '.'], '<SID>ri')<CR> diff --git a/vim/.vim/ftplugin/rust.vim b/vim/.vim/ftplugin/rust.vim new file mode 100644 index 0000000..2b9606e --- /dev/null +++ b/vim/.vim/ftplugin/rust.vim @@ -0,0 +1,18 @@ +let b:ale_linters = { 'rust': ['analyzer'] } +let b:ale_rust_analyzer_config = { + \'checkOnSave': { 'command': 'clippy' }, + \'cargo': { 'allFeatures': v:true }, + \'diagnostics': { 'disabled': ['inactive-code'] }, +\} +let b:ale_fixers = { 'rust': ['rustfmt'] } +let b:ale_fix_on_save = 1 +let b:ale_rust_rustfmt_options = "--edition 2018" + +map <buffer> <CR> :ALEGoToDefinition<CR> + +if filereadable("Cargo.toml") + compiler cargo + setlocal makeprg=cargo\ build +else + setlocal makeprg=rustc\ % +endif diff --git a/vim/.vim/ftplugin/sh.vim b/vim/.vim/ftplugin/sh.vim new file mode 100644 index 0000000..728eb70 --- /dev/null +++ b/vim/.vim/ftplugin/sh.vim @@ -0,0 +1,4 @@ +let b:is_bash = 1 +let b:ale_fixers = { 'sh': ['shfmt'] } +let b:ale_fix_on_save = 1 +let b:ale_sh_shfmt_options = '-i 4' diff --git a/vim/.vim/ftplugin/terraform.vim b/vim/.vim/ftplugin/terraform.vim new file mode 100644 index 0000000..5764f2e --- /dev/null +++ b/vim/.vim/ftplugin/terraform.vim @@ -0,0 +1,3 @@ +setlocal commentstring=#\ %s +let b:ale_fixers = { 'terraform': ['terraform'] } +let b:ale_fix_on_save = 1 diff --git a/vim/.vim/ftplugin/tex.vim b/vim/.vim/ftplugin/tex.vim new file mode 100644 index 0000000..03c0821 --- /dev/null +++ b/vim/.vim/ftplugin/tex.vim @@ -0,0 +1,98 @@ +let b:tex_flavor="latex" + +" :make converts to pdf +setlocal makeprg=(cd\ /tmp\ &&\ pdflatex\ --synctex=1\ --halt-on-error\ %:p) + +function! s:zathura() + if s:is_running('^zathura') + " zathura automatically reloads + return + endif + call remote_startserver("vim-zathura") + call system('zathura --fork -x "vim --servername vim-zathura --remote +%{line} %{input}" ' . s:current_pdf()) +endfunction + +function! s:current_pdf() + let base = expand('<afile>:t:r') + if base == '' + let base = expand('%:t:r') + endif + return '/tmp/' . base . '.pdf' +endfunction + +function! s:is_running(re) + let processes = split(system('ps xo args'), '\n') + for process in processes + if process =~ a:re + return 1 + endif + endfor + return 0 +endfunction + +function! s:synctex() + if s:is_running('^zathura') + exe "silent !zathura --synctex-forward " . line('.') . ":" . col('.') . ":" . expand('%:p') . " " . s:current_pdf() + redraw + endif +endfunction + +let g:_tex_last_line_seen = -1 +function! s:cursor_moved() + let line = line('.') + if line != g:_tex_last_line_seen + call s:synctex() + endif + let g:_tex_last_line_seen = line +endfunction + +" don't load the pdf if the make failed +function! s:make_errors() + let qf = getqflist() + for line in qf + if line['type'] == 'E' + return 1 + endif + endfor + return 0 +endfunction + +augroup _tex + autocmd! + if executable('zathura') && strlen(expand('$DISPLAY')) + autocmd QuickFixCmdPost make if !s:make_errors() | call s:zathura() | endif + endif + " currently this is not usable until + " https://git.pwmt.org/pwmt/zathura/-/issues/157 is fixed + " autocmd CursorMoved <buffer> call s:cursor_moved() +augroup END + +" see :help errorformat-LaTeX +setlocal errorformat= + \%E!\ LaTeX\ %trror:\ %m, + \%E!\ %m, + \%+WLaTeX\ %.%#Warning:\ %.%#line\ %l%.%#, + \%+W%.%#\ at\ lines\ %l--%*\\d, + \%WLaTeX\ %.%#Warning:\ %m, + \%Cl.%l\ %m, + \%+C\ \ %m., + \%+C%.%#-%.%#, + \%+C%.%#[]%.%#, + \%+C[]%.%#, + \%+C%.%#%[{}\\]%.%#, + \%+C<%.%#>%.%#, + \%C\ \ %m, + \%-GSee\ the\ LaTeX%m, + \%-GType\ \ H\ <return>%m, + \%-G\ ...%.%#, + \%-G%.%#\ (C)\ %.%#, + \%-G(see\ the\ transcript%.%#), + \%-G\\s%#, + \%+O(%f)%r, + \%+P(%f%r, + \%+P\ %\\=(%f%r, + \%+P%*[^()](%f%r, + \%+P[%\\d%[^()]%#(%f%r, + \%+Q)%r, + \%+Q%*[^()])%r, + \%+Q[%\\d%*[^()])%r diff --git a/vim/.vim/ftplugin/vim.vim b/vim/.vim/ftplugin/vim.vim new file mode 100644 index 0000000..475e0a7 --- /dev/null +++ b/vim/.vim/ftplugin/vim.vim @@ -0,0 +1,3 @@ +setlocal keywordprg=:help +nnoremap <buffer> K K +vnoremap <buffer> K K diff --git a/vim/.vim/ftplugin/vimwiki.vim b/vim/.vim/ftplugin/vimwiki.vim new file mode 100644 index 0000000..aac5bcb --- /dev/null +++ b/vim/.vim/ftplugin/vimwiki.vim @@ -0,0 +1 @@ +nmap <Leader><Tab> <Plug>VimwikiNextLink diff --git a/vim/.vim/ftplugin/xs.vim b/vim/.vim/ftplugin/xs.vim new file mode 100644 index 0000000..8dc989f --- /dev/null +++ b/vim/.vim/ftplugin/xs.vim @@ -0,0 +1,10 @@ +setlocal cindent +setlocal cinoptions+=:0,l1,g0,(0,W1s + +" look up words in perldoc rather than man for K if they exist +function! s:perldoc_or_man(word) + exe 'silent read! perldoc -o PlainText -a "' . a:word . '" 2>/dev/null || man -Pcat ' . a:word + setlocal ft=man +endfunction +nnoremap <buffer> <silent>K :call Help(0, [], '<SID>perldoc_or_man')<CR> +vnoremap <buffer> <silent>K :call Help(1, [], '<SID>perldoc_or_man')<CR> diff --git a/vim/.vim/pack/filetype/start/polyglot b/vim/.vim/pack/filetype/start/polyglot new file mode 160000 +Subproject bc8a81d3592dab86334f27d1d43c080ebf680d4 diff --git a/vim/.vim/pack/plugins/start/airline b/vim/.vim/pack/plugins/start/airline new file mode 160000 +Subproject 038e3a6ca59f11b3bb6a94087c1792322d1a1d5 diff --git a/vim/.vim/pack/plugins/start/ale b/vim/.vim/pack/plugins/start/ale new file mode 160000 +Subproject c3f9bccb8c04b01d5d0712b8691658af0b0ddb1 diff --git a/vim/.vim/pack/plugins/start/autobrace b/vim/.vim/pack/plugins/start/autobrace new file mode 160000 +Subproject e51de9e6265ade6195c8983edf58c462695acfe diff --git a/vim/.vim/pack/plugins/start/commentary b/vim/.vim/pack/plugins/start/commentary new file mode 160000 +Subproject e87cd90dc09c2a203e13af9704bd0ef79303d75 diff --git a/vim/.vim/pack/plugins/start/diff-changes b/vim/.vim/pack/plugins/start/diff-changes new file mode 160000 +Subproject 97cf3bc8b51f27452b4174e4f770758d42162d0 diff --git a/vim/.vim/pack/plugins/start/editorconfig b/vim/.vim/pack/plugins/start/editorconfig new file mode 160000 +Subproject 1d54632f7fcad38df8e428f349bc58b15af4b20 diff --git a/vim/.vim/pack/plugins/start/fzf b/vim/.vim/pack/plugins/start/fzf new file mode 160000 +Subproject 352ea072269dfe2a3c429785a95a2f22887ccda diff --git a/vim/.vim/pack/plugins/start/fzf.vim b/vim/.vim/pack/plugins/start/fzf.vim new file mode 160000 +Subproject dc71692255b62d1f67dc55c8e51ab1aa467b1d4 diff --git a/vim/.vim/pack/plugins/start/gundo b/vim/.vim/pack/plugins/start/gundo new file mode 160000 +Subproject c5efef192b975b8e7d5fa3c6db932648d3b7632 diff --git a/vim/.vim/pack/plugins/start/history-sync b/vim/.vim/pack/plugins/start/history-sync new file mode 160000 +Subproject 279aa756157ab818df67e854e953f6e05809b4a diff --git a/vim/.vim/pack/plugins/start/startify b/vim/.vim/pack/plugins/start/startify new file mode 160000 +Subproject 81e36c352a8deea54df5ec1e2f4348685569bed diff --git a/vim/.vim/pack/plugins/start/textobj b/vim/.vim/pack/plugins/start/textobj new file mode 160000 +Subproject fd84055046d38c7e850fdbf13f92ab2898f8114 diff --git a/vim/.vim/plugin/dircreate.vim b/vim/.vim/plugin/dircreate.vim new file mode 100644 index 0000000..11da7f9 --- /dev/null +++ b/vim/.vim/plugin/dircreate.vim @@ -0,0 +1,31 @@ +function! s:ensure_dir_exists() + let l:required_dir = expand("%:h") + if !isdirectory(l:required_dir) + if <SID>ask_quit("Directory '" . l:required_dir . "' doesn't exist.", "&Create it?") + return + endif + + try + call mkdir(l:required_dir, 'p') + catch + call <SID>ask_quit("Can't create '" . l:required_dir . "'", "&Continue anyway?") + endtry + endif +endfunction + +function! s:ask_quit(msg, proposed_action) + if confirm(a:msg, "&Quit?\n" . a:proposed_action) == 1 + if len(getbufinfo()) > 1 + silent bd + return 1 + else + exit + end + endif + return 0 +endfunction + +augroup dircreate + autocmd! + autocmd BufNewFile * call <SID>ensure_dir_exists() +augroup END diff --git a/vim/.vim/plugin/eolws.vim b/vim/.vim/plugin/eolws.vim new file mode 100644 index 0000000..1f1a003 --- /dev/null +++ b/vim/.vim/plugin/eolws.vim @@ -0,0 +1,6 @@ +augroup eolws + autocmd! + autocmd InsertEnter * syn clear EOLWS | syn match EOLWS excludenl /\s\+\%#\@!$/ + autocmd InsertLeave * syn clear EOLWS | syn match EOLWS excludenl /\s\+$/ +augroup END +highlight EOLWS ctermbg=red guibg=red diff --git a/vim/.vim/plugin/keywordprg.vim b/vim/.vim/plugin/keywordprg.vim new file mode 100644 index 0000000..dfedd80 --- /dev/null +++ b/vim/.vim/plugin/keywordprg.vim @@ -0,0 +1,33 @@ +function! Help(visual, iskeyword, command) + let l:iskeyword = &iskeyword + for l:kw in a:iskeyword + exe 'set iskeyword+=' . l:kw + endfor + if a:visual + let l:oldreg = @a + normal! gv"aygv + let l:word = @a + let @a = l:oldreg + else + let l:word = expand('<cword>') + endif + let &iskeyword = l:iskeyword + + exe 'noswapfile ' . &helpheight . 'new ' . l:word + setlocal buftype=nofile + setlocal bufhidden=wipe + setlocal nobuflisted + + setlocal modifiable + exe 'call ' . a:command . '("' . l:word . '")' + normal! ggdd + setlocal nomodifiable +endfunction + +function! s:man(word) + exe 'silent read! man -Pcat ' . a:word + setlocal filetype=man +endfunction + +nnoremap <silent>K :call Help(0, [], '<SID>man')<CR> +xnoremap <silent>K :call Help(1, [], '<SID>man')<CR> diff --git a/vim/.vim/plugin/opinionated-defaults.vim b/vim/.vim/plugin/opinionated-defaults.vim new file mode 100644 index 0000000..6ce034b --- /dev/null +++ b/vim/.vim/plugin/opinionated-defaults.vim @@ -0,0 +1,157 @@ +""" GENERAL """ +set nocompatible +syntax on +filetype indent plugin on +augroup opinionated_defaults + autocmd! +augroup END + + +""" PERSISTENCE """ + +" remember as many history items as possible (command, search, etc) +set history=10000 +" enable persistent undo (undo even after closing and reopening vim) +if has('persistent_undo') + let s:undocachedir = $HOME . '/.cache/vim/undo' + if !isdirectory(s:undocachedir) + call mkdir(s:undocachedir, 'p') + endif + exe "set undodir=" . s:undocachedir + set undofile +endif +" use a separate swapfile directory +let s:swapfiledir = $HOME . '/.cache/vim/swap' +if !isdirectory(s:swapfiledir) + call mkdir(s:swapfiledir, 'p') +endif +exe "set directory=" . s:swapfiledir . "//" +" use a separate view directory +let s:viewdir = $HOME . '/.cache/vim/view' +if !isdirectory(s:viewdir) + call mkdir(s:viewdir, 'p') +endif +exe "set viewdir=" . s:viewdir + + +""" BUFFERS """ + +" automatically write the buffer before :make, shell commands, etc +set autowrite +" ask to save modified buffers when quitting, instead of throwing an error +set confirm +" allow switching to other buffers when the current one is modified +set hidden +" these two restore the last known cursor position when a buffer is loaded +set nostartofline +autocmd opinionated_defaults BufReadPost * + \ if line("'\"") <= line('$') | + \ exe 'normal! g`"' | + \ endif + + +""" DISPLAY """ + +" show as much of a line as possible if it doesn't all fit on the screen +set display+=truncate +" more useful display of nonprinting characters (<07> instead of ^G) +set display+=uhex +" don't redraw in the middle of noninteractive commands (maps, macros, etc) +set lazyredraw +" always give a message for the number of lines delete/changed +set report=0 +" keep some additional context visible when scrolling +set scrolloff=5 +if has('cmdline_info') + " display the current partial command and size of the visual selection + set showcmd +endif +if has('conceal') + " enable syntax-specific hiding of text + set conceallevel=2 +endif +if has('linebreak') + " display a marker when a line was wrapped + set showbreak=> +endif + + +""" EDITING """ + +" automatically use an indent that matches the previous line +set autoindent +" allow backspacing over everything +set backspace=indent,eol,start +" remove leading comment characters intelligently when joining lines +set formatoptions+=j +" always join with a single space, even between sentences +set nojoinspaces +" try to always keep indentation lined up on shiftwidth boundaries +set shiftround +" keep softtabstop and shiftwidth in sync +set softtabstop=-1 + + +""" COMMAND MODE """ + +" make command mode completion work more like the shell: +" first, complete the longest common sequence, +" then show a list, +" then cycle through completing the full names in the list in order +set wildmode=longest,list,full +if exists('+wildignorecase') + " make command mode completion case insensitive + set wildignorecase +endif + + +""" SEARCH """ + +" make searches case-insensitive +set ignorecase +" unless they include a capital letter +set smartcase +if has('extra_search') + " highlight all matches when searching + set hlsearch +endif + + +""" TERMINAL STUFF """ + +" wait a much shorter amount of time for escape sequences +" (this makes <Esc> much more responsive) +set ttimeoutlen=50 +" send text to the terminal in such a way that line wrapping is done at the +" terminal level, so copying and pasting wrapped lines works correctly +" (assuming you temporarily unset showbreak) +set ttyfast +" entirely disable error bells: +" make all bells visual bells +set visualbell +" and then disable visual bells +set t_vb= + + +""" COLORS """ + +" force vim to use 256 colors +" (it typically can't detect this while in screen/tmux since TERM=screen +" doesn't advertise it, even though ~everything does support it these days) +set t_Co=256 +" globally highlight diff conflict markers +match ErrorMsg '^\(<\||\|=\|>\)\{7\}\([^=].\+\)\?$' + + +""" MAPPINGS """ + +" keep the current selection when indenting +xnoremap < <gv +xnoremap > >gv +" make Y behave analogously to D instead of dd +nnoremap Y y$ +" make arrow keys move visually (since j/k already move linewise) +noremap <up> gk +noremap <down> gj +inoremap <up> <C-o>gk +inoremap <down> <C-o>gj diff --git a/vim/.vim/plugin/rainbow_paren.vim b/vim/.vim/plugin/rainbow_paren.vim new file mode 100644 index 0000000..9c26134 --- /dev/null +++ b/vim/.vim/plugin/rainbow_paren.vim @@ -0,0 +1,96 @@ +" this script by Shawn M Moore aka Sartak <sartak at gmail.com> +" also by Michael R Geddes aka frogonwheels <vimmer at frog.wheelycreek.net> +" originally by anonymous + +" this in the public domain +" last updated 25 Mar 07 + +" this does nothing unless you, +" let g:rainbow = 1 + +" and set which kinds of character pairs you want to rainbow +" let g:rainbow_paren = 1 " () +" let g:rainbow_brace = 1 " {} +" let g:rainbow_bracket = 1 " [] +" let g:rainbow_angle = 1 " <> + +" if you want the different types to nest, such that the braces in ({}) are +" colored the same as the internal parens of (()), then +" let g:rainbow_nested = 1 + +function! Rainbow() + let s:basename = 'level' + exe 'hi '.s:basename.'1c ctermfg=6 guifg=#1673b0' + exe 'hi '.s:basename.'2c ctermfg=2 guifg=#008551' + exe 'hi '.s:basename.'3c ctermfg=3 guifg=#b25200' + exe 'hi '.s:basename.'4c ctermfg=4 guifg=#4369cc' + exe 'hi '.s:basename.'5c ctermfg=5 guifg=#a045a7' + " this color is never nested, it only appears on the outermost layer + exe 'hi '.s:basename.'6c ctermfg=1 guifg=#c7394e' + + " helper function + func s:DoSyn(cur, top, left, right, uniq) + let uniq = a:uniq + if exists("g:rainbow_nested") && g:rainbow_nested != 0 + let uniq = "" + endif + + let cmd = 'syn region '.s:basename.uniq.a:cur.' transparent fold matchgroup='.s:basename.a:cur.'c start=/'.a:left.'/ end=/'.a:right.'/ contains=TOP' + + let i = a:cur + + if i == 1 + let i = a:top + endif + + while i <= a:top + let cmd = cmd . ',' . s:basename . uniq . i + let i = i + 1 + endwhile + exe cmd + endfunc + + func s:DoSyntaxes(count) + let i = 1 + + while i <= a:count + " if you define new pairs, make sure to take into account that the + " delimiter is currently / and that it uses regex, so you need to escape + " regex metachars (like what is done for brackets) + + if exists("g:rainbow_paren") && g:rainbow_paren != 0 + " ocaml uses (* *) for comments; these shouldn't be highlighted + if &filetype == "ocaml" + call s:DoSyn(i, a:count, "(\\*\\@!", "\\*\\@<!)", "a") + else + call s:DoSyn(i, a:count, "(", ")", "a") + endif + endif + + if exists("g:rainbow_brace") && g:rainbow_brace != 0 + call s:DoSyn(i, a:count, "{", "}", "b") + endif + + if exists("g:rainbow_bracket") && g:rainbow_bracket != 0 + call s:DoSyn(i, a:count, "\\[", "\\]", "c") + endif + + if exists("g:rainbow_angle") && g:rainbow_angle != 0 + call s:DoSyn(i, a:count, "<", ">", "d") + endif + + let i = i + 1 + endwhile + endfun + + call s:DoSyntaxes(6) " 6 is the number of colors we have + + delfun s:DoSyn + delfun s:DoSyntaxes +endfunction + +if exists("g:rainbow") && g:rainbow + augroup rainbow + autocmd BufWinEnter,FileType * call Rainbow() + augroup END +endif diff --git a/vim/.vim/spell/en.utf-8.add b/vim/.vim/spell/en.utf-8.add new file mode 100644 index 0000000..14fe17c --- /dev/null +++ b/vim/.vim/spell/en.utf-8.add @@ -0,0 +1,111 @@ +schedulable +mutex +hippocampus +anterograde +playtesters +gameplay +SQL +API +endianness +timestamp +Luehrs +doy +tozt +UIUC +Hydrogeology +Geochemists +Tcl +Tk +PDF +SVG +PostScript +http +TrueType +OpenMP +perl +org +MooseX +NonMoose +interoperate +github +IRC +multiplayer +plugin +TAEB +taeb +sartak +NetHack +nethack +Pty +sourceforge +OCaml +LablGTK +LuaIRC +luaforge +luairc +Lua +CTCP +DCC +CPAN +JavaScript +CSS +sed +Debian +Gentoo +XP +Cygwin +Darcs +Inline +webmaster +rollerblading +Illini +templating +programmatically +JS +Xslate +misparsed +CSV +ParseXLSX +XLSX +ParseExcel +WriteExcel +tmux +unshifted +xbindkeys +Firefox +remappings +Pentadactyl +Zsh +readline +vim +vimrc +zshrc +inputrc +structs +inlined +println +printf +builtin +parsable +Mozilla +inlinable +LLVM +backend +sandboxed +Acid2 +fn +mut +utf8 +interoperating +Mozilla's +stringification +enum +enums +destructuring +NES +blog +https +doyster +pdf +termcast +Avaaz diff --git a/vim/.vim/syntax/levdes.vim b/vim/.vim/syntax/levdes.vim new file mode 100644 index 0000000..a4f1982 --- /dev/null +++ b/vim/.vim/syntax/levdes.vim @@ -0,0 +1,304 @@ +" Vim syntax file +" Language: Dungeon Crawl level design (.des) files. +" Maintainer: Darshan Shaligram <scintilla@gmail.com> +" Last Change: 2007 Jun 28 +" Remark: Basic Vim syntax highlighting for Dungeon Crawl Stone Soup +" level design (.des) files. +" +" How to use this: +" * Put levdes.vim (this file) under ~/.vim/syntax (or similar directory for +" your system - usually C:\Program Files\Vim\vimfiles\syntax on Windows). +" * In your .vimrc, or in a new file ~/.vim/ftdetect/levdes.vim, add this line: +" au BufRead,BufNewFile *.des set syntax=levdes +" Thereafter, any .des files you edit in (g)vim will use syntax highlighting. + +if version < 600 + syntax clear +elseif exists("b:current_syntax") + finish +endif + +if !exists("main_syntax") + let main_syntax = 'des' +endif + +syn include @desLua syntax/lua.vim + +syn case match + +syn match desLuaBlock /\(lua\)\?\s\+{{/ contained +syn match desOtherLuaBlock /^\(prelude\|lua\|validate\|epilogue\|veto\)\?\s*{{/ contained +syn match desLuaBlockEnd /}}/ contained +"syn match desColonLine /^\s*:/ contained + +syn cluster desLuaGroup contains=desLuaBlock,desOtherLuaBlock,desLuaBlockEnd + +syn region desLua start=/^\s*\(lua\)\?\s*{{/ end=/}}\s*$/ contains=@desLuaGroup,@desLua keepend +syn region desLuaCol start=/^\s*:/ end=/$/ contains=@desLuaGroup,@desLua keepend +syn region desVal start=/^\s*validate\?\s*{{/ end=/}}\s*$/ contains=@desLuaGroup,@desLua keepend +syn region desPre start=/^\s*prelude\?\s*{{/ end=/}}\s*$/ contains=@desLuaGroup,@desLua keepend +syn region desEpi start=/^\s*epilogue\?\s*{{/ end=/}}\s*$/ contains=@desLuagroup,@deslua keepend +syn region desVet start=/^\s*veto\?\s*{{/ end=/}}\s*$/ contains=@desLuagroup,@deslua keepend + +setlocal iskeyword+=: +setlocal iskeyword+=- + +" These have extra matching going on, so not in desDeclarator (global) +syn keyword desDec NAME: COLOUR: SUBST: NSUBST: SHUFFLE: CLEAR: LROCKCOL: LFLOORCOL: contained + +syn region desSubst start=/^SUBST:\s*/ end=/$/ contains=desDec,desSubstArg,desSubstSep,@desMapElements keepend +syn region desNsubst start=/^NSUBST:\s*/ end=/$/ contains=desDec,desSubstArg,desSubstSep,@desMapElements keepend +syn region desShuffle start=/^SHUFFLE:\s*/ end=/$/ contains=desDec,desMapFrag keepend +syn region desClear start=/^CLEAR:\s*/ end=/$/ contains=desDec,desSubstArg keepend +syn region desColourline start=/^\(COLOUR\|L[A-Z]*COL\):/ end=/$/ contains=desDec,desColour keepend + +" Absolutely always highlight the vault name as just that +syn region desNameline start=/^NAME:/ end=/$/ contains=desDec,desVaultname keepend +syn match desVaultname /\w*/ contained + +syn match desGod contained /ashenzari\|beogh\|cheibriados\|dithmenos\|elyvilon/ +syn match desGod contained /fedhas\|gozag\|jiyva\|kikubaaqudgha\|lugonu/ +syn match desGod contained /makhleb\|nemelex_xobeh\|okawaru\|qazlal\|ru/ +syn match desGod contained /sif_muna\|trog\|vehumet\|xom\|yredelemnul\|zin/ +syn match desGod contained /the_shining_one/ + +syn keyword desDeclarator ORIENT: DEPTH: PLACE: MONS: FLAGS: default-depth: TAGS: CHANCE: WEIGHT: +syn keyword desDeclarator ITEM: KFEAT: KMONS: KITEM: KMASK: KPROP: MARKER: WELCOME: +syn keyword desDeclarator LFLOORTILE: LROCKTILE: FTILE: RTILE: TILE: SUBVAULT: FHEIGHT: DESC: ORDER: + +" keywords +" ORIENT +syn keyword desOrientation north south east west northwest northeast southwest southeast encompass float centre + +" DEPTH | PLACE +syn keyword desOrientation Depths Temple Orc Elf Lair Swamp Shoals Snake Spider Slime Vaults Blade Crypt Tomb +"Note: `Zot` totally highlights in e.g. the items `rune of Zot` and `Orb of Zot`. Not worth fixing. +syn keyword desOrientation Hell Dis Geh Coc Tar Zot Forest Abyss Pan Zig Lab Bazaar Trove Sewer Ossuary +syn keyword desOrientation Bailey IceCv Volcano WizLab + +"Note: This is the list above, but lower-cased +syn match desBranch contained /d\|temple\|orc\|elf\|lair\|swamp\|shoals\|snake\|spider\|slime\|vaults\|blade\|crypt\|tomb/ +syn match desBranch contained /hell\|dis\|geh\|coc\|tar\|zot\|forest\|abyss\|pan\|zig\|lab\|bazaar\|trove\|sewer\|ossuary/ +syn match desBranch contained /bailey\|icecv\|volcano\|wizlab/ + +syn match desBranchname contained /dungeon\|depths\|temple\|orcish_mines\|elven_halls\|lair\|swamp\|shoals/ +syn match desBranchname contained /snake_pit\|spider_nest\|slime_pits\|vaults\|hall_of_blades\|crypt\|tomb/ +syn match desBranchname contained /hell\|dis\|gehenna\|cocytus\|tartarus\|zot\|forest\|abyss\|pandemonium/ +syn match desBranchname contained /ziggurat\|labyrinth\|bazaar\|trove\|sewer\|ossuary/ +syn match desBranchname contained /bailey\|ice_cave\|volcano\|wizlab/ + +" TAGS +" in abyss.cc +syn keyword desOrientation abyss_exit +" in decks.cc and dgn-labyrinth.cc (without `minotaur` because monster) +syn keyword desOrientation lab generate_loot +" from dlua.ziggurat +syn keyword desOrientation ziggurat_pillar centered +" map building in dungeon.cc (`transparent` is handled later) +"Note: `dummy` mis-catches `training dummy` about half as often as actually used as tag +syn keyword desOrientation dummy arrival no_exits extra ruin layout pan decor +syn keyword desOrientation allow_dup uniq luniq +syn keyword desOrientation no_hmirror no_vmirror no_rotate +syn keyword desOrientation no_dump +" vault placement in maps.cc +syn keyword desOrientation unrand place_unique special_room tutorial +syn keyword desOrientation water_ok overwrite_floor_cell replace_portal +" V vault building (mostly dlua/v_layouts and v_rooms) +syn keyword desOrientation vaults_room vaults_empty vaults_hard no_windows preserve_wall + +" ITEM | KITEM (in mapdef.cc, without `random`) +syn keyword desOrientation randbook any good_item star_item superb_item gold nothing +syn keyword desOrientation acquire mundane damaged cursed randart not_cursed useful unobtainable +syn keyword desOrientation mimic no_mimic no_pickup no_uniq allow_uniq +"Note: `rotting` removed here which often caught `rotting devil` but was unused as item tag +syn keyword desOrientation corpse chunk skeleton never_decay + +" MONS | KMONS (in mapdef.cc) +syn keyword desOrientation fix_slot priest_spells actual_spells god_gift +syn keyword desOrientation generate_awake patrolling band +syn keyword desOrientation hostile friendly good_neutral fellow_slime strict_neutral neutral +"Note: `spectre` removed: mis-catches `silent spectre` but was unused as modifier (`spectral` exists) +syn keyword desOrientation zombie skeleton simulacrum spectral +syn keyword desOrientation seen always_corpse never_corpse +syn keyword desOrientation base nonbase +syn keyword desOrientation n_suf n_adj n_rpl n_the +syn keyword desOrientation name_suffix name_adjective name_replace name_definite +syn keyword desOrientation n_des n_spe n_zom n_noc +syn keyword desOrientation name_descriptor name_species name_zombie name_nocorpse + +" COLOUR +" Base +syn keyword desColour contained blue green cyan red magenta brown darkgrey +syn keyword desColour contained lightblue lightgreen lightcyan lightred lightmagenta yellow lightgrey white +" Elemental +syn keyword desColour contained fire ice earth electricity air poison water magic mutagenic warp enchant +syn keyword desColour contained heal holy dark death unholy vehumet beogh crystal blood smoke slime jewel +syn keyword desColour contained elven dwarven orcish flash kraken floor rock mist shimmer_blue decay +syn keyword desColour contained silver gold iron bone elven_brick waves tree mangrove tornado liquefied +syn keyword desColour contained orb_glow disjunction random + +" TILE +syn keyword desOrientation no_random + +" KFEAT +syn keyword desOrientation known mimic + +" abyss TAGS in mapdef.cc +syn keyword desOrientation abyss abyss_rune +syn keyword desOrientation overwritable +" KMASK (in mapdef.cc) +syn keyword desOrientation vault no_item_gen no_monster_gen no_pool_fixup no_wall_fixup opaque no_trap_gen + +" KPROP +syn keyword desOrientation bloody highlight mold no_cloud_gen no_tele_into no_submerge no_tide no_jiyva + +syn match desComment "^\s*#.*$&" + +"Note: `;` and `|` are necessary due to monster/randbook `spells:`, +" `.` can be an empty spell slot and `'` is contained in certain spell names, +" `$` and `-` are used in depth definitions (but `,` should not match there). +syn match desProperty /\w*:[[:alnum:]_\.';|\$-]\+/ contains=desAttribute +" Without `oneline` this wraps around and matches e.g. some SUBST: on the next line +syn region desAttribute start=/\</ end=/:/ contained oneline + +syn match desEntry "\<\w*_entry\>" contains=desBranch +syn match desEntry "\<serial_\w*\>" +syn match desEntry "\<no_species_\w\w\>" +syn match desEntry "\<\(no\)\=layout_\w*\>" +syn match desEntry "\<l\=uniq_\w*\>" +syn match desEntry "\<chance_\w*\>" +syn match desEntry "\<fallback_\w*\>" +syn match desEntry "\<vaults_entry_\w*\>" contains=desBranch +syn match desEntry "\<vaults_orient_\w\>" +syn match desEntry "\<altar_\w*\>" contains=desGod +syn match desEntry "\<uniq_altar_\w*\>" contains=desGod +syn match desEntry "\<temple_overflow_\w*\>" contains=desGod +syn match desEntry "\<overflow_altar_\w*\>" contains=desGod +syn match desEntry "\<enter_\w*\>" contains=desBranchname +syn match desEntry "\<exit_\w*\>" contains=desBranchname +syn match desEntry "\<ruin_\w*\>" contains=desBranchname + +" 'transparent' is a Vim syntax keyword +syn match desTransparent "\<transparent\>" +syn match desRange "\d*-\d*" +syn match desNumber "\s\d*" +syn match desWeight "w\(eight\)\=:\d*" +syn match desWeight "q:\d*\(-\d*\)\=" +syn match desSlash "/" + +syn keyword desMapBookend MAP ENDMAP contained +syn match desMapWall /x/ contained +syn match desMapPermaWall /X/ contained +syn match desMapStoneWall /c/ contained +syn match desMapGlassWall /[mno]/ contained +syn match desMapMetalWall /v/ contained +syn match desMapCrystalWall /b/ contained +syn match desMapTree /t/ contained + +syn match desMapFloor /\./ contained +syn match desMapDoor /[+=]/ contained + +syn match desMapShallow /W/ contained +syn match desMapWater /w/ contained +syn match desMapLava /l/ contained + +syn match desMapEntry /@/ contained +syn match desMapStairs /[}{)(\]\[]/ contained +syn match desMapTrap /[\^~]/ contained + +syn match desMapGold /\$/ contained +syn match desMapValuable /[%*|]/ contained + +syn match desMapMonst /[0-9]/ contained + +syn cluster desMapElements contains=desMapBookend +syn cluster desMapElements add=desMapWall,desMapPermaWall,desMapStoneWall,desMapGlassWall,desMapCrystalWall,desMapMetalWall,desMapTree +syn cluster desMapElements add=desMapFloor,desMapDoor +syn cluster desMapElements add=desMapShallow,desMapWater,desMapLava +syn cluster desMapElements add=desMapEntry,desMapStairs,desMapTrap +syn cluster desMapElements add=desMapGold,desMapValuable +syn cluster desMapElements add=desMapMons + +syn match desSubstArg /\S/ contained nextgroup=desSubstSep skipwhite +syn match desSubstSep /[:=]/ contained nextgroup=desMapFrag skipwhite +syn match desColourSep /[:=]/ contained nextgroup=desColour skipwhite +syn region desMapFrag start=/./ end=/$/ contains=@desMapElements contained + +syn region desMap start=/^\s*\<MAP\>\s*$/ end=/^\s*\<ENDMAP\>\s*$/ contains=@desMapElements keepend + +hi link desDec Statement +hi link desDeclarator Statement +hi link desVaultname Identifier +hi link desMapBookend Statement +hi link desLuaBlock Statement +hi link desOtherLuaBlock Statement +hi link desLuaBlockEnd Statement +"hi link desColonLine Statement +hi link desComment Comment +hi link desMap String +hi link desSubstArg String +hi link desRange String +hi link desEntry Type +hi link desNumber String +hi link desWeight String +hi link desSlash Comment + +hi link desSubstSep Type +hi link desOrientation Type +hi link desAttribute Type +hi link desProperty Special +hi link desGod Special +hi link desBranch Special +hi link desBranchname Special +hi link desColour Type +hi link desTransparent Type + +" It would be really nice if this worked for people who switch bg +" post-loading, like "normal" highlights do. Does someone know how? +if &bg == "dark" + hi desMapWall guifg=darkgray term=bold gui=bold ctermfg=white + hi desMapPermaWall guifg=#a0a000 gui=bold ctermfg=yellow + hi desMapStoneWall guifg=black gui=bold ctermfg=gray + hi desMapGlassWall guifg=lightcyan ctermfg=lightcyan + hi desMapMetalWall guifg=#004090 term=bold gui=bold ctermfg=lightblue + hi desMapCrystalWall guifg=#009040 term=bold gui=bold ctermfg=green + hi desMapTree guifg=#00aa00 ctermfg=darkgreen + hi desMapFloor guifg=#008000 ctermfg=darkgray + hi desMapDoor guifg=brown gui=bold ctermfg=white + hi desMapShallow guifg=lightcyan ctermfg=darkcyan + hi desMapWater guifg=lightblue ctermfg=darkblue + hi desMapLava guifg=red gui=bold ctermfg=darkred + + hi desMapEntry guifg=black guibg=white gui=bold ctermfg=white ctermbg=black + hi desMapStairs guifg=orange gui=bold ctermfg=magenta + hi desMapTrap guifg=red gui=bold ctermfg=darkred + + hi desMapGold guifg=#c09000 ctermfg=yellow + hi desMapValuable guifg=darkgreen gui=bold ctermfg=yellow + hi desMapMonst guifg=red ctermfg=red +else + hi desMapWall guifg=darkgray term=bold gui=bold ctermfg=brown + hi desMapPermaWall guifg=#a0a000 gui=bold ctermfg=yellow + hi desMapStoneWall guifg=black gui=bold ctermfg=darkgray + hi desMapGlassWall guifg=lightcyan ctermfg=lightcyan + hi desMapMetalWall guifg=#004090 term=bold gui=bold ctermfg=blue + hi desMapCrystalWall guifg=#009040 term=bold gui=bold ctermfg=green + hi desMapTree guifg=#00aa00 ctermfg=darkgreen + hi desMapFloor guifg=#008000 ctermfg=lightgray + hi desMapDoor guifg=brown gui=bold ctermfg=black ctermbg=brown + hi desMapShallow guifg=lightcyan ctermfg=darkcyan + hi desMapWater guifg=lightblue ctermfg=darkblue + hi desMapLava guifg=red gui=bold ctermfg=red + + hi desMapEntry guifg=black guibg=white gui=bold ctermfg=white ctermbg=black + hi desMapStairs guifg=orange gui=bold ctermfg=white + hi desMapTrap guifg=red gui=bold ctermfg=red + + hi desMapGold guifg=#c09000 ctermfg=yellow + hi desMapValuable guifg=darkgreen gui=bold ctermfg=lightgreen + hi desMapMonst guifg=red ctermfg=darkred +endif + +syn sync minlines=45 + +let b:current_syntax="levdes" diff --git a/vim/.vim/syntax/nhdes.vim b/vim/.vim/syntax/nhdes.vim new file mode 100644 index 0000000..dcafdf3 --- /dev/null +++ b/vim/.vim/syntax/nhdes.vim @@ -0,0 +1,99 @@ +" Vim syntax file +" Language: NetHack DES file +" Author: Pasi Kallinen <paxed@alt.org> +" Version: 20061119 +" Copyright: Copyright (c) 2006 Pasi Kallinen +" Licence: You may redistribute this under the same terms as NetHack itself + +if exists("b:current_syntax") + finish +endif + +syn sync minlines=30 + +" we're case sensitive +syn case match + +" some keywords use '-' +setlocal iskeyword+=- + +syn region nhDesComment start=/^[ \t]*#/ end=/$/ + +syn keyword nhDesCommandNoArgs + \ NOMAP RANDOM_CORRIDORS WALLIFY + +syn keyword nhDesCommandWithArgs + \ ALTAR BRANCH CHANCE CONTAINER CORRIDOR DOOR DRAWBRIDGE ENGRAVING + \ FLAGS FOUNTAIN GEOMETRY GOLD INIT_MAP LADDER LEVEL MAZE MAZEWALK + \ MESSAGE MONSTER NAME NON_DIGGABLE NON_PASSWALL OBJECT POOL PORTAL + \ RANDOM_MONSTERS RANDOM_OBJECTS RANDOM_PLACES REGION ROOM SINK STAIR + \ SUBROOM TELEPORT_REGION TRAP + +syn keyword nhDesRegister + \ align monster object place + +syn keyword nhDesConstant + \ altar arboreal asleep awake blessed bottom broken burn center chaos + \ closed coaligned \contained cursed down dust east engrave false filled + \ half-left half-right hardfloor hostile law left levregion lit locked + \ mark m_feature m_monster m_object neutral noalign nodoor nommap + \ noncoaligned none north noteleport open peaceful random right sanctum + \ shortsighted shrine south top true uncursed unfilled unlit up west + +syn region nhDesString start=/"/ end=/"/ +syn match nhDesChar /'.'/ + +syn match nhDesCoord /(\s*\d\+\s*,\s*\d\+\s*)/ +syn match nhDesRegion /(\s*\d\+\s*,\s*\d\+\s*,\s*\d\+\s*,\s*\d\+\s*)/ + +syn match nhDesMapCharDoor /[+S]/ contained +syn match nhDesMapCharFloor /[\.B]/ contained +syn match nhDesMapCharCorridor /[#H]/ contained +syn match nhDesMapCharWall /[\-\| ]/ contained +syn match nhDesMapCharWater /[WP}{]/ contained +syn match nhDesMapCharThrone /\\/ contained +syn match nhDesMapCharAir /A/ contained +syn match nhDesMapCharCloud /C/ contained +syn match nhDesMapCharLava /L/ contained +syn match nhDesMapCharSink /K/ contained +syn match nhDesMapCharIce /I/ contained +syn match nhDesMapCharTree /T/ contained +syn match nhDesMapCharIronbars /F/ contained +syn match nhDesMapCharLinenum /[0123456789]/ contained +" TODO: Any better way to do this? +syn match nhDesMapCharError /[^+S\.B#H\-\| WP}{\\ACLKITF0-9]/ contained + +syn region nhDesMap matchgroup=nhDesCommandNoArgs start=/^MAP$/ end=/^ENDMAP$/ + \ contains=nhDesMapCharError,nhDesMapCharDoor,nhDesMapCharFloor, + \ nhDesMapCharCorridor,nhDesMapCharWall,nhDesMapCharWater, + \ nhDesMapCharThrone,nhDesMapCharAir,nhDesMapCharCloud,nhDesMapCharLava, + \ nhDesMapCharSink,nhDesMapCharIce,nhDesMapCharTree,nhDesMapCharIronbars, + \ nhDesMapCharLinenum + +hi def link nhDesComment Comment +hi def link nhDesCommandNoArgs KeyWord +hi def link nhDesCommandWithArgs KeyWord +hi def link nhDesRegister Constant +hi def link nhDesConstant Constant +hi def link nhDesString String +hi def link nhDesChar String +hi def link nhDesCoord Number +hi def link nhDesRegion Number + +highlight nhDesMapCharDoor ctermbg=black ctermfg=brown guibg=black guifg=brown +highlight nhDesMapCharFloor ctermbg=black ctermfg=grey guibg=black guifg=grey +highlight nhDesMapCharCorridor ctermbg=black ctermfg=grey guibg=black guifg=grey +highlight nhDesMapCharWall ctermbg=black ctermfg=grey guibg=black guifg=grey +highlight nhDesMapCharWater ctermbg=black ctermfg=darkblue guibg=black guifg=darkblue +highlight nhDesMapCharThrone ctermbg=black ctermfg=yellow guibg=black guifg=yellow +highlight nhDesMapCharAir ctermbg=black ctermfg=lightblue guibg=black guifg=lightblue +highlight nhDesMapCharCloud ctermbg=black ctermfg=grey guibg=black guifg=grey +highlight nhDesMapCharLava ctermbg=black ctermfg=red guibg=black guifg=red +highlight nhDesMapCharSink ctermbg=black ctermfg=grey guibg=black guifg=grey +highlight nhDesMapCharIce ctermbg=black ctermfg=lightblue guibg=black guifg=lightblue +highlight nhDesMapCharTree ctermbg=black ctermfg=green guibg=black guifg=green +highlight nhDesMapCharIronbars ctermbg=black ctermfg=cyan guibg=black guifg=cyan +highlight nhDesMapCharLinenum ctermbg=black ctermfg=darkgrey guibg=black guifg=darkgrey +highlight nhDesMapCharError ctermbg=red ctermfg=yellow guibg=red guifg=yellow + +let b:current_syntax = "nhdes" diff --git a/vim/.vim/syntax/perl.vim b/vim/.vim/syntax/perl.vim new file mode 100644 index 0000000..c70fa27 --- /dev/null +++ b/vim/.vim/syntax/perl.vim @@ -0,0 +1 @@ +let perl_sub_signatures = 1 |