Advertisement
atimholt

My vimrc

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