Advertisement
atimholt

My vimrc

Jan 31st, 2012
464
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. " Tim Holt's vimrc file
  2. " Created probably in 2010, Idunno.
  3. "   modified extensively continuously since then.
  4. "
  5. " This file is full of ‘*’ command ‘links’ __in_this_format.
  6. "
  7. " Free to use for anyone
  8.  
  9. "│-v-1 │ To-Do's
  10. "└─────┴─────────
  11.   " (not actually settings, just settings todo's)
  12.   " TODO Look into the 'tabline' setting
  13.   " TODO When numbers are off, change window width.
  14.   "
  15.   " TODO Use winnr("$"), winnr(), winfixwidth to create a better resize
  16.     " This may be obsolete, but I don’t think it is—it’s still necessary when
  17.     " not on a wide screen.
  18.   " TODO Make “i_Ctrl-R ,” put the “+” yank buffer’s contents.
  19.   "
  20.   " TODO mappings that “Hesitate”:
  21.     " <leader>i
  22.     " <leader>w
  23.   " TODO Look into the conceal setting and this reddit thread:
  24.   "   http://redd.it/okzja
  25.   " TODO Set up some cool Arpeggio mappings.
  26.   " TODO Look into the 'comments' setting and gq (to add "/// " and stuff)
  27.  
  28. "│-v-1 │ “precedence” necessaries.
  29. "└─────┴───────────────────────────
  30.   "For virtually everything, and sanity in general:
  31.   set nocp
  32.   filetype plugin on
  33.  
  34.   "For that which __requires_utf_8:
  35.   set encoding=utf8
  36.  
  37.   " Note: Make sure to link here from _every_ line that has a prerequisite,
  38.   " and from every location in this file where the prerequisite would more
  39.   " naturally be categorized.
  40.  
  41.  
  42. "│-v-1 │ Plug-in Settings
  43. "└─┬───┴─┬────────────────
  44.   "│-v-2 │ plug-in manager
  45.   "└─────┴─────────────────
  46.     " pathogen startup stuff
  47.       filetype off
  48.       call pathogen#infect()
  49.       call pathogen#helptags()
  50.       filetype plugin on
  51.  
  52.  
  53.   "│-v-2 │ Individual plug-ins
  54.   "└─┬───┴─┬───────────────────
  55.     "│-v-3 │ Gundo Settings
  56.     "└─────┴────────────────
  57.       nnoremap <silent> <leader>u :GundoToggle<cr>
  58.       let g:gundo_help=1
  59.       let g:gundo_right=0
  60.       let g:gundo_preview_bottom=0
  61.  
  62.       " Mappings (@__gundo_mappings):
  63.         " toggle Gundo
  64.  
  65.     "│-v-3 │ vimwiki Settings
  66.     "└─────┴──────────────────
  67.       let g:vimwiki_camel_case = 0
  68.  
  69.       let wiki_1 = {}
  70.       let wiki_1.path = '~/Dropbox/Vim/vimwiki/'
  71.       let wiki_1.nested_syntaxes = {'c++': 'cpp', 'asm': 'asm', 'sh': 'sh'}
  72.  
  73.       let wiki_2 = {}
  74.       let wiki_2.path = '~/Dropbox/timwrite/vimfriendly/Inhuman_Universe/wiki/'
  75.  
  76.       let wiki_3 = {}
  77.       let wiki_3.path = '~/Dropbox/code/ZigZagDungeon/productionwiki/'
  78.  
  79.       let g:vimwiki_list = [wiki_1, wiki_2, wiki_3]
  80.  
  81.     "│-v-3 │ Full-Screen Mode Settings
  82.     "└─────┴───────────────────────────
  83.       " Mappings (@__full_screen_mappings):
  84.       function! ToggleFullScreen()
  85.         if has('win32')
  86.           :call libcallnr("gvimfullscreen.dll", "ToggleFullScreen", 0)
  87.         endif
  88.       endfunction
  89.  
  90.     "│-v-3 │ 'a' settings
  91.     "└─────┴──────────────
  92.       " Mappings (@__a_mappings):
  93.  
  94.       "Hopefully, changing the default when associated source doesn't yet exist.
  95.       let g:alternateExtensions_h = "cpp,c,cxx,cc,CC"
  96.  
  97.     "│-v-3 │ OmniCppComplete Settings
  98.     "└─────┴──────────────────────────
  99.       au BufNewFile,BufRead,BufEnter *.cpp,*.h set omnifunc=omni#cpp#complete#Main
  100.       let OmniCpp_ShowPrototypeInAbbr = 1
  101.  
  102.     "│-v-3 │ PowerShell syntaxy-stuff settings
  103.     "└─────┴───────────────────────────────────
  104.       au BufNewFile,BufRead,BufEnter *.ps1 set filetype=ps1
  105.  
  106.     "│-v-3 │ Rainbow Parentheses Settings
  107.     "└─────┴──────────────────────────────
  108.       " (Steve Losh’s modified version, cleaned up and jazz)
  109.  
  110.       " Mappings (@__rainbow_parentheses_mappings):
  111.       autocmd BufEnter * RainbowParenthesesLoadRound
  112.       autocmd BufEnter * RainbowParenthesesLoadBraces
  113.       "autocmd BufEnter * RainbowParenthesesLoadChevrons
  114.  
  115.     "│-v-3 │ Powerline Settings
  116.     "└─────┴────────────────────
  117.       let Powerline_cache_file = ""
  118.       let Powerline_symbols = "fancy"
  119.  
  120.     "│-v-3 │ UltiSnips Settings
  121.     "└─────┴────────────────────
  122.       let g:UltiSnipsSnippetsDir = "~/Dropbox/Vim/GlobalRuntimePath/UltiSnipsSnippets/"
  123.       let g:UltiSnipsSnippetDirectories=["UltiSnips", "UltiSnipsSnippets"]
  124.       let g:UltiSnipsEditSplit = "horizontal"
  125.       let g:UltiSnipsUsePythonVersion = 2
  126.  
  127.       " Wasn't compatible with digraphs, so I thought I'd try a remap.
  128.       let g:UltiSnipsExpandTrigger="<c-t>"
  129.       let g:UltiSnipsJumpForwardTrigger="<tab>"
  130.       let g:UltiSnipsJumpBackwardTrigger="<s-tab>"
  131.  
  132.     "│-v-3 │ Arpeggio Settings
  133.     "└─────┴───────────────────
  134.       call arpeggio#load()
  135.  
  136.     "│-v-3 │ EasyMotion
  137.     "└─────┴────────────
  138.       let g:EasyMotion_leader_key = '('
  139.  
  140.     "│-v-3 │ Indent Guides
  141.     "└─────┴───────────────
  142.       let g:indent_guides_space_guides = 0
  143.  
  144.     "│-v-3 │ Showmarks
  145.     "└─────┴───────────
  146.       let showmarks_enable = 0
  147.       "let showmarks_include = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ.'`^<>[]{}()\""
  148.      let showmarks_include = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ.'`^"
  149.       let g:showmarks_ignore_type = "q"
  150.  
  151.       let showmarks_textlower = "\t:"
  152.       let showmarks_textupper = "\t:"
  153.       let showmarks_textother = "\t:"
  154.  
  155. "│-v-1 │ Set-up
  156. "└─┬───┴─┬──────
  157.   "│-v-2 │ Behavior
  158.   "└─┬───┴─┬────────
  159.     "│-v-3 │ “meta” (settings settings)
  160.     "└─────┴────────────────────────────
  161.  
  162.       " Quick settings access
  163.         " TODO: Move the function to function area, remap to remap area?
  164.         "         Honestly, I think not—an exception makes sense here, at least.
  165.         function! MyQuickSettings()
  166.           :tabedit $MYVIMRC
  167.           :lcd $HOME
  168.           :vs ~/Dropbox/Vim/vimrc.vim
  169.           :vertical resize 101
  170.         endfunction
  171.  
  172.         nnoremap <silent> <F2> :call MyQuickSettings()<cr>
  173.  
  174.  
  175.       " Reload vimrc when saved
  176.         au! BufWritePost $MYVIMRC source $MYVIMRC
  177.  
  178.         " Doesn’t work, because MyRefreshFullScreen doesn’t work.
  179.         " TODO: evaluate this thing.
  180.         function! MyRefreshVimrc()
  181.           :source $MYVIMRC
  182.           :call MyRefreshFullScreen()
  183.         endfunction
  184.  
  185.     "│-v-3 │ Tweakings/Feature Settings
  186.     "└─┬───┴─┬──────────────────────────
  187.       "│-v-4 │ Intended/Built-In Settings
  188.       "└─┬───┴─┬──────────────────────────
  189.         "│-v-5 │ Editing Settings
  190.         "└─────┴──────────────────
  191.           set expandtab
  192.           set shiftwidth=2
  193.           set softtabstop=2
  194.           set tabstop=2
  195.           set backspace=indent,eol,start
  196.           set ruler
  197.           :syntax enable
  198.           :set cindent
  199.  
  200.           " Stopped using this when I started using Powershell more.
  201.           ":set shellslash
  202.  
  203.           :set switchbuf=useopen,usetab,newtab
  204.  
  205.           " Allows the closing of buffers without saving.
  206.           set hidden
  207.  
  208.           " allows cursor position past true end of line
  209.           set virtualedit=all
  210.  
  211.           " Whether jumping to another line (like with "G") goes to the start
  212.           " of the line, or tries to stay in the same column.
  213.           set nostartofline
  214.  
  215.         "│-v-5 │ vimdiff settings
  216.         "└─────┴──────────────────
  217.           set diffopt=filler,vertical,context:3
  218.  
  219.         "│-v-5 │ Spelling
  220.         "└─────┴──────────
  221.           set spelllang=en_us,es,eo
  222.  
  223.         "│-v-5 │ Status Line
  224.         "└─────┴─────────────
  225.           ":set statusline=%F%m%r%h%w\ (%{&ff})\ typ:%Y\ ASCII=\%04.8b\ HEX=\%04.4B\ %l,%v %p%%\ LEN=%L
  226.           "set statusline=%<[%02n]\ %F%(\ %m%h%w%y%r%)\ %a%=\ %8l,%c%V/%L\ (%P)\ [%08O:%02B]
  227.           set statusline=%<[%02n]\ %F%(\ %m%h%w%y%r%)\ %a%=\ %8l,%c%V/%L\ (%P)\ [%02B]
  228.  
  229.           set laststatus=2
  230.             " “The value of this option influences when the
  231.             " last window will have a status line…”
  232.  
  233.         "│-v-5 │ Folds
  234.         "└─────┴──────────
  235.           :set foldmethod=marker
  236.           :set foldmarker=//v,//^
  237.           :set commentstring=%s
  238.  
  239.         "│-v-5 │ WildMenu
  240.         "└─────┴──────────
  241.           set wildmode=longest,list,full
  242.           :set wildmenu
  243.  
  244.         "│-v-5 │ persistent undo
  245.         "└─────┴─────────────────
  246.           set undofile
  247.  
  248.         "│-v-5 │ search settings
  249.         "└─────┴─────────────────
  250.           set ignorecase
  251.           set smartcase
  252.           set gdefault
  253.           set incsearch
  254.           set showmatch
  255.           set hlsearch
  256.           " Mappings (@__search_mappings):
  257.           " - Switch off search highlighting.
  258.  
  259.         "│-v-5 │ netrw settings
  260.         "└─────┴────────────────
  261.           let g:netrw_liststyle=3
  262.  
  263.         "│-v-5 │ External Shell Settings
  264.         "└─────┴─────────────────────────
  265.           " __requires_utf_8:
  266.  
  267.           " The && !(&diff) is there because shell=powershell.exe breaks
  268.           " vimdiff.
  269.           if has('win32') && !(&diff) && 0
  270.             set shell=powershell.exe
  271.             set shellcmdflag=-c
  272.             set shellpipe=|
  273.             set shellredir=>
  274.           endif
  275.  
  276.         "│-v-5 │ mkview settings
  277.         "└─────┴─────────────────
  278.           set viewdir=~/Dropbox/Vim/GlobalRuntimePath/view/
  279.  
  280.         "│-v-5 │ Custom Digraph Settings
  281.         "└─────┴─────────────────────────
  282.         " Esperanto:
  283.           :digraph Cx 264
  284.           :digraph cx 265
  285.           :digraph Gx 284
  286.           :digraph gx 285
  287.           :digraph Hx 292
  288.           :digraph hx 293
  289.           :digraph Jx 308
  290.           :digraph jx 309
  291.           :digraph Sx 348
  292.           :digraph sx 349
  293.           :digraph Ux 364
  294.           :digraph ux 365
  295.  
  296.       "│-v-4 │ Customized behavior
  297.       "└─┬───┴─┬───────────────────
  298.         "│-v-5 │ (function) Toggle Spell Checking.
  299.         "└─────┴───────────────────────────────────
  300.           " (mapping @__spell_check_mapping)
  301.           function! g:ToggleSpellMode()
  302.             :set spell!
  303.             if &l:spell
  304.               echo "Spell check ON"
  305.             else
  306.               echo "Spell check OFF"
  307.             endif
  308.           endfunction
  309.  
  310.         "│-v-5 │ (function) Toggle Fixed Window Width.
  311.         "└─────┴───────────────────────────────────────
  312.           " (mapping @__fixed_window_width)
  313.  
  314.           function! g:TimToggleWindowFixedWidth()
  315.             :set winfixwidth!
  316.             if &l:winfixwidth
  317.               echo "Fixed Window Width ON"
  318.             else
  319.               echo "Fixed Window Width OFF"
  320.             endif
  321.           endfunction
  322.  
  323.         "│-v-5 │ (function) Box character (turburul) hax
  324.         "└─────┴─────────────────────────────────────────
  325.           " This:
  326.           " r---—v-,
  327.           " |    | |
  328.           " >----+-<
  329.           " |    | |
  330.           " >————+—<
  331.           " |    | |
  332.           " L----^—’
  333.           "
  334.           " Becomes This:
  335.           " ┌────┬─┐
  336.           " │    │ │
  337.           " ├────┼─┤
  338.           " │    │ │
  339.           " ├────┼─┤
  340.           " │    │ │
  341.           " └────┴─┘
  342.         " (mapping @__box_characters_mapping)
  343.           function! g:BoxCharacters()
  344.             :s'r''e
  345.            gv
  346.            :s','┐'e
  347.             gv
  348.             :s'’''e
  349.            gv
  350.            :s/'//e
  351.             gv
  352.             :s'L''e
  353.  
  354.            gv
  355.            :s'|'│'e
  356.             gv
  357.             :s'-''e
  358.            gv
  359.            :s''─'e
  360.             gv
  361.             :s'+''e
  362.  
  363.            gv
  364.            :s'\^'┴'e
  365.             gv
  366.             :s'>''e
  367.            gv
  368.            :s'v'┬'e
  369.             gv
  370.             :s'T''e
  371.            gv
  372.            :s'<'┤'e
  373.           endfunction
  374.  
  375.         "│-v-5 │ (functions) Multi-Window automatic stuff
  376.         "└─────┴──────────────────────────────────────────
  377.           " These settings rely heavily on the specific ways I personally use Vim.
  378.           " (auto-commands @__multi_window_autocmds)
  379.  
  380.           function! TimWinLeaveWithGundo()
  381.             if !GundoInTab() && g:timdisplaymode == 'code'
  382.               ":vertical resize
  383.               :set nowrap
  384.               ":set norelativenumber
  385.               ":set nonumber
  386.             endif
  387.           endfunction
  388.  
  389.           function! TimWinEnterWithGundo()
  390.             if !GundoInTab() && g:timdisplaymode == 'code'
  391.               if g:tim_number_mode == 0
  392.                 ":vertical resize 81
  393.               else
  394.                 ":vertical resize 85
  395.               endif
  396.               :set wrap
  397.               :call g:TimDisplayNumbers()
  398.             endif
  399.           endfunction
  400.  
  401.           function! GundoInTab()
  402.             let s:current_tabpagebuflist = tabpagebuflist()
  403.             for i in s:current_tabpagebuflist
  404.               if bufname(i) == "__Gundo__"
  405.                 return 1
  406.               endif
  407.             endfor
  408.             return 0
  409.           endfunction
  410.  
  411.         "│-v-5 │ (functions) Line-number Mode switching
  412.         "└─────┴────────────────────────────────────────
  413.           " (mappings @__line_number_modes_mappings)
  414.  
  415.           let g:tim_number_mode = 1
  416.  
  417.           function! g:ToggleNuMode(...)
  418.             if a:0
  419.               if(a:1 != -1)
  420.                 let g:tim_number_mode = a:1
  421.               else
  422.                 let g:tim_number_mode -= 1
  423.               endif
  424.             else
  425.               let g:tim_number_mode += 1
  426.             endif
  427.  
  428.             if g:tim_number_mode > 2
  429.               let g:tim_number_mode = 0
  430.             endif
  431.             if g:tim_number_mode < 0
  432.               let g:tim_number_mode = 2
  433.             endif
  434.  
  435.             call g:TimDisplayNumbers()
  436.           endfunc
  437.  
  438.           function! g:TimDisplayNumbers()
  439.             if(g:tim_number_mode == 1)
  440.               if g:timdisplaymode == 'code'
  441.                 ":vertical resize 85
  442.               endif
  443.               set number
  444.             elseif(g:tim_number_mode == 2)
  445.               if g:timdisplaymode == 'code'
  446.                 ":vertical resize 85
  447.               endif
  448.               set relativenumber
  449.             else
  450.               if g:timdisplaymode == 'code'
  451.                 ":vertical resize 81
  452.               endif
  453.               set nonumber
  454.               set norelativenumber
  455.             endif
  456.           endfunc
  457.  
  458.         "│-v-5 │ (functions) View and Folds saving
  459.         "└─────┴───────────────────────────────────
  460.           " (mappings @__viewdir_mappings)
  461.           " TODO: for realsy, this needs to be its own script in the
  462.           " repository
  463.           " TODO: echo the current mode on toggle
  464.           " TODO: loadview automatically in zigzagproj mode on file loading
  465.  
  466.           function! g:toggleviewdir()
  467.             if g:viewdirmode == "normal"
  468.               let g:viewdirmode = "zigzagproj"
  469.             else
  470.               let g:viewdirmode = "normal"
  471.             endif
  472.  
  473.             call g:applyviewdir()
  474.           endfunction
  475.  
  476.           function! g:applyviewdir()
  477.             if g:viewdirmode == "normal"
  478.               set viewdir=~/Dropbox/Vim/GlobalRuntimePath/view/
  479.             else
  480.               set viewdir=~/Dropbox/code/ZigZagDungeon/vimview/
  481.             endif
  482.             "echo "
  483.           endfunction
  484.  
  485.           let g:viewdirmode = "normal"
  486.           call g:applyviewdir()
  487.  
  488.     "│-v-3 │ Mappings, Auto-Commands & Abbreviations.
  489.     "└─┬───┴─┬────────────────────────────────────────
  490.       "│-v-4 │ Mappings
  491.       "└─┬───┴─┬────────
  492.         "│-v-5 │ Leader Key Settings
  493.         "└─────┴─────────────────────
  494.           let mapleader = ","
  495.                 " doesn't work?:
  496.           noremap <C-,> <leader>
  497.  
  498.           " Still want this functionality!
  499.           map \u <Nop>
  500.           nnoremap \ ,
  501.  
  502.         "│-v-5 │ navigation remaps
  503.         "└─────┴─────────────────────
  504.           "nnoremap <tab> %
  505.           "vnoremap <tab> %
  506.  
  507.           nnoremap <silent> <leader>t :tabs<cr>
  508.  
  509.           nnoremap j gj
  510.           nnoremap k gk
  511.           nnoremap gj j
  512.           nnoremap gk k
  513.  
  514.           nnoremap <leader>h <C-W>h
  515.           nnoremap <leader>l <C-W>l
  516.           nnoremap <leader>j <C-W>j
  517.           nnoremap <leader>k <C-W>k
  518.  
  519.         "│-v-5 │ Normal-Mode alternative access.
  520.         "└─────┴─────────────────────────────────
  521.           " TODO: Change the windows mapping to changing caps lock to esc.
  522.           "if has('win32')
  523.           "  inoremap hh <esc>
  524.           "  cnoremap hh <esc>
  525.           "endif
  526.           "Arpeggio inoremap tn <esc>
  527.           "Arpeggio cnoremap tn <esc>
  528.  
  529.         "│-v-5 │ toggle showing of invisible characters
  530.         "└─────┴────────────────────────────────────────
  531.           nnoremap <silent> <leader>I :call g:ToggleList()<cr>
  532.           " TODO finish this indicator and stick it in the right place.
  533.           function! g:ToggleList()
  534.             :set list!
  535.             if &l:list
  536.               echo "List Invisible Characters ON"
  537.             else
  538.               echo "List Invisible Characters OFF"
  539.             endif
  540.           endfunction
  541.  
  542.         "│-v-5 │ OS clip-board easy-integration.
  543.         "└─────┴─────────────────────────────────
  544.           nnoremap <leader>y "+y
  545.           vnoremap <leader>y "+y
  546.  
  547.           nnoremap <leader>Y "+Y
  548.           vnoremap <leader>Y "+Y
  549.  
  550.           nnoremap <leader>p "+p
  551.           vnoremap <leader>p "+p
  552.  
  553.           nnoremap <leader>P "+P
  554.           vnoremap <leader>P "+P
  555.  
  556.         "│-v-5 │ Jump to file shortcut
  557.         "└─────┴───────────────────────
  558.           nnoremap <silent> <leader>f <c-w>gf
  559.  
  560.         "│-v-5 │ File-name completion shortcut
  561.         "└─────┴───────────────────────────────
  562.           inoremap <c-f> <c-x><c-f>
  563.  
  564.         "│-v-5 │ __search_mappings:
  565.         "└─────┴────────────────────
  566.           " Switch off search highlighting.
  567.           nnoremap <silent> <leader><space> :noh<cr>
  568.  
  569.         "│-v-5 │ Quick window-width reset
  570.         "└─────┴──────────────────────────
  571.           nnoremap <leader><Bar>    :vertical resize 85<cr>
  572.           nnoremap <leader><Bslash> :vertical resize 85<cr>
  573.  
  574.         "│-v-5 │ Generate Tag files
  575.         "└─────┴────────────────────
  576.           "map <C-F12> :!ctags -R --c++-kinds=+p --fields=+iaS --extra=+q .<CR>
  577.           "map <C-F12> :!ctags -R --c++-kinds=+p --fields=+iaS --extra=+q *.h *.cpp<CR>
  578.           map <C-F12> :!ctags -R --c++-kinds=+p --fields=+iaS --extra=+q --language-force=C++ .<CR>
  579.  
  580.         "│-v-5 │ Arpeggio shortcuts experiment
  581.         "└─────┴───────────────────────────────
  582.           Arpeggio inoremap s, /
  583.           Arpeggio inoremap s. \
  584.  
  585.           Arpeggio cnoremap s, /
  586.           Arpeggio cnoremap s. \
  587.  
  588.         "│-v-5 │ Digraph
  589.         "└─────┴─────────
  590.           Arpeggio inoremap jk <c-k>
  591.  
  592.         "│-v-5 │ mappings to customized-behavior & functions.
  593.         "└─┬───┴─┬────────────────────────────────────────────
  594.           "│-v-6 │ __spell_check_mapping:
  595.           "└─────┴────────────────────────
  596.             nnoremap <F5> :call g:ToggleSpellMode()<cr>
  597.  
  598.           "│-v-6 │ __fixed_window_width:
  599.           "└─────┴───────────────────────
  600.             nnoremap <leader>W :call g:TimToggleWindowFixedWidth()<cr>
  601.  
  602.           "│-v-6 │ __box_characters_mapping:
  603.           "└─────┴───────────────────────────
  604.             vnoremap <silent> <leader>x :call g:BoxCharacters()<cr>
  605.  
  606.           "│-v-6 │ __line_number_modes_mappings:
  607.           "└─────┴───────────────────────────────
  608.             nnoremap <silent> <leader>n :call g:ToggleNuMode()<cr>
  609.  
  610.             nnoremap <silent> <leader>NN :call g:ToggleNuMode(-1)<cr>
  611.  
  612.  
  613.             nnoremap <silent> <leader>N0 :call g:ToggleNuMode(0)<cr>
  614.             nnoremap <silent> <leader>No :call g:ToggleNuMode(0)<cr>
  615.             nnoremap <silent> <leader>NO :call g:ToggleNuMode(0)<cr>
  616.  
  617.             nnoremap <silent> <leader>Na :call g:ToggleNuMode(1)<cr>
  618.             nnoremap <silent> <leader>NA :call g:ToggleNuMode(1)<cr>
  619.  
  620.             nnoremap <silent> <leader>Nr :call g:ToggleNuMode(2)<cr>
  621.             nnoremap <silent> <leader>NR :call g:ToggleNuMode(2)<cr>
  622.  
  623.           "│-v-6 │ __display_mode_mappings:
  624.           "└─────┴──────────────────────────
  625.             nnoremap <silent> <leader>d :call ToggleDisplayMode()<cr>
  626.  
  627.           "│-v-6 │ __viewdir_mappings:
  628.           "└─────┴─────────────────────
  629.             nnoremap <silent> <f6> :call g:toggleviewdir()<cr>
  630.  
  631.           "│-v-6 │ Insert literal tab character
  632.           "└─────┴──────────────────────────────
  633.             inoremap <silent> <s-tab> <c-v><tab>
  634.  
  635.           "│-v-6 │ Insert date:
  636.           "└─────┴──────────────
  637.             nmap <F3> a<C-R>=strftime("%Y-%m-%d")<CR><Esc>
  638.             imap <F3> <C-R>=strftime("%Y-%m-%d")<CR>
  639.             vmap <F3> di<C-R>=strftime("%Y-%m-%d")<CR><Esc>
  640.  
  641.             nmap <S-F3> a<C-R>=strftime("%Y-%m-%d %a %I:%M %p")<CR><Esc>
  642.             imap <S-F3> <C-R>=strftime("%Y-%m-%d %a %I:%M %p")<CR>
  643.             vmap <S-F3> di<C-R>=strftime("%Y-%m-%d %a %I:%M %p")<CR><Esc>
  644.  
  645.  
  646.         "│-v-5 │ mappings to Plug-ins
  647.         "└─┬───┴─┬────────────────────
  648.           "│-v-6 │ __gundo_mappings:
  649.           "└─────┴───────────────────
  650.             " toggle Gundo:
  651.             nnoremap <silent> <leader>u :GundoToggle<cr>
  652.  
  653.           "│-v-6 │ __full_screen_mappings:
  654.           "└─────┴─────────────────────────
  655.             map <silent> <F11> <Esc>:call ToggleFullScreen()<CR>
  656.  
  657.           "│-v-6 │ __a_mappings:
  658.           "└─────┴───────────────
  659.             nnoremap <silent> <leader>a :AV<cr>
  660.             nnoremap <silent> <leader>s :AV<cr>
  661.  
  662.             " TODO: move this somewhere more sensible:
  663.             nnoremap <silent> <leader>v :vs<cr>
  664.  
  665.           "│-v-6 │ __rainbow_parentheses_mappings:
  666.           "└─────┴─────────────────────────────────
  667.             nnoremap <silent> <leader>, :RainbowParenthesesToggle<cr>
  668.  
  669.       "│-v-4 │ Auto-commands
  670.       "└─┬───┴─┬─────────────
  671.         "│-v-5 │ Independent auto-commands
  672.         "└─────┴───────────────────────────
  673.           autocmd BufRead,BufNewFile *.txtfmt setfiletype txtfmt
  674.         "│-v-5 │ function auto-commands
  675.         "└─┬───┴─┬──────────────────────
  676.           "│-v-6 │ __multi_window_autocmds
  677.           "└─────┴─────────────────────────
  678.             autocmd WinLeave * :call TimWinLeaveWithGundo()
  679.             autocmd WinEnter * :call TimWinEnterWithGundo()
  680.  
  681.  
  682.       "│-v-4 │ Abbreviations
  683.       "└─┬───┴─┬─────────────
  684.         "│-v-5 │ Shortcuts
  685.         "└─────┴───────────
  686.           ab ?!
  687.           ab !?
  688.  
  689.           :ab ,.0 ⁰
  690.           :ab ,.1 ¹
  691.           :ab ,.2 ²
  692.           :ab ,.3 ³
  693.           :ab ,.4 ⁴
  694.           :ab ,.5 ⁵
  695.           :ab ,.6 ⁶
  696.           :ab ,.7 ⁷
  697.           :ab ,.8 ⁸
  698.           :ab ,.9 ⁹
  699.  
  700.         "│-v-5 │ Corrections
  701.         "└─────┴─────────────
  702.           :cab Wa wa
  703.  
  704.   "│-v-2 │ Appearance
  705.   "└─┬───┴─┬──────────
  706.     "│-v-3 │ Built-in Settings
  707.     "└─┬───┴─┬─────────────────
  708.       "│-v-4 │ GUI Options (default is "egmrLtT")
  709.       "└─────┴────────────────────────────────────
  710.         :set guioptions=c
  711.         " Note that fullscreen plugin doesn't work well with anything but null
  712.         " (or similar).
  713.  
  714.       "│-v-4 │ Color scheme
  715.       "└─────┴──────────────
  716.         set t_Co=256
  717.  
  718.         " Not sure if this one's actually necessary.
  719.         :set background=dark
  720.  
  721.         if &t_Co > 2 || has("gui_running")
  722.           ":colorscheme timbat
  723.           :colorscheme badwolf
  724.           ":colorscheme timatrix " I've put a lot of my own adjustments into this one.
  725.          ":colorscheme pyte
  726.        else
  727.          :colorscheme morodark
  728.        endif
  729.  
  730.      "│-v-4 │ Current-Row-Column highlighting
  731.      "└─────┴─────────────────────────────────
  732.        "autocmd WinLeave * set nocursorline nocursorcolumn
  733.        "autocmd WinEnter * set cursorline cursorcolumn
  734.        "set cursorline cursorcolumn
  735.  
  736.        autocmd WinLeave * set nocursorline
  737.        autocmd WinEnter * set cursorline
  738.        set cursorline
  739.  
  740.      "│-v-4 │ Window Width & Such
  741.      "└─────┴─────────────────────
  742.        set winminwidth=5
  743.  
  744.      "│-v-4 │ Invisible characters depiction.
  745.      "└─────┴─────────────────────────────────
  746.        " __requires_utf_8:
  747.        set listchars=tab:│·,trail:·,extends:→
  748.  
  749.        au BufNewFile,BufRead *.cpp,*.h,*.vim,*.rb,*.java,*.snippets,*.py set list
  750.  
  751.      "│-v-4 │ Miscellaneous
  752.      "└─────┴───────────────
  753.        set showcmd
  754.        setglobal display=lastline,uhex
  755.  
  756.      "│-v-4 │ Color Column
  757.      "└─────┴──────────────
  758.        set colorcolumn=81,101,121
  759.  
  760.    "│-v-3 │ Custom Functions
  761.    "└─┬───┴─┬────────────────
  762.      "│-v-4 │ Display Mode Stuff
  763.      "└─────┴────────────────────
  764.        " Mappings (@__display_mode_mappings):
  765.        function! g:ApplyDisplayMode(...)
  766.          if a:0
  767.            let g:timdisplaymode = a:1
  768.          endif
  769.  
  770.          if g:timdisplaymode == 'code'
  771.            "set cursorcolumn
  772.            set nospell                                    " -v-
  773.  
  774.            if &filetype=='vimwiki'
  775.              setlocal linebreak
  776.            else
  777.              set nolinebreak
  778.            endif
  779.  
  780.            if has('win32')
  781.              " :set guifont=consolas:h12
  782.              set guifont=Liberation\ Mono:h9
  783.            else
  784.              set guifont=Liberation\ Mono\ 9
  785.            endif
  786.  
  787.            colorscheme badwolf
  788.            set display-=lastline
  789.            let &showbreak = ''
  790.            set foldmarker=-v-,-^-
  791.            "au WinEnter * set cursorcolumn
  792.                                                           " -^-
  793.          elseif g:timdisplaymode == 'composition'
  794.            set nocursorcolumn
  795.            setlocal spell                                 " -v-
  796.            inoremap <C-BS> <Esc>b1z=wi
  797.  
  798.            setlocal linebreak
  799.  
  800.            if has('win32')
  801.              set guifont=Liberation\ Mono:h13
  802.            else
  803.              set guifont=Liberation\ Mono\ 13
  804.            endif
  805.  
  806.            "colorscheme timatrix
  807.            setlocal display+=lastline
  808.            let &showbreak = '  '
  809.            " setlocal foldmarker={{{,}}}
  810.            set foldmarker=-v-,-^-
  811.            au BufEnter * set nocursorcolumn
  812.          endif                                            " -^-
  813.        endfunction
  814.  
  815.        let g:timdisplaymode = ''
  816.        call g:ApplyDisplayMode('code')
  817.  
  818.        function! ToggleDisplayMode()
  819.          if g:timdisplaymode == 'code'
  820.            let g:timdisplaymode = 'composition'
  821.          else
  822.            let g:timdisplaymode = 'code'
  823.          endif
  824.  
  825.          call g:ApplyDisplayMode()
  826.        endfunction
  827.  
  828. "│-v-1 │ Transient settings
  829. "└─────┴────────────────────
  830.  " This is meant for sourcing in convenience settings that don't really
  831.   " belong in this file.
  832.   :source ~/Dropbox/code/ZigZagDungeon/vimsetup.vim
  833.  
  834. " vim: set fmr=-v-,-^- fdm=marker cms=//%s et ts=2 sw=2 :
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement