" Tim Holt's vimrc file

" Created probably in 2010, Idunno.

" modified extensively continously 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.

"│-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 <silent> < leader > u : GundoToggle < cr >

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 g : vimwiki_list = [ wiki_1, wiki_2 ]

"│-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):

"│-v-3 │ Rainbow Parentheses Settings

"└─────┴──────────────────────────────

" (Steve Losh's modified version, cleaned up and jazz)

" Mappings (@__rainbow_parentheses_mappings):

autocmd BufEnter * RainbowParenthesesLoadRound

autocmd BufEnter * RainbowParenthesesLoadBraces

"│-v-1 │ Set-up

"└─┬───┴─┬──────

"│-v-2 │ Behavior

"└─┬───┴─┬────────

"│-v-3 │ “meta” (settings settings)

"└─────┴────────────────────────────

" Quick settings access

" TODO: maybe make this a function

nnoremap <silent> <F2> : tabedit $ MYVIMRC < cr >: lcd $ HOME < cr >: vs ~/ Dropbox / Vim / vimrc . vim < cr >

" 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

: 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 │ 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 - , -^-

"│-v-5 │ WildMenu

"└─────┴──────────

set wildmode =longest, list ,full

: set wildmenu

"│-v-5 │ persistent undo

"└─────┴─────────────────

set undofile

"│-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:

if has ( 'win32' )

set shell =powershell . exe

set shellcmdflag = - c

set shellpipe = |

set shellredir = >

endif

"│-v-4 │ Customized behavior

"└─┬───┴─┬───────────────────

"│-v-5 │ (function) Toggle Spell Checking.

"└─────┴───────────────────────────────────

" (mapping @__spell_check_mapping)

let g : timspellmode = 0

function ! g : ToggleSpellMode ( )

if g : timspellmode == 0

let g : timspellmode = 1

set spell

else

let g : timspellmode = 0

set nospell

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

let g : tim_number_mode = a : 1 " TODO: use this somewhere.

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-3 │ Mappings, Auto-Commands & Abbreviations.

"└─┬───┴─┬────────────────────────────────────────

"│-v-4 │ Mappings

"└─┬───┴─┬────────

"│-v-5 │ Leader Key Settings

"└─────┴─────────────────────

let mapleader = ","

" doesn't work?:

noremap < C - , > < leader >

"│-v-5 │ navigation remaps

"└─────┴─────────────────────

nnoremap < tab > %

vnoremap < tab > %

nnoremap <silent> < leader > t : tabs < cr >

nnoremap <silent> < leader > b : ls < cr >

nnoremap j gj

nnoremap k gk

nnoremap < leader > h < C - W > h

nnoremap < leader > l < C - W > l

nnoremap < leader > j < C - W > j

nnoremap < leader > k < C - W > k

" for use with the numeric version:

nnoremap < leader > W < C - W >< C - W >

"│-v-5 │ Normal-Mode alternative access.

"└─────┴─────────────────────────────────

" TODO: Change the windows mapping to changing caps lock to esc.

if has ( 'win32' )

inoremap hh < esc >

cnoremap hh < esc >

endif

"│-v-5 │ toggle showing of invisible characters

"└─────┴────────────────────────────────────────

nnoremap <silent> < leader > i : set list ! <cr>

"│-v-5 │ OS clip-board easy-integration.

"└─────┴─────────────────────────────────

nnoremap < leader > y "+y

vnoremap < leader > y "+y

nnoremap < leader > Y "+Y

vnoremap < leader > Y "+Y

nnoremap < leader > p "+p

vnoremap < leader > p "+p

nnoremap < leader > P "+P

vnoremap < leader > P "+P

"│-v-5 │ Jump to file shortcut

"└─────┴───────────────────────

nnoremap <silent> < leader > f < c - w > gf

"│-v-5 │ File-name completion shortcut

"└─────┴───────────────────────────────

inoremap < c - f > < c - x >< c - f >

"│-v-5 │ __search_mappings:

"└─────┴────────────────────

" Switch off search highlighting.

nnoremap <silent> < leader >< space > : noh < cr >

"│-v-5 │ Quick window-width reset

"└─────┴──────────────────────────

nnoremap < leader >< Bar > : vertical resize 85 < cr >

"│-v-5 │ Generate Tag files

"└─────┴────────────────────

"map <C-F12> :!ctags -R --c++-kinds=+p --fields=+iaS --extra=+q .<CR>

map < C - F12 > :! ctags - R -- c ++- kinds= + p -- fields= + iaS -- extra= + q *. h *. cpp < CR >

"│-v-5 │ mappings to customized-behavior & functions.

"└─┬───┴─┬──────────────────────────────────────────

"│-v-6 │ __spell_check_mapping:

"└─────┴────────────────────────

nnoremap <F5> : call g : ToggleSpellMode ( ) <cr>

"│-v-6 │ __box_characters_mapping:

"└─────┴───────────────────────────

vnoremap <silent> < leader > b : call g : BoxCharacters ( ) <cr>

"│-v-6 │ __line_number_modes_mappings:

"└─────┴───────────────────────────────

" TODO: use <leader>n for cycle, <leader>N[mnemonic] for absolute.

nnoremap <silent> < leader > n : call g : ToggleNuMode ( ) <cr>

nnoremap <silent> 3 < leader > n : call g : ToggleNuMode ( 0 ) <cr>

nnoremap <silent> 1 < leader > n : call g : ToggleNuMode ( 1 ) <cr>

nnoremap <silent> 2 < leader > n : call g : ToggleNuMode ( 2 ) <cr>

nnoremap <silent> < leader > N : call g : ToggleNuMode ( ) <cr> : call g : ToggleNuMode ( ) <cr>

"│-v-6 │ __display_mode_mappings:

"└─────┴──────────────────────────

nnoremap <silent> < leader > d : call ToggleDisplayMode ( ) <cr>

"│-v-5 │ mappings to Plug-ins

"└─┬───┴─┬────────────────────

"│-v-6 │ __gundo_mappings:

"└─────┴───────────────────

" toggle Gundo:

nnoremap <silent> < leader > u : GundoToggle < cr >

"│-v-6 │ __full_screen_mappings:

"└─────┴─────────────────────────

map <silent> <F11> <Esc> : call ToggleFullScreen ( ) <CR>

"│-v-6 │ __a_mappings:

"└─────┴───────────────

nnoremap <silent> < leader > a : AV < cr >

nnoremap <silent> < leader > s : AV < cr >

nnoremap <silent> < leader > v : vs < cr >

"│-v-6 │ __rainbow_parentheses_mappings:

"└─────┴─────────────────────────────────

nnoremap <silent> < leader > , : RainbowParenthesesToggle < cr >

"│-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

"└─────┴─────────────

"│-v-2 │ Appearance

"└─┬───┴─┬──────────

"│-v-3 │ Built-in Settings

"└─┬───┴─┬─────────────────

"│-v-4 │ GUI Options (default is " egmrLtT ")

"└─────┴────────────────────────────────────

: set guioptions =

" 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

" Some favorite color schemes. Just leave your choice the only

" un-commented one. (and make sure you actually have the colorscheme,

" and it's compatible!)

: colorscheme timbat

":colorscheme timatrix " I 've put a lot of my own adjustments into this one.

":colorscheme pyte

"│-v-4 │ Current-Row-Column highlighting

"└─────┴─────────────────────────────────

autocmd WinLeave * set nocursorline nocursorcolumn

autocmd WinEnter * set cursorline cursorcolumn

set cursorline cursorcolumn

"│-v-4 │ Window Width & Such

"└─────┴─────────────────────

set winminwidth=12

"│-v-4 │ Invisible characters depiction.

"└─────┴─────────────────────────────────

" __requires_utf_8:

set listchars=tab:▸ \ ,eol:¬

"│-v-4 │ Miscellaneous

"└─────┴───────────────

set showcmd

"│-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:h11

else

set guifont=Consolas \ 12

endif

colorscheme timbat

set display-=lastline

let &showbreak = ' '

set foldmarker=-v-,-^-

au WinEnter * set cursorcolumn

" -^-

elseif g:timdisplaymode == ' composition '

set nocursorcolumn

setlocal spell " -v-

inoremap <C-BS> <Esc>b1z=wi

setlocal linebreak

if has(' win32 ')

:set guifont=consolas:h16

else

setlocal guifont=Consolas \ 16

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()