" Tim Holt's vimrc file " Created probably in 2010, Idunno. " modified extensively continuously since then. " " This file is full of ‘*’ command ‘links’ __in_this_format. " " Free to use for anyone "│-v-1 │ To-Do's "└─────┴───────── " (not actually settings, just settings todo's) " TODO Look into the 'tabline' setting " TODO When numbers are off, change window width. " " TODO Use winnr("$"), winnr(), winfixwidth to create a better resize " This may be obsolete, but I don’t think it is—it’s still necessary when " not on a wide screen. " TODO Make “i_Ctrl-R ,” put the “+” yank buffer’s contents. " " TODO mappings that “Hesitate”: " i " w " TODO Look into the conceal setting and this reddit thread: " http://redd.it/okzja " TODO Set up some cool Arpeggio mappings. " Simulate touchcursor for vim arrow-key reassignments. " TODO Look into the 'comments' setting and gq (to add "/// " and stuff) " TODO Actually clone vim-origami plugin, rather than just download. " TODO Extract multi-compatible font changing shpiel to a function, instead " of repetitive if, else block. " TODO Make special vim characters into unicode symbols (like the " window-dividers into box characters, and 'no line' characters into " null-set characters. " TODO Have timdisplaymode switch display mode switched into! " TODO Write some filter-switching function, mapped to F or " something, that changes NERDTree's filter list. Maybe with a menu. "│-v-1 │ “precedence” necessaries. "└─────┴─────────────────────────── "For virtually everything, and sanity in general: set nocp filetype plugin on "For that which __requires_utf_8: set encoding=utf8 " Note: Make sure to link here from _every_ line that has a prerequisite, " and from every location in this file where the prerequisite would more " naturally be categorized. "│-v-1 │ Plug-in Settings "└─┬───┴─┬──────────────── "│-v-2 │ plug-in manager "└─────┴───────────────── " pathogen startup stuff filetype off call pathogen#infect() call pathogen#helptags() filetype plugin on "│-v-2 │ Individual plug-ins "└─┬───┴─┬─────────────────── "│-v-3 │ Gundo Settings "└─────┴──────────────── nnoremap u :GundoToggle let g:gundo_help=1 let g:gundo_right=0 let g:gundo_preview_bottom=0 " Mappings (@__gundo_mappings): " toggle Gundo "│-v-3 │ vimwiki Settings "└─────┴────────────────── let g:vimwiki_camel_case = 0 let wiki_1 = {} let wiki_1.path = '~/Dropbox/Vim/vimwiki/' let wiki_1.nested_syntaxes = {'c++': 'cpp', 'asm': 'asm', 'sh': 'sh'} let wiki_2 = {} let wiki_2.path = '~/Dropbox/timwrite/vimfriendly/Inhuman_Universe/wiki/' let wiki_3 = {} let wiki_3.path = '~/Dropbox/code/ZigZagDungeon/productionwiki/' let g:vimwiki_list = [wiki_1, wiki_2, wiki_3] "│-v-3 │ Full-Screen Mode Settings "└─────┴─────────────────────────── " Mappings (@__full_screen_mappings): function! ToggleFullScreen() if has('win32') :call libcallnr("gvimfullscreen.dll", "ToggleFullScreen", 0) endif endfunction "│-v-3 │ 'a' settings "└─────┴────────────── " Mappings (@__a_mappings): "Hopefully, changing the default when associated source doesn't yet exist. let g:alternateExtensions_h = "cpp,c,cxx,cc,CC" "│-v-3 │ OmniCppComplete Settings "└─────┴────────────────────────── au BufNewFile,BufRead,BufEnter *.cpp,*.h set omnifunc=omni#cpp#complete#Main let OmniCpp_ShowPrototypeInAbbr = 1 "│-v-3 │ PowerShell syntaxy-stuff settings "└─────┴─────────────────────────────────── au BufNewFile,BufRead,BufEnter *.ps1 set filetype=ps1 "│-v-3 │ Rainbow Parentheses Settings "└─────┴────────────────────────────── " (Steve Losh’s modified version, cleaned up and jazz) " Mappings (@__rainbow_parentheses_mappings): autocmd BufEnter * RainbowParenthesesLoadRound autocmd BufEnter * RainbowParenthesesLoadBraces "autocmd BufEnter * RainbowParenthesesLoadChevrons "│-v-3 │ Powerline Settings "└─────┴──────────────────── let Powerline_cache_file = "" let Powerline_symbols = "fancy" "│-v-3 │ UltiSnips Settings "└─────┴──────────────────── let g:UltiSnipsSnippetsDir = "~/Dropbox/Vim/GlobalRuntimePath/UltiSnipsSnippets/" let g:UltiSnipsSnippetDirectories=["UltiSnips", "UltiSnipsSnippets"] let g:UltiSnipsEditSplit = "horizontal" let g:UltiSnipsUsePythonVersion = 2 " Wasn't compatible with digraphs, so I thought I'd try a remap. " Also wasn't compatible with my custom use of , even though it " is after a reestablishment of said custom use, so there you go. let g:UltiSnipsExpandTrigger="" let g:UltiSnipsJumpForwardTrigger="" let g:UltiSnipsJumpBackwardTrigger="" " Enable importing of custom modules for python interpolation. " TODO Universalize this. py import sys; sys.path.append("C:\\Users\\atimh_000\\Dropbox\\Vim\\GlobalRuntimePath\\UltiSnipsSnippets\\pymodules\\") "│-v-3 │ Arpeggio Settings "└─────┴─────────────────── call arpeggio#load() "│-v-3 │ EasyMotion "└─────┴──────────── let g:EasyMotion_leader_key = '(' "│-v-3 │ Indent Guides "└─────┴─────────────── let g:indent_guides_space_guides = 0 "│-v-3 │ Showmarks "└─────┴─────────── let showmarks_enable = 0 "let showmarks_include = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ.'`^<>[]{}()\"" let showmarks_include = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ.'`^" let g:showmarks_ignore_type = "q" let showmarks_textlower = "\t:" let showmarks_textupper = "\t:" let showmarks_textother = "\t:" "│-v-3 │ NERD Tree "└─────┴─────────── " Mappings (@__nerd_tree_mappings): " let NERDTreeDirArrows=1 "│-v-3 │ latex-suite "└─────┴───────────── set grepprg=grep\ -nH\ $* "│-v-3 │ Surround "└─────┴────────── " lenticular brackets let g:surround_{char2nr("l")} = "〖\r〗" " directional quotes let g:surround_{char2nr("q")} = "“\r”" "│-v-1 │ Set-up "└─┬───┴─┬────── "│-v-2 │ Behavior "└─┬───┴─┬──────── "│-v-3 │ “meta” (settings settings) "└─────┴──────────────────────────── " Quick settings access " TODO: Move the function to function area, remap to remap area? " Honestly, I think not—an exception makes sense here, at least. function! MyQuickSettings() :tabedit $MYVIMRC :lcd $HOME :vs ~/Dropbox/Vim/vimrc.vim :vertical resize 101 endfunction nnoremap :call MyQuickSettings() " Reload vimrc when saved au! BufWritePost $MYVIMRC source $MYVIMRC " Doesn’t work, because MyRefreshFullScreen doesn’t work. " TODO: evaluate this thing. function! MyRefreshVimrc() :source $MYVIMRC :call MyRefreshFullScreen() endfunction "│-v-3 │ Tweakings/Feature Settings "└─┬───┴─┬────────────────────────── "│-v-4 │ Intended/Built-In Settings "└─┬───┴─┬────────────────────────── "│-v-5 │ Editing Settings "└─────┴────────────────── set expandtab set shiftwidth=2 set softtabstop=2 set tabstop=2 set backspace=indent,eol,start set ruler :syntax enable :set cindent " Stopped using this when I started using Powershell more. ":set shellslash :set switchbuf=useopen,usetab,newtab " Allows the closing of buffers without saving. set hidden " allows cursor position past true end of line set virtualedit=all " Whether jumping to another line (like with "G") goes to the start " of the line, or tries to stay in the same column. set nostartofline "│-v-5 │ vimdiff settings "└─────┴────────────────── set diffopt=filler,vertical,context:3 "│-v-5 │ Spelling "└─────┴────────── set spelllang=en_us,es,eo "│-v-5 │ Status Line "└─────┴───────────── ":set statusline=%F%m%r%h%w\ (%{&ff})\ typ:%Y\ ASCII=\%04.8b\ HEX=\%04.4B\ %l,%v %p%%\ LEN=%L "set statusline=%<[%02n]\ %F%(\ %m%h%w%y%r%)\ %a%=\ %8l,%c%V/%L\ (%P)\ [%08O:%02B] set statusline=%<[%02n]\ %F%(\ %m%h%w%y%r%)\ %a%=\ %8l,%c%V/%L\ (%P)\ [%02B] set laststatus=2 " “The value of this option influences when the " last window will have a status line…” "│-v-5 │ Folds "└─────┴────────── :set foldmethod=marker :set foldmarker=//v,//^ :set commentstring=%s "│-v-5 │ WildMenu "└─────┴────────── set wildmode=longest,list,full :set wildmenu "│-v-5 │ persistent undo "└─────┴───────────────── set undofile set undodir=~/vim_undo_files "│-v-5 │ search settings "└─────┴───────────────── set ignorecase set smartcase set gdefault set incsearch set showmatch set hlsearch " Mappings (@__search_mappings): " - Switch off search highlighting. "│-v-5 │ netrw settings "└─────┴──────────────── let g:netrw_liststyle=3 "│-v-5 │ External Shell Settings "└─────┴───────────────────────── " __requires_utf_8: " The && !(&diff) is there because shell=powershell.exe breaks " vimdiff. if has('win32') && !(&diff) && 0 set shell=powershell.exe set shellcmdflag=-c set shellpipe=| set shellredir=> endif "│-v-5 │ mkview settings "└─────┴───────────────── set viewdir=~/Dropbox/Vim/GlobalRuntimePath/view/ "│-v-5 │ Custom Digraph Settings "└─────┴───────────────────────── " Esperanto: :digraph Cx 264 :digraph cx 265 :digraph Gx 284 :digraph gx 285 :digraph Hx 292 :digraph hx 293 :digraph Jx 308 :digraph jx 309 :digraph Sx 348 :digraph sx 349 :digraph Ux 364 :digraph ux 365 " Graphical, dark diamond suit and dark heart suit. :digraph cD 9830 :digraph cH 9829 " Some assorted punctuation "ellipsis :digraph .. 8230 :digraph ** 8729 "│-v-4 │ Customized behavior "└─┬───┴─┬─────────────────── "│-v-5 │ (function) Toggle Spell Checking. "└─────┴─────────────────────────────────── " (mapping @__spell_check_mapping) function! g:ToggleSpellMode() :set spell! if &l:spell echo "Spell check ON" else echo "Spell check OFF" endif endfunction "│-v-5 │ (function) Toggle Fixed Window Width. "└─────┴─────────────────────────────────────── " (mapping @__fixed_window_width) function! g:TimToggleWindowFixedWidth() :set winfixwidth! if &l:winfixwidth echo "Fixed Window Width ON" else echo "Fixed Window Width OFF" endif endfunction "│-v-5 │ (function) Toggle Fixed Window Height. "└─────┴─────────────────────────────────────── " (mapping @__fixed_window_height) function! g:TimToggleWindowFixedHeight() :set winfixheight! if &l:winfixheight echo "Fixed Window Height ON" else echo "Fixed Window Height OFF" endif endfunction "│-v-5 │ (function) Box character (turburul) hax "└─────┴───────────────────────────────────────── " This: " r---—v-, " | | | " >----+-< " | | | " >————+—< " | | | " L----^—’ " " Becomes This: " ┌────┬─┐ " │ │ │ " ├────┼─┤ " │ │ │ " ├────┼─┤ " │ │ │ " └────┴─┘ " (mapping @__box_characters_mapping) function! g:BoxCharacters() :s'r'┌'e gv :s','┐'e gv :s'’'┘'e gv :s/'/┘/e gv :s'L'└'e gv :s'|'│'e gv :s'-'─'e gv :s'—'─'e gv :s'+'┼'e gv :s'\^'┴'e gv :s'>'├'e gv :s'v'┬'e gv :s'T'┬'e gv :s'<'┤'e endfunction "│-v-5 │ (functions) Multi-Window automatic stuff "└─────┴────────────────────────────────────────── " These settings rely heavily on the specific ways I personally use Vim. " (auto-commands @__multi_window_autocmds) function! TimWinLeaveWithGundo() if !GundoInTab() && g:timdisplaymode == 'code' ":vertical resize :set nowrap ":set norelativenumber ":set nonumber endif endfunction function! TimWinEnterWithGundo() if !GundoInTab() && g:timdisplaymode == 'code' if g:tim_number_mode == 0 ":vertical resize 81 else ":vertical resize 85 endif :set wrap :call g:TimDisplayNumbers() endif endfunction function! GundoInTab() let s:current_tabpagebuflist = tabpagebuflist() for i in s:current_tabpagebuflist if bufname(i) == "__Gundo__" return 1 endif endfor return 0 endfunction "│-v-5 │ (functions) Line-number Mode switching "└─────┴──────────────────────────────────────── " (mappings @__line_number_modes_mappings) let g:tim_number_mode = 1 function! g:ToggleNuMode(...) if a:0 if(a:1 != -1) let g:tim_number_mode = a:1 else let g:tim_number_mode -= 1 endif else let g:tim_number_mode += 1 endif if g:tim_number_mode > 2 let g:tim_number_mode = 0 endif if g:tim_number_mode < 0 let g:tim_number_mode = 2 endif call g:TimDisplayNumbers() endfunc function! g:TimDisplayNumbers() if(g:tim_number_mode == 1) if g:timdisplaymode == 'code' ":vertical resize 85 endif set number elseif(g:tim_number_mode == 2) if g:timdisplaymode == 'code' ":vertical resize 85 endif set relativenumber else if g:timdisplaymode == 'code' ":vertical resize 81 endif set nonumber set norelativenumber endif endfunc "│-v-5 │ (functions) View and Folds saving "└─────┴─────────────────────────────────── " (mappings @__viewdir_mappings) " TODO: for realsy, this needs to be its own script in the " repository " TODO: echo the current mode on toggle " TODO: loadview automatically in zigzagproj mode on file loading function! g:toggleviewdir() if g:viewdirmode == "normal" let g:viewdirmode = "zigzagproj" else let g:viewdirmode = "normal" endif call g:applyviewdir() endfunction function! g:applyviewdir() if g:viewdirmode == "normal" set viewdir=~/Dropbox/Vim/GlobalRuntimePath/view/ else set viewdir=~/Dropbox/code/ZigZagDungeon/vimview/ endif "echo " endfunction let g:viewdirmode = "normal" call g:applyviewdir() "│-v-3 │ Mappings, Auto-Commands & Abbreviations. "└─┬───┴─┬──────────────────────────────────────── "│-v-4 │ Mappings "└─┬───┴─┬──────── "│-v-5 │ Leader Key Settings "└─────┴───────────────────── let mapleader = "," " doesn't work?: noremap " Still want this functionality! map \u nnoremap \ , "│-v-5 │ navigation remaps "└─────┴───────────────────── "nnoremap % "vnoremap % nnoremap t :tabs nnoremap j gj nnoremap k gk nnoremap gj j nnoremap gk k nnoremap h h nnoremap l l nnoremap j j nnoremap k k "│-v-5 │ Normal-Mode alternative access. "└─────┴───────────────────────────────── " TODO: Change the windows mapping to changing caps lock to esc. "if has('win32') " inoremap hh " cnoremap hh "endif "Arpeggio inoremap tn "Arpeggio cnoremap tn "│-v-5 │ toggle showing of invisible characters "└─────┴──────────────────────────────────────── nnoremap I :call g:ToggleList() " TODO finish this indicator and stick it in the right place. function! g:ToggleList() :set list! if &l:list echo "List Invisible Characters ON" else echo "List Invisible Characters OFF" endif endfunction "│-v-5 │ OS clip-board easy-integration. "└─────┴───────────────────────────────── nnoremap y "+y vnoremap y "+y nnoremap Y "+Y vnoremap Y "+Y nnoremap p "+p vnoremap p "+p nnoremap P "+P vnoremap P "+P "│-v-5 │ Jump to file shortcut "└─────┴─────────────────────── nnoremap f gf "│-v-5 │ Insertion mode completion shortcuts "└─────┴───────────────────────────────────── "File-name completion inoremap " Current & included files completion inoremap "│-v-5 │ __search_mappings: "└─────┴──────────────────── " Switch off search highlighting. nnoremap :noh "│-v-5 │ Quick window-width reset "└─────┴────────────────────────── nnoremap :vertical resize 85 nnoremap :vertical resize 85 "│-v-5 │ Generate Tag files "└─────┴──────────────────── "map :!ctags -R --c++-kinds=+p --fields=+iaS --extra=+q . "map :!ctags -R --c++-kinds=+p --fields=+iaS --extra=+q *.h *.cpp map :!ctags -R --c++-kinds=+p --fields=+iaS --extra=+q --language-force=C++ . "│-v-5 │ Arpeggio shortcuts experiment "└─────┴─────────────────────────────── "Arpeggio inoremap s, / "Arpeggio inoremap s. \ "Arpeggio cnoremap s, / "Arpeggio cnoremap s. \ "│-v-5 │ Digraph "└─────┴───────── Arpeggio inoremap jk "│-v-5 │ mappings to customized-behavior & functions. "└─┬───┴─┬──────────────────────────────────────────── "│-v-6 │ __spell_check_mapping: "└─────┴──────────────────────── nnoremap :call g:ToggleSpellMode() "│-v-6 │ __fixed_window_width: "└─────┴─────────────────────── nnoremap W :call g:TimToggleWindowFixedWidth() "│-v-6 │ __fixed_window_height: "└─────┴─────────────────────── nnoremap H :call g:TimToggleWindowFixedHeight() "│-v-6 │ __box_characters_mapping: "└─────┴─────────────────────────── vnoremap x :call g:BoxCharacters() "│-v-6 │ __line_number_modes_mappings: "└─────┴─────────────────────────────── "nnoremap n :call g:ToggleNuMode() nnoremap NN :call g:ToggleNuMode(-1) nnoremap n0 :call g:ToggleNuMode(0) nnoremap no :call g:ToggleNuMode(0) nnoremap nO :call g:ToggleNuMode(0) nnoremap na :call g:ToggleNuMode(1) nnoremap nA :call g:ToggleNuMode(1) nnoremap nr :call g:ToggleNuMode(2) nnoremap nR :call g:ToggleNuMode(2) "│-v-6 │ __display_mode_mappings: "└─────┴────────────────────────── nnoremap d :call ToggleDisplayMode() "│-v-6 │ __viewdir_mappings: "└─────┴───────────────────── nnoremap :call g:toggleviewdir() "│-v-6 │ Insert literal tab character "└─────┴────────────────────────────── inoremap "│-v-6 │ Insert date: "└─────┴────────────── nmap i=strftime("%Y-%m-%d") imap =strftime("%Y-%m-%d") vmap di=strftime("%Y-%m-%d") nmap i=strftime("%Y-%m-%d %a %I:%M %p") imap =strftime("%Y-%m-%d %a %I:%M %p") vmap di=strftime("%Y-%m-%d %a %I:%M %p") "│-v-6 │ Remove i_ctrl-u: "└─────┴────────────────── " When using to trigger digraphs, is a hugely frequent " typo. Whereas is a command I’d never actually want to use. " (My arpeggio jk trigger for digraphs was incompatible with the " crappy vimlatex plugin, but even without it, is useless.) imap "│-v-5 │ mappings to Plug-ins "└─┬───┴─┬──────────────────── "│-v-6 │ __gundo_mappings: "└─────┴─────────────────── " toggle Gundo: nnoremap u :GundoToggle "│-v-6 │ __full_screen_mappings: "└─────┴───────────────────────── map :call ToggleFullScreen() "│-v-6 │ __a_mappings: "└─────┴─────────────── nnoremap a :AV nnoremap s :AV " TODO: move this somewhere more sensible: nnoremap v :vs "│-v-6 │ __rainbow_parentheses_mappings: "└─────┴───────────────────────────────── nnoremap , :RainbowParenthesesToggle "│-v-6 │ __nerd_tree_mappings: "└─────┴─────────────────────── nnoremap . :NERDTree "│-v-4 │ Auto-commands "└─┬───┴─┬───────────── "│-v-5 │ Independent auto-commands "└─────┴─────────────────────────── autocmd BufRead,BufNewFile *.txtfmt setfiletype txtfmt "│-v-5 │ function auto-commands "└─┬───┴─┬────────────────────── "│-v-6 │ __multi_window_autocmds "└─────┴───────────────────────── autocmd WinLeave * :call TimWinLeaveWithGundo() autocmd WinEnter * :call TimWinEnterWithGundo() "│-v-4 │ Abbreviations "└─┬───┴─┬───────────── "│-v-5 │ Shortcuts "└─────┴─────────── ab ?! ‽ ab !? ‽ :ab ,.0 ⁰ :ab ,.1 ¹ :ab ,.2 ² :ab ,.3 ³ :ab ,.4 ⁴ :ab ,.5 ⁵ :ab ,.6 ⁶ :ab ,.7 ⁷ :ab ,.8 ⁸ :ab ,.9 ⁹ "│-v-5 │ Corrections "└─────┴───────────── :cab Wa wa "│-v-2 │ Appearance "└─┬───┴─┬────────── "│-v-3 │ Built-in Settings "└─┬───┴─┬───────────────── "│-v-4 │ GUI Options (default is "egmrLtT") "└─────┴──────────────────────────────────── :set guioptions=c " Note that fullscreen plugin doesn't work well with anything but null " (or similar). "│-v-4 │ Color scheme "└─────┴────────────── set t_Co=256 " Not sure if this one's actually necessary. :set background=dark if &t_Co > 2 || has("gui_running") ":colorscheme timbat :colorscheme badwolf ":colorscheme timatrix " I've put a lot of my own adjustments into this one. ":colorscheme pyte else :colorscheme morodark endif "│-v-4 │ Current-Row-Column highlighting "└─────┴───────────────────────────────── "autocmd WinLeave * set nocursorline nocursorcolumn "autocmd WinEnter * set cursorline cursorcolumn "set cursorline cursorcolumn autocmd WinLeave * set nocursorline autocmd WinEnter * set cursorline set cursorline "│-v-4 │ Window Width & Such "└─────┴───────────────────── set winminwidth=5 "│-v-4 │ Invisible characters depiction. "└─────┴───────────────────────────────── " __requires_utf_8: set listchars=tab:│·,trail:·,extends:→ au BufNewFile,BufRead *.cpp,*.h,*.vim,*.rb,*.java,*.snippets,*.py set list "│-v-4 │ Miscellaneous "└─────┴─────────────── set showcmd setglobal display=lastline,uhex "│-v-4 │ Color Column "└─────┴────────────── set colorcolumn=81,101,121 "│-v-3 │ Custom Functions "└─┬───┴─┬──────────────── "│-v-4 │ Display Mode Stuff "└─────┴──────────────────── " Mappings (@__display_mode_mappings): function! g:ApplyDisplayMode(...) if a:0 let g:timdisplaymode = a:1 endif if g:timdisplaymode == 'code' "set cursorcolumn set nospell " -v- if &filetype=='vimwiki' setlocal linebreak else set nolinebreak endif if has('win32') " :set guifont=consolas:h12 " set guifont=Liberation\ Mono:h9 set guifont=Liberation\ Mono:h12 else set guifont=Liberation\ Mono\ 12 endif colorscheme badwolf set display-=lastline let &showbreak = '' set foldmarker=-v-,-^- "au WinEnter * set cursorcolumn " -^- elseif g:timdisplaymode == 'composition' set nocursorcolumn setlocal spell " -v- inoremap b1z=wi setlocal linebreak if has('win32') set guifont=Liberation\ Mono:h13 else set guifont=Liberation\ Mono\ 13 endif "colorscheme timatrix setlocal display+=lastline let &showbreak = ' ' " setlocal foldmarker={{{,}}} set foldmarker=-v-,-^- au BufEnter * set nocursorcolumn endif " -^- endfunction let g:timdisplaymode = '' call g:ApplyDisplayMode('code') function! ToggleDisplayMode() if g:timdisplaymode == 'code' let g:timdisplaymode = 'composition' else let g:timdisplaymode = 'code' endif call g:ApplyDisplayMode() endfunction "│-v-1 │ Transient settings "└─────┴──────────────────── " This is meant for sourcing in convenience settings that don't really " belong in this file. :source ~/Dropbox/code/zigzagdungeon/vimsetup.vim " vim: set fmr=-v-,-^- fdm=marker cms=//%s et ts=2 sw=2 sts=2 :