diff --git a/vim/colors/Tomorrow-Night-Eighties.vim b/vim/colors/Tomorrow-Night-Eighties.vim new file mode 100644 index 00000000..38182f2c --- /dev/null +++ b/vim/colors/Tomorrow-Night-Eighties.vim @@ -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 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 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 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 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 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 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 colour(r, g, b) + " Get the closest grey + let l:gx = grey_number(a:r) + let l:gy = grey_number(a:g) + let l:gz = grey_number(a:b) + + " Get the closest colour + let l:x = rgb_number(a:r) + let l:y = rgb_number(a:g) + let l:z = rgb_number(a:b) + + if l:gx == l:gy && l:gy == l:gz + " There are two possibilities + let l:dgr = grey_level(l:gx) - a:r + let l:dgg = grey_level(l:gy) - a:g + let l:dgb = grey_level(l:gz) - a:b + let l:dgrey = (l:dgr * l:dgr) + (l:dgg * l:dgg) + (l:dgb * l:dgb) + let l:dr = rgb_level(l:gx) - a:r + let l:dg = rgb_level(l:gy) - a:g + let l:db = 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 grey_colour(l:gx) + else + " Use the colour + return rgb_colour(l:x, l:y, l:z) + endif + else + " Only one possibility + return rgb_colour(l:x, l:y, l:z) + endif + endfun + + " Returns the palette index to approximate the 'rrggbb' hex string + fun 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 colour(l:r, l:g, l:b) + endfun + + " Sets the highlighting for the given group + fun X(group, fg, bg, attr) + if a:fg != "" + exec "hi " . a:group . " guifg=#" . a:fg . " ctermfg=" . rgb(a:fg) + endif + if a:bg != "" + exec "hi " . a:group . " guibg=#" . a:bg . " ctermbg=" . rgb(a:bg) + endif + if a:attr != "" + exec "hi " . a:group . " gui=" . a:attr . " cterm=" . a:attr + endif + endfun + + " Vim Highlighting + call X("Normal", s:foreground, s:background, "") + call X("LineNr", s:selection, "", "") + call X("NonText", s:selection, "", "") + call X("SpecialKey", s:selection, "", "") + call X("Search", s:background, s:yellow, "") + call X("TabLine", s:window, s:foreground, "reverse") + call X("TabLineFill", s:window, s:foreground, "reverse") + call X("StatusLine", s:window, s:yellow, "reverse") + call X("StatusLineNC", s:window_dim, s:comment, "reverse") + call X("VertSplit", s:window, s:window, "none") + call X("Visual", "", s:selection, "") + call X("Directory", s:blue, "", "") + call X("ModeMsg", s:green, "", "") + call X("MoreMsg", s:green, "", "") + call X("Question", s:green, "", "") + call X("WarningMsg", s:red, "", "") + call X("MatchParen", "", s:selection, "") + call X("Folded", s:comment, s:window_dim, "") + " call X("Folded", s:comment, s:background, "") + call X("FoldColumn", "", s:background, "") + if version >= 700 + call X("CursorLine", "", s:line, "none") + call X("CursorColumn", "", s:line, "none") + call X("PMenu", s:foreground, s:selection, "none") + call X("PMenuSel", s:foreground, s:selection, "reverse") + call X("SignColumn", "", s:background, "none") + end + if version >= 703 + call X("ColorColumn", "", s:line, "none") + end + + " Standard Highlighting + call X("Comment", s:comment, "", "") + call X("Todo", s:comment, s:background, "") + call X("Title", s:comment, "", "") + call X("Identifier", s:red, "", "none") + call X("Statement", s:foreground, "", "") + call X("Conditional", s:foreground, "", "") + call X("Repeat", s:foreground, "", "") + call X("Structure", s:purple, "", "") + call X("Function", s:blue, "", "") + call X("Constant", s:orange, "", "") + call X("String", s:green, "", "") + call X("Special", s:blue, "", "") + call X("PreProc", s:purple, "", "") + call X("Operator", s:aqua, "", "none") + call X("Type", s:blue, "", "none") + call X("Define", s:purple, "", "none") + call X("Include", s:blue, "", "") + "call X("Ignore", "666666", "", "") + + " Vim Highlighting + call X("vimCommand", s:red, "", "none") + + " C Highlighting + call X("cType", s:yellow, "", "") + call X("cStorageClass", s:purple, "", "") + call X("cConditional", s:purple, "", "") + call X("cRepeat", s:purple, "", "") + + " PHP Highlighting + call X("phpVarSelector", s:red, "", "") + call X("phpKeyword", s:purple, "", "") + call X("phpRepeat", s:purple, "", "") + call X("phpConditional", s:purple, "", "") + call X("phpStatement", s:purple, "", "") + call X("phpMemberSelector", s:foreground, "", "") + + " Ruby Highlighting + call X("rubySymbol", s:green, "", "") + call X("rubyConstant", s:yellow, "", "") + call X("rubyAccess", s:yellow, "", "") + call X("rubyAttribute", s:blue, "", "") + call X("rubyInclude", s:blue, "", "") + call X("rubyLocalVariableOrMethod", s:orange, "", "") + call X("rubyCurlyBlock", s:orange, "", "") + call X("rubyStringDelimiter", s:green, "", "") + call X("rubyInterpolationDelimiter", s:orange, "", "") + call X("rubyConditional", s:purple, "", "") + call X("rubyRepeat", s:purple, "", "") + call X("rubyControl", s:purple, "", "") + call X("rubyException", s:purple, "", "") + + " Python Highlighting + call X("pythonInclude", s:purple, "", "") + call X("pythonStatement", s:purple, "", "") + call X("pythonConditional", s:purple, "", "") + call X("pythonRepeat", s:purple, "", "") + call X("pythonException", s:purple, "", "") + call X("pythonFunction", s:blue, "", "") + call X("pythonPreCondit", s:purple, "", "") + call X("pythonRepeat", s:aqua, "", "") + call X("pythonExClass", s:orange, "", "") + + " JavaScript Highlighting + call X("javaScriptBraces", s:foreground, "", "") + call X("javaScriptFunction", s:purple, "", "") + call X("javaScriptConditional", s:purple, "", "") + call X("javaScriptRepeat", s:purple, "", "") + call X("javaScriptNumber", s:orange, "", "") + call X("javaScriptMember", s:orange, "", "") + call X("javascriptNull", s:orange, "", "") + call X("javascriptGlobal", s:blue, "", "") + call X("javascriptStatement", s:red, "", "") + + " HTML Highlighting + call X("htmlTag", s:red, "", "") + call X("htmlTagName", s:red, "", "") + call X("htmlArg", s:red, "", "") + call X("htmlScriptTag", s:red, "", "") + + " Diff Highlighting + call X("diffAdded", s:green, "", "") + call X("diffRemoved", s:red, "", "") + + " ShowMarks Highlighting + call X("ShowMarksHLl", s:orange, s:background, "none") + call X("ShowMarksHLo", s:purple, s:background, "none") + call X("ShowMarksHLu", s:yellow, s:background, "none") + call X("ShowMarksHLm", s:aqua, s:background, "none") + + " Lua Highlighting + call X("luaStatement", s:purple, "", "") + call X("luaRepeat", s:purple, "", "") + call X("luaCondStart", s:purple, "", "") + call X("luaCondElseif", s:purple, "", "") + call X("luaCond", s:purple, "", "") + call X("luaCondEnd", s:purple, "", "") + + " Cucumber Highlighting + call X("cucumberGiven", s:blue, "", "") + call X("cucumberGivenAnd", s:blue, "", "") + + " Go Highlighting + call X("goDirective", s:purple, "", "") + call X("goDeclaration", s:purple, "", "") + call X("goStatement", s:purple, "", "") + call X("goConditional", s:purple, "", "") + call X("goConstants", s:orange, "", "") + call X("goTodo", s:yellow, "", "") + call X("goDeclType", s:blue, "", "") + call X("goBuiltins", s:purple, "", "") + + " Clojure "highlighting + call X("clojureConstant", s:orange, "", "") + call X("clojureBoolean", s:orange, "", "") + call X("clojureCharacter", s:orange, "", "") + call X("clojureKeyword", s:green, "", "") + call X("clojureNumber", s:orange, "", "") + call X("clojureString", s:green, "", "") + call X("clojureRegexp", s:green, "", "") + call X("clojureParen", s:aqua, "", "") + call X("clojureVariable", s:yellow, "", "") + call X("clojureCond", s:blue, "", "") + call X("clojureDefine", s:purple, "", "") + call X("clojureException", s:red, "", "") + call X("clojureFunc", s:blue, "", "") + call X("clojureMacro", s:blue, "", "") + call X("clojureRepeat", s:blue, "", "") + call X("clojureSpecial", s:purple, "", "") + call X("clojureQuote", s:blue, "", "") + call X("clojureUnquote", s:blue, "", "") + call X("clojureMeta", s:blue, "", "") + call X("clojureDeref", s:blue, "", "") + call X("clojureAnonArg", s:blue, "", "") + call X("clojureRepeat", s:blue, "", "") + call X("clojureDispatch", s:blue, "", "") + + " Scala "highlighting + call X("scalaKeyword", s:purple, "", "") + call X("scalaKeywordModifier", s:purple, "", "") + call X("scalaOperator", s:blue, "", "") + call X("scalaPackage", s:red, "", "") + call X("scalaFqn", s:foreground, "", "") + call X("scalaFqnSet", s:foreground, "", "") + call X("scalaImport", s:purple, "", "") + call X("scalaBoolean", s:orange, "", "") + call X("scalaDef", s:purple, "", "") + call X("scalaVal", s:purple, "", "") + call X("scalaVar", s:aqua, "", "") + call X("scalaClass", s:purple, "", "") + call X("scalaObject", s:purple, "", "") + call X("scalaTrait", s:purple, "", "") + call X("scalaDefName", s:blue, "", "") + call X("scalaValName", s:foreground, "", "") + call X("scalaVarName", s:foreground, "", "") + call X("scalaClassName", s:foreground, "", "") + call X("scalaType", s:yellow, "", "") + call X("scalaTypeSpecializer", s:yellow, "", "") + call X("scalaAnnotation", s:orange, "", "") + call X("scalaNumber", s:orange, "", "") + call X("scalaDefSpecializer", s:yellow, "", "") + call X("scalaClassSpecializer", s:yellow, "", "") + call X("scalaBackTick", s:green, "", "") + call X("scalaRoot", s:foreground, "", "") + call X("scalaMethodCall", s:blue, "", "") + call X("scalaCaseType", s:yellow, "", "") + call X("scalaLineComment", s:comment, "", "") + call X("scalaComment", s:comment, "", "") + call X("scalaDocComment", s:comment, "", "") + call X("scalaDocTags", s:comment, "", "") + call X("scalaEmptyString", s:green, "", "") + call X("scalaMultiLineString", s:green, "", "") + call X("scalaUnicode", s:orange, "", "") + call X("scalaString", s:green, "", "") + call X("scalaStringEscape", s:green, "", "") + call X("scalaSymbol", s:orange, "", "") + call X("scalaChar", s:orange, "", "") + call X("scalaXml", s:green, "", "") + call X("scalaConstructorSpecializer", s:yellow, "", "") + call X("scalaBackTick", s:blue, "", "") + + " Snippet highlighting + call X("snipKeyword", s:purple, "", "") + call X("snipStart", s:yellow, "", "") + + " Shell highlighting + call X("zshVariableDef", s:orange, "", "") + call X("zshCommands", s:blue, "", "") + + + " Delete Functions + delf X + delf rgb + delf colour + delf rgb_colour + delf rgb_level + delf rgb_number + delf grey_colour + delf grey_level + delf grey_number +endif + +set background=dark diff --git a/vim/rc/keymaps.vim b/vim/rc/keymaps.vim new file mode 100644 index 00000000..b9d6dfc4 --- /dev/null +++ b/vim/rc/keymaps.vim @@ -0,0 +1,167 @@ + +" Shortcut to vimrc and gvimrc +nnoremap v :CtrlP ~/.vim + +" Comma get some... sorry. +let mapleader = ',' +let maplocalleader = '\' +noremap ; : + +" Trigger to preserve indentation on pastes +set pastetoggle= +" Easier than escape. Pinnacle of laziness. +imap jk +" Turn off search highlighting +noremap ? :nohlsearch + +" 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 % + " Easier fold toggle + nnoremap 5j + vnoremap 5j + nnoremap 5k + vnoremap 5k + + " f: Find. Also support repeating with . + nnoremap OriginalSemicolon ; + nnoremap f :call repeat#set("\Plug>OriginalSemicolon")f + nnoremap t :call repeat#set("\Plug>OriginalSemicolon")t + nnoremap F :call repeat#set("\Plug>OriginalSemicolon")F + nnoremap T :call repeat#set("\Plug>OriginalSemicolon")T +" }}} + +" Editing {{{ + nnoremap + " Insert-mode navigation + " Go to end of line + inoremap A + " Go to start of line + inoremap I + + " Make Y act consistant with C and D + nnoremap Y y$ + + " Don't leave visual mode after indenting + vnoremap < >gv + + " Textmate-like CMD+Enter (O in insert mode) + inoremap o + inoremap O + + " Enabling repeat in visual mode + vmap . :normal . +" }}} + +" Buffers {{{ + " Change CWD to current file's directory + nnoremap cd :cd %:p:h:pwd + + " Next/prev buffer + nnoremap ]b :bnext + nnoremap [b :bprevious +" }}} + +" Command {{{ + " Annoying command mistakes + com! -bang -nargs=* -complete=file E e + com! -bang -nargs=* -complete=file W w + com! -bang -nargs=* -complete=file Wq wq + com! -bang -nargs=* -complete=file WQ wq + com! -bang Wa wa + com! -bang WA wa + com! -bang Q q + com! -bang QA qa + com! -bang Qa qa + " Forget to sudo? + com! WW w !sudo tree % >/dev/null + + " Shortcuts + cnoremap ;/ =expand('%:p:h').'/' + cnoremap ;; =expand("%:t") + cnoremap ;. =expand("%:p:r") + + " Mimic shortcuts in the terminal + cnoremap + cnoremap +" }}} + +" External Tools {{{ + " Send cwd to tmux + nnoremap x :Tmux cd =expand("%:p:h") + nnoremap X :Tmux cd =expand("%:p:r") +" }}} + +" Plugins {{{ + " bufkill + nnoremap zx :Bdelete + + " CtrlP + let g:ctrlp_map = '' + " Only open CtrlP if the cwd ISN'T $HOME + nnoremap / getcwd() != $HOME ? ":CtrlPCurWD" : ":echoe 'Cannot open CtrlP in HOME'" + nnoremap . :CtrlPCurFile + nnoremap , :CtrlPBuffer + nnoremap ; :CtrlPFunky + nnoremap m :CtrlPMRU + nnoremap M :CtrlPModified + nnoremap t :CtrlPBufTag + nnoremap T :CtrlPBufTagAll + + " NERDTree + map \ :NERDTreeCWD + map . :NERDTreeFind + + " Tabularize + nmap a= :Tabularize /= + vmap a= :Tabularize /= + nmap a> :Tabularize /=> + vmap a> :Tabularize /=> + nmap a: :Tabularize /: + vmap a: :Tabularize /: + nmap a:: :Tabularize /:\zs + vmap a:: :Tabularize /:\zs + nmap a, :Tabularize /, + vmap a, :Tabularize /, + nmap a :Tabularize / + vmap a :Tabularize / + + " UltiSnips + let g:UltiSnipsExpandTrigger = "" + let g:UltiSnipsJumpForwardTrigger = "" + let g:UltiSnipsJumpBackwardTrigger = "" + " Ignore the default snippets so I (and others) can define their own + let g:UltiSnipsSnippetDirectories = ["snips"] + + " Emmet + imap emmet#expandAbbrIntelligent("\") + + " YCM + map g] :YcmCompleter GoToDefinitionElseDeclaration + let g:ycm_key_list_select_completion = ['', ''] + let g:ycm_key_list_previous_completion = ['', ''] + + " 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 Dsurround + nmap sc Csurround + nmap s Ysurround + nmap S YSurround + nmap ss Yssurround + nmap Ss YSsurround + nmap SS YSsurround + xmap S VSurround + xmap Sg VgSurround + + " vim-switch + nnoremap :Switch +" }}} + +" vim:set ft=vim: diff --git a/vim/rc/plugins.vim b/vim/rc/plugins.vim new file mode 100644 index 00000000..5346be47 --- /dev/null +++ b/vim/rc/plugins.vim @@ -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: diff --git a/vim/rc/util.vim b/vim/rc/util.vim new file mode 100644 index 00000000..e69de29b diff --git a/vimrc b/vimrc new file mode 100644 index 00000000..21174a8a --- /dev/null +++ b/vimrc @@ -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 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: