Add minimal vim rcfiles
This commit is contained in:
parent
38316cf79e
commit
9a7a87f74f
470
vim/colors/Tomorrow-Night-Eighties.vim
Normal file
470
vim/colors/Tomorrow-Night-Eighties.vim
Normal file
|
@ -0,0 +1,470 @@
|
|||
" Tomorrow Night Eighties - Full Colour and 256 Colour
|
||||
" http://chriskempson.com
|
||||
"
|
||||
" Hex colour conversion functions borrowed from the theme "Desert256""
|
||||
|
||||
" Default GUI Colours
|
||||
let s:foreground = "cccccc"
|
||||
" let s:background = "2d2d2d"
|
||||
let s:background = "1f1f1f"
|
||||
let s:selection = "515151"
|
||||
let s:line = "393939"
|
||||
let s:comment = "999999"
|
||||
let s:red = "f2777a"
|
||||
let s:orange = "f99157"
|
||||
let s:yellow = "ffcc66"
|
||||
let s:green = "99cc99"
|
||||
let s:aqua = "009999"
|
||||
let s:blue = "99cccc"
|
||||
let s:purple = "cc99cc"
|
||||
let s:window = "4d5057"
|
||||
let s:window_dim = "3d3e44"
|
||||
|
||||
hi clear
|
||||
syntax reset
|
||||
|
||||
let g:colors_name = "Tomorrow-Night-Eighties"
|
||||
|
||||
if has("gui_running") || &t_Co == 88 || &t_Co == 256
|
||||
" Returns an approximate grey index for the given grey level
|
||||
fun <SID>grey_number(x)
|
||||
if &t_Co == 88
|
||||
if a:x < 23
|
||||
return 0
|
||||
elseif a:x < 69
|
||||
return 1
|
||||
elseif a:x < 103
|
||||
return 2
|
||||
elseif a:x < 127
|
||||
return 3
|
||||
elseif a:x < 150
|
||||
return 4
|
||||
elseif a:x < 173
|
||||
return 5
|
||||
elseif a:x < 196
|
||||
return 6
|
||||
elseif a:x < 219
|
||||
return 7
|
||||
elseif a:x < 243
|
||||
return 8
|
||||
else
|
||||
return 9
|
||||
endif
|
||||
else
|
||||
if a:x < 14
|
||||
return 0
|
||||
else
|
||||
let l:n = (a:x - 8) / 10
|
||||
let l:m = (a:x - 8) % 10
|
||||
if l:m < 5
|
||||
return l:n
|
||||
else
|
||||
return l:n + 1
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
endfun
|
||||
|
||||
" Returns the actual grey level represented by the grey index
|
||||
fun <SID>grey_level(n)
|
||||
if &t_Co == 88
|
||||
if a:n == 0
|
||||
return 0
|
||||
elseif a:n == 1
|
||||
return 46
|
||||
elseif a:n == 2
|
||||
return 92
|
||||
elseif a:n == 3
|
||||
return 115
|
||||
elseif a:n == 4
|
||||
return 139
|
||||
elseif a:n == 5
|
||||
return 162
|
||||
elseif a:n == 6
|
||||
return 185
|
||||
elseif a:n == 7
|
||||
return 208
|
||||
elseif a:n == 8
|
||||
return 231
|
||||
else
|
||||
return 255
|
||||
endif
|
||||
else
|
||||
if a:n == 0
|
||||
return 0
|
||||
else
|
||||
return 8 + (a:n * 10)
|
||||
endif
|
||||
endif
|
||||
endfun
|
||||
|
||||
" Returns the palette index for the given grey index
|
||||
fun <SID>grey_colour(n)
|
||||
if &t_Co == 88
|
||||
if a:n == 0
|
||||
return 16
|
||||
elseif a:n == 9
|
||||
return 79
|
||||
else
|
||||
return 79 + a:n
|
||||
endif
|
||||
else
|
||||
if a:n == 0
|
||||
return 16
|
||||
elseif a:n == 25
|
||||
return 231
|
||||
else
|
||||
return 231 + a:n
|
||||
endif
|
||||
endif
|
||||
endfun
|
||||
|
||||
" Returns an approximate colour index for the given colour level
|
||||
fun <SID>rgb_number(x)
|
||||
if &t_Co == 88
|
||||
if a:x < 69
|
||||
return 0
|
||||
elseif a:x < 172
|
||||
return 1
|
||||
elseif a:x < 230
|
||||
return 2
|
||||
else
|
||||
return 3
|
||||
endif
|
||||
else
|
||||
if a:x < 75
|
||||
return 0
|
||||
else
|
||||
let l:n = (a:x - 55) / 40
|
||||
let l:m = (a:x - 55) % 40
|
||||
if l:m < 20
|
||||
return l:n
|
||||
else
|
||||
return l:n + 1
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
endfun
|
||||
|
||||
" Returns the actual colour level for the given colour index
|
||||
fun <SID>rgb_level(n)
|
||||
if &t_Co == 88
|
||||
if a:n == 0
|
||||
return 0
|
||||
elseif a:n == 1
|
||||
return 139
|
||||
elseif a:n == 2
|
||||
return 205
|
||||
else
|
||||
return 255
|
||||
endif
|
||||
else
|
||||
if a:n == 0
|
||||
return 0
|
||||
else
|
||||
return 55 + (a:n * 40)
|
||||
endif
|
||||
endif
|
||||
endfun
|
||||
|
||||
" Returns the palette index for the given R/G/B colour indices
|
||||
fun <SID>rgb_colour(x, y, z)
|
||||
if &t_Co == 88
|
||||
return 16 + (a:x * 16) + (a:y * 4) + a:z
|
||||
else
|
||||
return 16 + (a:x * 36) + (a:y * 6) + a:z
|
||||
endif
|
||||
endfun
|
||||
|
||||
" Returns the palette index to approximate the given R/G/B colour levels
|
||||
fun <SID>colour(r, g, b)
|
||||
" Get the closest grey
|
||||
let l:gx = <SID>grey_number(a:r)
|
||||
let l:gy = <SID>grey_number(a:g)
|
||||
let l:gz = <SID>grey_number(a:b)
|
||||
|
||||
" Get the closest colour
|
||||
let l:x = <SID>rgb_number(a:r)
|
||||
let l:y = <SID>rgb_number(a:g)
|
||||
let l:z = <SID>rgb_number(a:b)
|
||||
|
||||
if l:gx == l:gy && l:gy == l:gz
|
||||
" There are two possibilities
|
||||
let l:dgr = <SID>grey_level(l:gx) - a:r
|
||||
let l:dgg = <SID>grey_level(l:gy) - a:g
|
||||
let l:dgb = <SID>grey_level(l:gz) - a:b
|
||||
let l:dgrey = (l:dgr * l:dgr) + (l:dgg * l:dgg) + (l:dgb * l:dgb)
|
||||
let l:dr = <SID>rgb_level(l:gx) - a:r
|
||||
let l:dg = <SID>rgb_level(l:gy) - a:g
|
||||
let l:db = <SID>rgb_level(l:gz) - a:b
|
||||
let l:drgb = (l:dr * l:dr) + (l:dg * l:dg) + (l:db * l:db)
|
||||
if l:dgrey < l:drgb
|
||||
" Use the grey
|
||||
return <SID>grey_colour(l:gx)
|
||||
else
|
||||
" Use the colour
|
||||
return <SID>rgb_colour(l:x, l:y, l:z)
|
||||
endif
|
||||
else
|
||||
" Only one possibility
|
||||
return <SID>rgb_colour(l:x, l:y, l:z)
|
||||
endif
|
||||
endfun
|
||||
|
||||
" Returns the palette index to approximate the 'rrggbb' hex string
|
||||
fun <SID>rgb(rgb)
|
||||
let l:r = ("0x" . strpart(a:rgb, 0, 2)) + 0
|
||||
let l:g = ("0x" . strpart(a:rgb, 2, 2)) + 0
|
||||
let l:b = ("0x" . strpart(a:rgb, 4, 2)) + 0
|
||||
|
||||
return <SID>colour(l:r, l:g, l:b)
|
||||
endfun
|
||||
|
||||
" Sets the highlighting for the given group
|
||||
fun <SID>X(group, fg, bg, attr)
|
||||
if a:fg != ""
|
||||
exec "hi " . a:group . " guifg=#" . a:fg . " ctermfg=" . <SID>rgb(a:fg)
|
||||
endif
|
||||
if a:bg != ""
|
||||
exec "hi " . a:group . " guibg=#" . a:bg . " ctermbg=" . <SID>rgb(a:bg)
|
||||
endif
|
||||
if a:attr != ""
|
||||
exec "hi " . a:group . " gui=" . a:attr . " cterm=" . a:attr
|
||||
endif
|
||||
endfun
|
||||
|
||||
" Vim Highlighting
|
||||
call <SID>X("Normal", s:foreground, s:background, "")
|
||||
call <SID>X("LineNr", s:selection, "", "")
|
||||
call <SID>X("NonText", s:selection, "", "")
|
||||
call <SID>X("SpecialKey", s:selection, "", "")
|
||||
call <SID>X("Search", s:background, s:yellow, "")
|
||||
call <SID>X("TabLine", s:window, s:foreground, "reverse")
|
||||
call <SID>X("TabLineFill", s:window, s:foreground, "reverse")
|
||||
call <SID>X("StatusLine", s:window, s:yellow, "reverse")
|
||||
call <SID>X("StatusLineNC", s:window_dim, s:comment, "reverse")
|
||||
call <SID>X("VertSplit", s:window, s:window, "none")
|
||||
call <SID>X("Visual", "", s:selection, "")
|
||||
call <SID>X("Directory", s:blue, "", "")
|
||||
call <SID>X("ModeMsg", s:green, "", "")
|
||||
call <SID>X("MoreMsg", s:green, "", "")
|
||||
call <SID>X("Question", s:green, "", "")
|
||||
call <SID>X("WarningMsg", s:red, "", "")
|
||||
call <SID>X("MatchParen", "", s:selection, "")
|
||||
call <SID>X("Folded", s:comment, s:window_dim, "")
|
||||
" call <SID>X("Folded", s:comment, s:background, "")
|
||||
call <SID>X("FoldColumn", "", s:background, "")
|
||||
if version >= 700
|
||||
call <SID>X("CursorLine", "", s:line, "none")
|
||||
call <SID>X("CursorColumn", "", s:line, "none")
|
||||
call <SID>X("PMenu", s:foreground, s:selection, "none")
|
||||
call <SID>X("PMenuSel", s:foreground, s:selection, "reverse")
|
||||
call <SID>X("SignColumn", "", s:background, "none")
|
||||
end
|
||||
if version >= 703
|
||||
call <SID>X("ColorColumn", "", s:line, "none")
|
||||
end
|
||||
|
||||
" Standard Highlighting
|
||||
call <SID>X("Comment", s:comment, "", "")
|
||||
call <SID>X("Todo", s:comment, s:background, "")
|
||||
call <SID>X("Title", s:comment, "", "")
|
||||
call <SID>X("Identifier", s:red, "", "none")
|
||||
call <SID>X("Statement", s:foreground, "", "")
|
||||
call <SID>X("Conditional", s:foreground, "", "")
|
||||
call <SID>X("Repeat", s:foreground, "", "")
|
||||
call <SID>X("Structure", s:purple, "", "")
|
||||
call <SID>X("Function", s:blue, "", "")
|
||||
call <SID>X("Constant", s:orange, "", "")
|
||||
call <SID>X("String", s:green, "", "")
|
||||
call <SID>X("Special", s:blue, "", "")
|
||||
call <SID>X("PreProc", s:purple, "", "")
|
||||
call <SID>X("Operator", s:aqua, "", "none")
|
||||
call <SID>X("Type", s:blue, "", "none")
|
||||
call <SID>X("Define", s:purple, "", "none")
|
||||
call <SID>X("Include", s:blue, "", "")
|
||||
"call <SID>X("Ignore", "666666", "", "")
|
||||
|
||||
" Vim Highlighting
|
||||
call <SID>X("vimCommand", s:red, "", "none")
|
||||
|
||||
" C Highlighting
|
||||
call <SID>X("cType", s:yellow, "", "")
|
||||
call <SID>X("cStorageClass", s:purple, "", "")
|
||||
call <SID>X("cConditional", s:purple, "", "")
|
||||
call <SID>X("cRepeat", s:purple, "", "")
|
||||
|
||||
" PHP Highlighting
|
||||
call <SID>X("phpVarSelector", s:red, "", "")
|
||||
call <SID>X("phpKeyword", s:purple, "", "")
|
||||
call <SID>X("phpRepeat", s:purple, "", "")
|
||||
call <SID>X("phpConditional", s:purple, "", "")
|
||||
call <SID>X("phpStatement", s:purple, "", "")
|
||||
call <SID>X("phpMemberSelector", s:foreground, "", "")
|
||||
|
||||
" Ruby Highlighting
|
||||
call <SID>X("rubySymbol", s:green, "", "")
|
||||
call <SID>X("rubyConstant", s:yellow, "", "")
|
||||
call <SID>X("rubyAccess", s:yellow, "", "")
|
||||
call <SID>X("rubyAttribute", s:blue, "", "")
|
||||
call <SID>X("rubyInclude", s:blue, "", "")
|
||||
call <SID>X("rubyLocalVariableOrMethod", s:orange, "", "")
|
||||
call <SID>X("rubyCurlyBlock", s:orange, "", "")
|
||||
call <SID>X("rubyStringDelimiter", s:green, "", "")
|
||||
call <SID>X("rubyInterpolationDelimiter", s:orange, "", "")
|
||||
call <SID>X("rubyConditional", s:purple, "", "")
|
||||
call <SID>X("rubyRepeat", s:purple, "", "")
|
||||
call <SID>X("rubyControl", s:purple, "", "")
|
||||
call <SID>X("rubyException", s:purple, "", "")
|
||||
|
||||
" Python Highlighting
|
||||
call <SID>X("pythonInclude", s:purple, "", "")
|
||||
call <SID>X("pythonStatement", s:purple, "", "")
|
||||
call <SID>X("pythonConditional", s:purple, "", "")
|
||||
call <SID>X("pythonRepeat", s:purple, "", "")
|
||||
call <SID>X("pythonException", s:purple, "", "")
|
||||
call <SID>X("pythonFunction", s:blue, "", "")
|
||||
call <SID>X("pythonPreCondit", s:purple, "", "")
|
||||
call <SID>X("pythonRepeat", s:aqua, "", "")
|
||||
call <SID>X("pythonExClass", s:orange, "", "")
|
||||
|
||||
" JavaScript Highlighting
|
||||
call <SID>X("javaScriptBraces", s:foreground, "", "")
|
||||
call <SID>X("javaScriptFunction", s:purple, "", "")
|
||||
call <SID>X("javaScriptConditional", s:purple, "", "")
|
||||
call <SID>X("javaScriptRepeat", s:purple, "", "")
|
||||
call <SID>X("javaScriptNumber", s:orange, "", "")
|
||||
call <SID>X("javaScriptMember", s:orange, "", "")
|
||||
call <SID>X("javascriptNull", s:orange, "", "")
|
||||
call <SID>X("javascriptGlobal", s:blue, "", "")
|
||||
call <SID>X("javascriptStatement", s:red, "", "")
|
||||
|
||||
" HTML Highlighting
|
||||
call <SID>X("htmlTag", s:red, "", "")
|
||||
call <SID>X("htmlTagName", s:red, "", "")
|
||||
call <SID>X("htmlArg", s:red, "", "")
|
||||
call <SID>X("htmlScriptTag", s:red, "", "")
|
||||
|
||||
" Diff Highlighting
|
||||
call <SID>X("diffAdded", s:green, "", "")
|
||||
call <SID>X("diffRemoved", s:red, "", "")
|
||||
|
||||
" ShowMarks Highlighting
|
||||
call <SID>X("ShowMarksHLl", s:orange, s:background, "none")
|
||||
call <SID>X("ShowMarksHLo", s:purple, s:background, "none")
|
||||
call <SID>X("ShowMarksHLu", s:yellow, s:background, "none")
|
||||
call <SID>X("ShowMarksHLm", s:aqua, s:background, "none")
|
||||
|
||||
" Lua Highlighting
|
||||
call <SID>X("luaStatement", s:purple, "", "")
|
||||
call <SID>X("luaRepeat", s:purple, "", "")
|
||||
call <SID>X("luaCondStart", s:purple, "", "")
|
||||
call <SID>X("luaCondElseif", s:purple, "", "")
|
||||
call <SID>X("luaCond", s:purple, "", "")
|
||||
call <SID>X("luaCondEnd", s:purple, "", "")
|
||||
|
||||
" Cucumber Highlighting
|
||||
call <SID>X("cucumberGiven", s:blue, "", "")
|
||||
call <SID>X("cucumberGivenAnd", s:blue, "", "")
|
||||
|
||||
" Go Highlighting
|
||||
call <SID>X("goDirective", s:purple, "", "")
|
||||
call <SID>X("goDeclaration", s:purple, "", "")
|
||||
call <SID>X("goStatement", s:purple, "", "")
|
||||
call <SID>X("goConditional", s:purple, "", "")
|
||||
call <SID>X("goConstants", s:orange, "", "")
|
||||
call <SID>X("goTodo", s:yellow, "", "")
|
||||
call <SID>X("goDeclType", s:blue, "", "")
|
||||
call <SID>X("goBuiltins", s:purple, "", "")
|
||||
|
||||
" Clojure "highlighting
|
||||
call <SID>X("clojureConstant", s:orange, "", "")
|
||||
call <SID>X("clojureBoolean", s:orange, "", "")
|
||||
call <SID>X("clojureCharacter", s:orange, "", "")
|
||||
call <SID>X("clojureKeyword", s:green, "", "")
|
||||
call <SID>X("clojureNumber", s:orange, "", "")
|
||||
call <SID>X("clojureString", s:green, "", "")
|
||||
call <SID>X("clojureRegexp", s:green, "", "")
|
||||
call <SID>X("clojureParen", s:aqua, "", "")
|
||||
call <SID>X("clojureVariable", s:yellow, "", "")
|
||||
call <SID>X("clojureCond", s:blue, "", "")
|
||||
call <SID>X("clojureDefine", s:purple, "", "")
|
||||
call <SID>X("clojureException", s:red, "", "")
|
||||
call <SID>X("clojureFunc", s:blue, "", "")
|
||||
call <SID>X("clojureMacro", s:blue, "", "")
|
||||
call <SID>X("clojureRepeat", s:blue, "", "")
|
||||
call <SID>X("clojureSpecial", s:purple, "", "")
|
||||
call <SID>X("clojureQuote", s:blue, "", "")
|
||||
call <SID>X("clojureUnquote", s:blue, "", "")
|
||||
call <SID>X("clojureMeta", s:blue, "", "")
|
||||
call <SID>X("clojureDeref", s:blue, "", "")
|
||||
call <SID>X("clojureAnonArg", s:blue, "", "")
|
||||
call <SID>X("clojureRepeat", s:blue, "", "")
|
||||
call <SID>X("clojureDispatch", s:blue, "", "")
|
||||
|
||||
" Scala "highlighting
|
||||
call <SID>X("scalaKeyword", s:purple, "", "")
|
||||
call <SID>X("scalaKeywordModifier", s:purple, "", "")
|
||||
call <SID>X("scalaOperator", s:blue, "", "")
|
||||
call <SID>X("scalaPackage", s:red, "", "")
|
||||
call <SID>X("scalaFqn", s:foreground, "", "")
|
||||
call <SID>X("scalaFqnSet", s:foreground, "", "")
|
||||
call <SID>X("scalaImport", s:purple, "", "")
|
||||
call <SID>X("scalaBoolean", s:orange, "", "")
|
||||
call <SID>X("scalaDef", s:purple, "", "")
|
||||
call <SID>X("scalaVal", s:purple, "", "")
|
||||
call <SID>X("scalaVar", s:aqua, "", "")
|
||||
call <SID>X("scalaClass", s:purple, "", "")
|
||||
call <SID>X("scalaObject", s:purple, "", "")
|
||||
call <SID>X("scalaTrait", s:purple, "", "")
|
||||
call <SID>X("scalaDefName", s:blue, "", "")
|
||||
call <SID>X("scalaValName", s:foreground, "", "")
|
||||
call <SID>X("scalaVarName", s:foreground, "", "")
|
||||
call <SID>X("scalaClassName", s:foreground, "", "")
|
||||
call <SID>X("scalaType", s:yellow, "", "")
|
||||
call <SID>X("scalaTypeSpecializer", s:yellow, "", "")
|
||||
call <SID>X("scalaAnnotation", s:orange, "", "")
|
||||
call <SID>X("scalaNumber", s:orange, "", "")
|
||||
call <SID>X("scalaDefSpecializer", s:yellow, "", "")
|
||||
call <SID>X("scalaClassSpecializer", s:yellow, "", "")
|
||||
call <SID>X("scalaBackTick", s:green, "", "")
|
||||
call <SID>X("scalaRoot", s:foreground, "", "")
|
||||
call <SID>X("scalaMethodCall", s:blue, "", "")
|
||||
call <SID>X("scalaCaseType", s:yellow, "", "")
|
||||
call <SID>X("scalaLineComment", s:comment, "", "")
|
||||
call <SID>X("scalaComment", s:comment, "", "")
|
||||
call <SID>X("scalaDocComment", s:comment, "", "")
|
||||
call <SID>X("scalaDocTags", s:comment, "", "")
|
||||
call <SID>X("scalaEmptyString", s:green, "", "")
|
||||
call <SID>X("scalaMultiLineString", s:green, "", "")
|
||||
call <SID>X("scalaUnicode", s:orange, "", "")
|
||||
call <SID>X("scalaString", s:green, "", "")
|
||||
call <SID>X("scalaStringEscape", s:green, "", "")
|
||||
call <SID>X("scalaSymbol", s:orange, "", "")
|
||||
call <SID>X("scalaChar", s:orange, "", "")
|
||||
call <SID>X("scalaXml", s:green, "", "")
|
||||
call <SID>X("scalaConstructorSpecializer", s:yellow, "", "")
|
||||
call <SID>X("scalaBackTick", s:blue, "", "")
|
||||
|
||||
" Snippet highlighting
|
||||
call <SID>X("snipKeyword", s:purple, "", "")
|
||||
call <SID>X("snipStart", s:yellow, "", "")
|
||||
|
||||
" Shell highlighting
|
||||
call <SID>X("zshVariableDef", s:orange, "", "")
|
||||
call <SID>X("zshCommands", s:blue, "", "")
|
||||
|
||||
|
||||
" Delete Functions
|
||||
delf <SID>X
|
||||
delf <SID>rgb
|
||||
delf <SID>colour
|
||||
delf <SID>rgb_colour
|
||||
delf <SID>rgb_level
|
||||
delf <SID>rgb_number
|
||||
delf <SID>grey_colour
|
||||
delf <SID>grey_level
|
||||
delf <SID>grey_number
|
||||
endif
|
||||
|
||||
set background=dark
|
167
vim/rc/keymaps.vim
Normal file
167
vim/rc/keymaps.vim
Normal file
|
@ -0,0 +1,167 @@
|
|||
|
||||
" Shortcut to vimrc and gvimrc
|
||||
nnoremap <localleader>v :CtrlP ~/.vim<CR>
|
||||
|
||||
" Comma get some... sorry.
|
||||
let mapleader = ','
|
||||
let maplocalleader = '\'
|
||||
noremap ; :
|
||||
|
||||
" Trigger to preserve indentation on pastes
|
||||
set pastetoggle=<F12>
|
||||
" Easier than escape. Pinnacle of laziness.
|
||||
imap jk <ESC>
|
||||
" Turn off search highlighting
|
||||
noremap <silent> <leader>? :nohlsearch<CR>
|
||||
|
||||
" Navigation {{{
|
||||
" Normalize all the navigation keys to move by row/col despite any wrapped text
|
||||
noremap j gj
|
||||
noremap k gk
|
||||
" % matchit shortcut, but only in normal mode!
|
||||
nmap <Tab> %
|
||||
" Easier fold toggle
|
||||
nnoremap <Space> 5j
|
||||
vnoremap <Space> 5j
|
||||
nnoremap <Backspace> 5k
|
||||
vnoremap <Backspace> 5k
|
||||
|
||||
" f: Find. Also support repeating with .
|
||||
nnoremap <Plug>OriginalSemicolon ;
|
||||
nnoremap <silent> f :<C-u>call repeat#set("\<lt>Plug>OriginalSemicolon")<CR>f
|
||||
nnoremap <silent> t :<C-u>call repeat#set("\<lt>Plug>OriginalSemicolon")<CR>t
|
||||
nnoremap <silent> F :<C-u>call repeat#set("\<lt>Plug>OriginalSemicolon")<CR>F
|
||||
nnoremap <silent> T :<C-u>call repeat#set("\<lt>Plug>OriginalSemicolon")<CR>T
|
||||
" }}}
|
||||
|
||||
" Editing {{{
|
||||
nnoremap <C-b> <C-^>
|
||||
" Insert-mode navigation
|
||||
" Go to end of line
|
||||
inoremap <C-e> <Esc>A
|
||||
" Go to start of line
|
||||
inoremap <C-a> <Esc>I
|
||||
|
||||
" Make Y act consistant with C and D
|
||||
nnoremap Y y$
|
||||
|
||||
" Don't leave visual mode after indenting
|
||||
vnoremap < <gv
|
||||
vnoremap > >gv
|
||||
|
||||
" Textmate-like CMD+Enter (O in insert mode)
|
||||
inoremap <S-CR> <C-O>o
|
||||
inoremap <C-S-CR> <C-O>O
|
||||
|
||||
" Enabling repeat in visual mode
|
||||
vmap . :normal .<CR>
|
||||
" }}}
|
||||
|
||||
" Buffers {{{
|
||||
" Change CWD to current file's directory
|
||||
nnoremap <leader>cd :cd %:p:h<cr>:pwd<cr>
|
||||
|
||||
" Next/prev buffer
|
||||
nnoremap ]b :<C-u>bnext<CR>
|
||||
nnoremap [b :<C-u>bprevious<CR>
|
||||
" }}}
|
||||
|
||||
" Command {{{
|
||||
" Annoying command mistakes <https://github.com/spf13/spf13-vim>
|
||||
com! -bang -nargs=* -complete=file E e<bang> <args>
|
||||
com! -bang -nargs=* -complete=file W w<bang> <args>
|
||||
com! -bang -nargs=* -complete=file Wq wq<bang> <args>
|
||||
com! -bang -nargs=* -complete=file WQ wq<bang> <args>
|
||||
com! -bang Wa wa<bang>
|
||||
com! -bang WA wa<bang>
|
||||
com! -bang Q q<bang>
|
||||
com! -bang QA qa<bang>
|
||||
com! -bang Qa qa<bang>
|
||||
" Forget to sudo?
|
||||
com! WW w !sudo tree % >/dev/null
|
||||
|
||||
" Shortcuts
|
||||
cnoremap ;/ <C-R>=expand('%:p:h').'/'<CR>
|
||||
cnoremap ;; <C-R>=expand("%:t")<CR>
|
||||
cnoremap ;. <C-R>=expand("%:p:r")<CR>
|
||||
|
||||
" Mimic shortcuts in the terminal
|
||||
cnoremap <C-a> <Home>
|
||||
cnoremap <C-e> <End>
|
||||
" }}}
|
||||
|
||||
" External Tools {{{
|
||||
" Send cwd to tmux
|
||||
nnoremap <localleader>x :Tmux cd <C-r>=expand("%:p:h")<CR><CR>
|
||||
nnoremap <localleader>X :Tmux cd <C-r>=expand("%:p:r")<CR><CR>
|
||||
" }}}
|
||||
|
||||
" Plugins {{{
|
||||
" bufkill
|
||||
nnoremap zx :Bdelete<CR>
|
||||
|
||||
" CtrlP
|
||||
let g:ctrlp_map = ''
|
||||
" Only open CtrlP if the cwd ISN'T $HOME
|
||||
nnoremap <silent><expr> <leader>/ getcwd() != $HOME ? ":<C-u>CtrlPCurWD<CR>" : ":<C-u>echoe 'Cannot open CtrlP in HOME'<CR>"
|
||||
nnoremap <silent> <leader>. :CtrlPCurFile<CR>
|
||||
nnoremap <silent> <leader>, :CtrlPBuffer<CR>
|
||||
nnoremap <silent> <leader>; :CtrlPFunky<CR>
|
||||
nnoremap <silent> <leader>m :CtrlPMRU<CR>
|
||||
nnoremap <silent> <leader>M :CtrlPModified<CR>
|
||||
nnoremap <silent> <leader>t :CtrlPBufTag<CR>
|
||||
nnoremap <silent> <leader>T :CtrlPBufTagAll<CR>
|
||||
|
||||
" NERDTree
|
||||
map <localleader>\ :NERDTreeCWD<CR>
|
||||
map <localleader>. :NERDTreeFind<CR>
|
||||
|
||||
" Tabularize
|
||||
nmap <leader>a= :Tabularize /=<CR>
|
||||
vmap <leader>a= :Tabularize /=<CR>
|
||||
nmap <leader>a> :Tabularize /=><CR>
|
||||
vmap <leader>a> :Tabularize /=><CR>
|
||||
nmap <leader>a: :Tabularize /:<CR>
|
||||
vmap <leader>a: :Tabularize /:<CR>
|
||||
nmap <leader>a:: :Tabularize /:\zs<CR>
|
||||
vmap <leader>a:: :Tabularize /:\zs<CR>
|
||||
nmap <leader>a, :Tabularize /,<CR>
|
||||
vmap <leader>a, :Tabularize /,<CR>
|
||||
nmap <leader>a<Bar> :Tabularize /<Bar><CR>
|
||||
vmap <leader>a<Bar> :Tabularize /<Bar><CR>
|
||||
|
||||
" UltiSnips
|
||||
let g:UltiSnipsExpandTrigger = "<Tab>"
|
||||
let g:UltiSnipsJumpForwardTrigger = "<Tab>"
|
||||
let g:UltiSnipsJumpBackwardTrigger = "<S-Tab>"
|
||||
" Ignore the default snippets so I (and others) can define their own
|
||||
let g:UltiSnipsSnippetDirectories = ["snips"]
|
||||
|
||||
" Emmet
|
||||
imap <expr> <C-CR> emmet#expandAbbrIntelligent("\<tab>")
|
||||
|
||||
" YCM
|
||||
map g] :YcmCompleter GoToDefinitionElseDeclaration<CR>
|
||||
let g:ycm_key_list_select_completion = ['<C-j>', '<Down>']
|
||||
let g:ycm_key_list_previous_completion = ['<C-k>', '<Up>']
|
||||
|
||||
" vim-surround
|
||||
" I turned the keymappings around to restore the 'feedback'
|
||||
" I get from operator mode after common vim commands, like d
|
||||
" and c.
|
||||
let g:surround_no_mappings = 1
|
||||
nmap sd <Plug>Dsurround
|
||||
nmap sc <Plug>Csurround
|
||||
nmap s <Plug>Ysurround
|
||||
nmap S <Plug>YSurround
|
||||
nmap ss <Plug>Yssurround
|
||||
nmap Ss <Plug>YSsurround
|
||||
nmap SS <Plug>YSsurround
|
||||
xmap S <Plug>VSurround
|
||||
xmap Sg <Plug>VgSurround
|
||||
|
||||
" vim-switch
|
||||
nnoremap <CR> :Switch<CR>
|
||||
" }}}
|
||||
|
||||
" vim:set ft=vim:
|
148
vim/rc/plugins.vim
Normal file
148
vim/rc/plugins.vim
Normal file
|
@ -0,0 +1,148 @@
|
|||
" Appearance {{{
|
||||
NeoBundle 'reedes/vim-colors-pencil'
|
||||
|
||||
" Pretty indent indicators
|
||||
NeoBundle 'Yggdroot/indentLine'
|
||||
let g:indentLine_color_gui = '#4a514f'
|
||||
" }}}
|
||||
|
||||
" File search {{{
|
||||
" More powerful file searching
|
||||
if executable('ag')
|
||||
NeoBundle 'rking/ag.vim'
|
||||
elseif executable('ack')
|
||||
NeoBundle 'mileszs/ack.vim'
|
||||
endif
|
||||
|
||||
" Project-wide search and replace
|
||||
NeoBundle 'skwp/greplace.vim'
|
||||
|
||||
" Netrw improvements
|
||||
NeoBundle 'scrooloose/nerdtree'
|
||||
let NERDTreeMinimalUI = 1
|
||||
let NERDTreeChDirMode = 2
|
||||
" let NERDTreeBookmarksFile = "$HOME/.vim/tmp/NERDtreeBookmarks"
|
||||
let NERDTreeIgnore = ['\~$', '\.swo$', '\.swp$', '\.git$', '\.hg', '\.svn', '\.bzr', '\.settings', '\.project', '\.DS_Store']
|
||||
let NERDTreeShowHidden = 1
|
||||
|
||||
" Command-T, Peepopen or Goto-anything, but for vim, written in VimL
|
||||
NeoBundle 'kien/ctrlp.vim'
|
||||
" Ctrlp extension for jumping to functions
|
||||
NeoBundle 'tacahiroy/ctrlp-funky'
|
||||
" Ctrlp extension for listing git modified files
|
||||
NeoBundle 'jasoncodes/ctrlp-modified.vim'
|
||||
let g:ctrlp_extensions = ['tag', 'buffertag', 'funky']
|
||||
" let g:ctrlp_max_height = 10
|
||||
let g:ctrlp_cache_dir = "~/.vim/tmp/ctrlp"
|
||||
let g:ctrlp_custom_ignore = {
|
||||
\ 'dir': '\.(git|hg|svn|settings)$|tmp$',
|
||||
\ 'file': '\.(exe|so|dll|sass-cache|classpaths|project|cache|jpg|png|gif|swf)$'
|
||||
\ }
|
||||
let g:ctrlp_user_command = 'ag %s -l --nocolor -g ""'
|
||||
let g:ctrlp_match_window = 'bottom,order:btt,min:10,max:10,results:10'
|
||||
" }}}
|
||||
|
||||
" Editing {{{
|
||||
" Extended visual mode commands, substitutes and searches
|
||||
NeoBundle 'vis'
|
||||
|
||||
" Auto-closes delimiters like (),{},[],etc.
|
||||
NeoBundle 'Raimondi/delimitMate'
|
||||
let g:delimitMate_expand_cr = 1
|
||||
let g:delimitMate_expand_space = 1
|
||||
|
||||
" HTML & CSS emmet goodness; Zen coding's successor
|
||||
NeoBundle 'mattn/emmet-vim'
|
||||
|
||||
" Clean way to close buffers without altering window layout
|
||||
" NeoBundle 'mattdbridges/bufkill.vim'
|
||||
NeoBundle 'moll/vim-bbye'
|
||||
|
||||
" For aligning text
|
||||
NeoBundle 'godlygeek/tabular'
|
||||
|
||||
" Comment out code with native comment syntax
|
||||
NeoBundle 'tomtom/tcomment_vim'
|
||||
let g:tcomment_types = {'blade': '{-- %s --}', 'twig': '{# %s #}'}
|
||||
|
||||
" Offers some plugins better compatibility with repeat ('.')
|
||||
NeoBundle 'tpope/vim-repeat'
|
||||
|
||||
" Easy changing and insertion of surrounding delimiters (e.g. quotes,
|
||||
" parenthesis, etc.)
|
||||
NeoBundle 'tpope/vim-surround'
|
||||
|
||||
" Snippets system
|
||||
if has("python")
|
||||
NeoBundle 'SirVer/ultisnips'
|
||||
|
||||
" My snippets
|
||||
NeoBundle 'hlissner/vim-ultisnips-snippets'
|
||||
endif
|
||||
|
||||
" One-key switching between true/false, yes/no, etc
|
||||
NeoBundle 'AndrewRadev/switch.vim'
|
||||
" }}}
|
||||
|
||||
" Remote resources {{{
|
||||
" Visual git diffs in the gutter
|
||||
NeoBundle 'airblade/vim-gitgutter'
|
||||
|
||||
" 'a Git wrapper so awesome, it should be illegal'
|
||||
NeoBundle 'tpope/vim-fugitive'
|
||||
|
||||
" Async compiler plugins
|
||||
NeoBundle 'tpope/vim-dispatch'
|
||||
" }
|
||||
|
||||
" Programming {{{
|
||||
" Syntax checkers for a multitude of languages
|
||||
NeoBundle 'scrooloose/syntastic'
|
||||
let g:syntastic_auto_loc_list=0
|
||||
" let g:syntastic_quiet_messages={'level': 'warnings'}
|
||||
let g:syntastic_phpcs_disable=1
|
||||
let g:syntastic_echo_current_error=1
|
||||
let g:syntastic_enable_balloons = 0
|
||||
|
||||
let g:syntastic_error_symbol = '►'
|
||||
let g:syntastic_warning_symbol = '►'
|
||||
|
||||
let g:syntastic_loc_list_height = 5
|
||||
let g:syntastic_mode_map = {'mode': 'active', 'active_filetypes': [], 'passive_filetypes': ['html']}
|
||||
|
||||
" Running code inline for testing purposes
|
||||
NeoBundle 'notalex/vim-run-live'
|
||||
" }}}
|
||||
|
||||
" Syntax {{{
|
||||
" HTML
|
||||
NeoBundle 'othree/html5.vim'
|
||||
|
||||
" CSS/SCSS/LESS
|
||||
NeoBundle 'cakebaker/scss-syntax.vim'
|
||||
|
||||
" PHP
|
||||
NeoBundleLazy 'StanAngeloff/php.vim', {'autoload': {'filetypes': ['php', 'blade']}}
|
||||
NeoBundleLazy '2072/PHP-Indenting-for-VIm', {'autoload': {'filetypes': ['php']}}
|
||||
" NeoBundleLazy 'stephpy/vim-phpdoc', {'autoload': {'filetypes': ['php']}}
|
||||
|
||||
" Python
|
||||
NeoBundleLazy 'indentpython.vim--nianyang', {'autoload': {'filetypes': ['python']}}
|
||||
NeoBundleLazy 'python_match.vim', {'autoload': {'filetypes': ['python']}}
|
||||
|
||||
" Javascript/Node
|
||||
NeoBundleLazy 'pangloss/vim-javascript', {'autoload': {'filetypes': ['javascript']}}
|
||||
" NeoBundleLazy 'moll/vim-node', {'autoload': {'filetypes': ['javascript']}}
|
||||
NeoBundleLazy 'marijnh/tern_for_vim', {'autoload': {'filetypes': ['javascript']}, 'build': {'mac' : 'npm install'}}
|
||||
|
||||
" C/C++
|
||||
NeoBundle 'octol/vim-cpp-enhanced-highlight'
|
||||
|
||||
" Other
|
||||
NeoBundle 'tpope/vim-markdown'
|
||||
" }}}
|
||||
|
||||
" NeoBundleCheck
|
||||
filetype indent plugin on
|
||||
|
||||
" vim:set ft=vim:
|
0
vim/rc/util.vim
Normal file
0
vim/rc/util.vim
Normal file
180
vimrc
Normal file
180
vimrc
Normal file
|
@ -0,0 +1,180 @@
|
|||
|
||||
set nocompatible
|
||||
|
||||
let g:is_ssh = ($SSH_TTY != "")
|
||||
|
||||
" Initialize NeoBundle
|
||||
set rtp+=~/.vim/bundle/neobundle.vim/
|
||||
call neobundle#rc(expand('~/.vim/bundle'))
|
||||
NeoBundleFetch 'Shougo/neobundle.vim'
|
||||
|
||||
" Preferences {{{
|
||||
syntax on
|
||||
|
||||
" Editor looks {{{
|
||||
" Disable matchit, I find it distracting
|
||||
let loaded_matchparen = 1
|
||||
|
||||
if &t_Co == 8 && $TERM !~# '^linux'
|
||||
set t_Co=16
|
||||
else
|
||||
set t_Co=256
|
||||
endif
|
||||
set background=dark
|
||||
colorscheme Tomorrow-Night-Eighties
|
||||
|
||||
set number " Line numbers
|
||||
set showcmd " Show command issued
|
||||
set fillchars=vert:¦
|
||||
set list
|
||||
set listchars=tab:>\ ,trail:-,extends:>,precedes:<,nbsp:+
|
||||
set textwidth=88
|
||||
|
||||
set synmaxcol=1500
|
||||
" }}}
|
||||
|
||||
" Behavior {{{
|
||||
set autoread " Auto-update a file that's been edited externally
|
||||
set nospell " No spell check, please
|
||||
set visualbell " No sounds!
|
||||
set backspace=indent,eol,start
|
||||
set lazyredraw " Don't update screen while running macros
|
||||
set hidden " Hide abandoned buffers
|
||||
set shortmess+=filmnrxoOtTs
|
||||
set nrformats-=octal
|
||||
set fileformats+=mac
|
||||
|
||||
set mouse=a
|
||||
if exists('$TMUX') " Support resizing in tmux
|
||||
set ttymouse=xterm2
|
||||
endif
|
||||
" }}}
|
||||
|
||||
" StatusBar {{{
|
||||
if has('statusline')
|
||||
set laststatus=2
|
||||
set ruler " Show line/col no in statusline
|
||||
set statusline=%t " tail of the filename
|
||||
set statusline+=%w%h%m%r " Options
|
||||
if exists('g:loaded_syntastic_plugin')
|
||||
set statusline+=\ %{SyntasticStatuslineFlag()}
|
||||
endif
|
||||
set statusline+=%= " left/right separator
|
||||
set statusline+=%y " filetype
|
||||
if exists('g:loaded_fugitive')
|
||||
set statusline+=\ %{fugitive#statusline()} " Git Hotness
|
||||
endif
|
||||
set statusline+=\ •\
|
||||
set statusline+=%c " cursor column
|
||||
set statusline+=\ %l/%L " cursor line/total lines
|
||||
set statusline+=\ \:%P " percent through file
|
||||
endif
|
||||
" }}}
|
||||
|
||||
" Movement & search {{{
|
||||
set nostartofline
|
||||
set sidescrolloff=5
|
||||
|
||||
set incsearch " find as you type
|
||||
set hlsearch " Highlight search terms
|
||||
set ignorecase " case insensitive search
|
||||
set smartcase " case sensitive when uc present
|
||||
set gdefault " global flag for substitute by default
|
||||
|
||||
if executable('ag')
|
||||
let g:ackprg = 'ag --nogroup --nocolor --column'
|
||||
set grepprg=ag\ --nogroup\ --nocolor
|
||||
elseif executable('ack-grep')
|
||||
let g:ackprg = "ack-grep -H --nocolor --nogroup --column"
|
||||
endif
|
||||
" }}}
|
||||
|
||||
" Text formatting {{{
|
||||
set autoindent
|
||||
set shiftround
|
||||
set expandtab
|
||||
set shiftwidth=4
|
||||
set tabstop=4
|
||||
set softtabstop=4
|
||||
" Wrapping
|
||||
set nowrap
|
||||
" Backspace and cursor keys to wrap
|
||||
set whichwrap=b,s,h,l,<,>,[,]
|
||||
" see :h fo-table
|
||||
set formatoptions=qrn1lr
|
||||
" }}}
|
||||
|
||||
" Folding {{{
|
||||
set foldlevel=1
|
||||
" Cleaner, readable fold headers
|
||||
set foldtext=MyFoldText()
|
||||
fu! MyFoldText()
|
||||
let line = getline(v:foldstart)
|
||||
" Lines that have been folded
|
||||
let nl = v:foldend - v:foldstart + 1
|
||||
|
||||
let indent = repeat(' ', indent(v:foldstart))
|
||||
let endcol = &colorcolumn ? &colorcolumn : &textwidth
|
||||
let startcol = &columns < endcol ? &columns-4 : endcol
|
||||
|
||||
return indent . substitute(line,"^ *","",1)
|
||||
endf
|
||||
" }}}
|
||||
|
||||
" Swap files, history & persistence {{{
|
||||
" No backup (that's what git is for!) and swapfiles are annoying
|
||||
set nobackup
|
||||
set nowritebackup
|
||||
set noswapfile
|
||||
if has('persistent_undo')
|
||||
set undodir=~/.vim/tmp/undo
|
||||
set undofile
|
||||
set undolevels=500
|
||||
set undoreload=500
|
||||
endif
|
||||
set history=5000
|
||||
|
||||
" Preserve buffer state (cursor location, folds, etc.)
|
||||
set viewdir=~/.vim/tmp/views
|
||||
set viewoptions=cursor,folds,unix,slash
|
||||
augroup persistence
|
||||
au!
|
||||
au BufWinLeave * if expand("%") != "" | silent! mkview | endif
|
||||
au BufWinEnter * if expand("%") != "" | silent! loadview | endif
|
||||
augroup END
|
||||
" }}}
|
||||
|
||||
" Omnicomplete + wild settings {{{
|
||||
set tags=./.tags;/,~/.tags,~/tags
|
||||
|
||||
set complete-=i
|
||||
set completeopt=menu
|
||||
set wildmenu " Show menu instead of auto-complete
|
||||
set wildmode=list:longest,full " command <Tab> completion: list
|
||||
" matches -> longest common -> then
|
||||
" all.
|
||||
set wildignore+=*.swp,*.log,.sass-cache,.codekit-cache,config.codekit
|
||||
set wildignore+=*.class,*.o,*.pyc,*.obj,*DS_Store*
|
||||
" }}}
|
||||
|
||||
" Automatically close the popup menu / preview window
|
||||
au InsertLeave * if pumvisible() == 0|silent! pclose|endif
|
||||
|
||||
" Set *.scss to ft=scss instead of css.scss
|
||||
au BufRead,BufNewFile *.scss set filetype=scss
|
||||
" }}}
|
||||
|
||||
" Bundles and their settings are specified externally.
|
||||
source $HOME/.vim/rc/plugins.vim
|
||||
|
||||
" rcfiles
|
||||
source $HOME/.vim/rc/keymaps.vim
|
||||
source $HOME/.vim/rc/util.vim
|
||||
|
||||
" If one exists, this is where you'll want local settings
|
||||
try
|
||||
source $HOME/.vimrc.local
|
||||
catch
|
||||
endtry
|
||||
|
||||
" vim:set fdl=0 fdm=marker:
|
Loading…
Reference in a new issue