Skip to content

Instantly share code, notes, and snippets.

@fsmv
Last active October 17, 2022 14:05
Show Gist options
  • Save fsmv/8798575 to your computer and use it in GitHub Desktop.
Save fsmv/8798575 to your computer and use it in GitHub Desktop.
my vim config
"
" Terminal Colors: http://terminal.sexy/#IyMjoKCgMDAw03CjbZ4_tYhYYJXFrHveO6J1z8_PaGho_6fao9Vy772LmMv-5bD_ddqp____
"
set nocompatible
filetype off
"Set up the Vundle plugin manager
set rtp+=~/.vim/bundle/Vundle.vim/
call vundle#rc()
" The plugin installing plugin
Plugin 'gmarik/vundle'
"Plugin 'scrooloose/syntastic'
"Plugin 'Valloric/YouCompleteMe'
"Show which lines are new in the git repo
Plugin 'airblade/vim-gitgutter'
" :A switch between .cpp and .h; :AS switch + split;
" :IH, <leader>ih switch to file under cursor;
Plugin 'vim-scripts/a.vim'
" gr<move> replace with register, grr replace line with register
Plugin 'vim-scripts/ReplaceWithRegister'
Plugin 'freitass/todo.txt-vim'
" Reads .local.vimrc in project folder to add any config you want
Plugin 'thinca/vim-localrc'
" Magic tab completion
Plugin 'ervandew/supertab'
" Run commands in the bacground (used for the compile command)
Plugin 'fsmv/vim-dispatch'
" :S search and replace to keep the case when replacing
Plugin 'tpope/vim-abolish'
" Turn on sytax highlighting
syntax on
" Turn on line numbers
set nu
" Turn off the swap file (backup file)
set noswapfile
" Enable mouse
set mouse=a
set ttymouse=xterm2
" Set terminal title
set title
" https://github.com/twerth/ir_black/blob/master/colors/ir_black.vim
colorscheme ir_black
" Tab behavior
set autoindent
set smartindent
set cindent
set softtabstop=4
set shiftwidth=4
set expandtab
" Lots of undo steps
set undolevels=1000
" Set supertab to complete like bash
let g:SuperTabLongestEnhanced=1
set completeopt+=longest
" Match the default braces with cursor highlighting and also match <>
set showmatch
set cursorline
set matchpairs+=<:>
" Search options
set incsearch
set ignorecase
set smartcase
set hlsearch
" Display tab characters as "|---" and spaces as ".", but only trailing spaces
set list
set listchars=tab:\|-,trail:.,extends:#,nbsp:.
" Set 80 char column line with automatic wrapping
set textwidth=80
set colorcolumn=+1
highlight ColorColumn ctermbg=black
set nowrap
set fo-=t
" Folding options
set foldcolumn=1
hi FoldColumn ctermbg=NONE
set foldopen-=block
" Automatic view saving
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
set viewoptions=cursor,folds,slash,unix
if !exists("g:autosave_view")
let g:autosave_view = 0
endif
function! MakeViewCheck()
" If we're not configured to autosave
if g:autosave_view == 0 | return 0 | endif
" if we're in diff mode
if &l:diff | return 0 | endif
" If we're not a file
if &buftype != '' | return 0 | endif
if expand('%') =~ '\[.*\]' | return 0 | endif
" File does not exist on disk
if empty(glob(expand('%:p'))) | return 0 | endif
if &modifiable == 0 | return 0 | endif
" If we're in the temp dir
if len($TEMP) && expand('%:p:h') == $TEMP | return 0 | endif
if len($TMP) && expand('%:p:h') == $TMP | return 0 | endif
return 1
endfunction
augroup AutoView
autocmd!
" Autosave & Load Views.
autocmd BufWritePre,BufWinLeave ?* if MakeViewCheck() | silent! mkview | endif
autocmd BufWinEnter ?* if MakeViewCheck() | silent! loadview | endif
augroup END
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Shorcut Ctrl+n: make
nmap <C-n> :Make<CR>
"Run command (put output of a command into quckfix)
command! -nargs=+ Run :cexpr system('<args>') | copen
"Shortcut (\r): Remove block comment
nmap \r :%s/\n\/\*\_.\{-}\*\///<CR>
"Shortcut (\y): Save session to ~/.defsession.vim
nmap \y :mksession ~/.defsession.vim<CR>
"Shortcut (\p): Reload the ~/.vim/defsession.vim session
nmap \p :source ~/.defsession.vim<CR>
"Shortcut (\L)\: Toggle showing list chars
nmap \L :set list!<CR>
"Shortcut (\l): Toggle line numbers
nmap \l :setlocal number!<CR>
"Shortcut (\o): Toggle paste mode
nmap \o :set paste!<CR>
"Shortcut (\q): Turn off highlighting search results
nmap \q :nohlsearch<CR>
"Shortcut (\s): Toggle spellcheck
nmap \s :set spell!<CR>
"Shortcut (\t): Set 4 char space tabs
nmap \t :set expandtab tabstop=4 shiftwidth=4 softtabstop=4<CR>
"Shortcut (\T): Set 8 char space tabs
nmap \T :set expandtab tabstop=8 shiftwidth=8 softtabstop=8<CR>
"Shortcut (\m): Set 4 char tab tabs
nmap \m :set noexpandtab tabstop=4 shiftwidth=4 softtabstop=4<CR>
"Shortcut (\M): Set 8 char tab tabs
nmap \M :set noexpandtab tabstop=8 shiftwidth=8 softtabstop=8<CR>
"Shortcut (\w): Toggle line wrapping at line limit
nmap \w :call AutoWrapToggle()<CR>
function! AutoWrapToggle()
if &formatoptions =~ 't'
set fo-=t
else
set fo+=t
endif
endfunction
" ir_black color scheme (With modifications by Andrew Kallmeyer <fsmv@sapium.net>)
" https://github.com/twerth/ir_black/blob/master/colors/ir_black.vim
" More at: http://blog.infinitered.com
" ********************************************************************************
" Standard colors used in all ir_black themes:
" Note, x:x:x are RGB values
"
" normal: #f6f3e8
"
" string: #A8FF60 168:255:96
" string inner (punc, code, etc): #00A0A0 0:160:160
" number: #FF73FD 255:115:253
" comments: #7C7C7C 124:124:124
" keywords: #96CBFE 150:203:254
" operators: white
" class: #FFFFB6 255:255:182
" method declaration name: #FFD2A7 255:210:167
" regular expression: #E9C062 233:192:98
" regexp alternate: #FF8000 255:128:0
" regexp alternate 2: #B18A3D 177:138:61
" variable: #C6C5FE 198:197:254
"
" Misc colors:
" red color (used for whatever): #FF6C60 255:108:96
" light red: #FFB6B0 255:182:176
"
" brown: #E18964 good for special
"
" lightpurpleish: #FFCCFF
"
" Interface colors:
" background color: black
" cursor (where underscore is used): #FFA560 255:165:96
" cursor (where block is used): white
" visual selection: #1D1E2C
" current line: #151515 21:21:21
" search selection: #07281C 7:40:28
" line number: #3D3D3D 61:61:61
" ********************************************************************************
" The following are the preferred 16 colors for your terminal
" Colors Bright Colors
" Black #4E4E4E #7C7C7C
" Red #FF6C60 #FFB6B0
" Green #A8FF60 #CEFFAB
" Yellow #FFFFB6 #FFFFCB
" Blue #96CBFE #B5DCFE
" Magenta #FF73FD #FF9CFE
" Cyan #C6C5FE #DFDFFE
" White #EEEEEE #FFFFFF
" ********************************************************************************
set background=dark
hi clear
if exists("syntax_on")
syntax reset
endif
let colors_name = "ir_black"
"hi Example guifg=NONE guibg=NONE gui=NONE ctermfg=NONE ctermbg=NONE cterm=NONE
" General colors
hi Normal guifg=#f6f3e8 guibg=black gui=NONE ctermfg=NONE ctermbg=NONE cterm=NONE
hi NonText guifg=#070707 guibg=black gui=NONE ctermfg=black ctermbg=NONE cterm=NONE
hi Cursor guifg=black guibg=white gui=NONE ctermfg=black ctermbg=white cterm=reverse
hi LineNr guifg=#3D3D3D guibg=black gui=NONE ctermfg=darkgray ctermbg=NONE cterm=NONE
hi VertSplit guifg=#202020 guibg=#202020 gui=NONE ctermfg=darkgray ctermbg=darkgray cterm=NONE
hi StatusLine guifg=#CCCCCC guibg=#202020 gui=italic ctermfg=white ctermbg=darkgray cterm=NONE
hi StatusLineNC guifg=black guibg=#202020 gui=NONE ctermfg=blue ctermbg=darkgray cterm=NONE
hi Folded guifg=#a0a8b0 guibg=#384048 gui=NONE ctermfg=NONE ctermbg=NONE cterm=NONE
hi Title guifg=#f6f3e8 guibg=NONE gui=bold ctermfg=NONE ctermbg=NONE cterm=NONE
hi Visual guifg=NONE guibg=#262D51 gui=NONE ctermfg=NONE ctermbg=NONE cterm=REVERSE
hi SpecialKey guifg=#808080 guibg=#343434 gui=NONE ctermfg=NONE ctermbg=NONE cterm=NONE
hi WildMenu guifg=green guibg=yellow gui=NONE ctermfg=black ctermbg=yellow cterm=NONE
hi PmenuSbar guifg=black guibg=white gui=NONE ctermfg=black ctermbg=white cterm=NONE
"hi Ignore guifg=gray guibg=black gui=NONE ctermfg=NONE ctermbg=NONE cterm=NONE
hi Error guifg=NONE guibg=NONE gui=undercurl ctermfg=black ctermbg=red cterm=NONE guisp=#FF6C60 " undercurl color
hi ErrorMsg guifg=white guibg=#FF6C60 gui=BOLD ctermfg=black ctermbg=red cterm=NONE
hi WarningMsg guifg=white guibg=#FF6C60 gui=BOLD ctermfg=black ctermbg=red cterm=NONE
hi LongLineWarning guifg=NONE guibg=#371F1C gui=underline ctermfg=NONE ctermbg=NONE cterm=underline
hi SpellBad guifg=NONE guibg=NONE gui=undercurl ctermfg=white ctermbg=red cterm=NONE guisp=#FF6C0 " undercurl coloro
hi DiffAdd ctermfg=white
hi DiffChange ctermfg=white
hi DiffDelete ctermfg=white
hi DiffText ctermfg=white
" Message displayed in lower left, such as --INSERT--
hi ModeMsg guifg=black guibg=#C6C5FE gui=BOLD ctermfg=black ctermbg=cyan cterm=BOLD
if version >= 700 " Vim 7.x specific colors
hi CursorLine guifg=NONE guibg=#121212 gui=NONE ctermfg=NONE ctermbg=NONE cterm=BOLD
hi CursorColumn guifg=NONE guibg=#121212 gui=NONE ctermfg=NONE ctermbg=NONE cterm=BOLD
hi MatchParen guifg=#f6f3e8 guibg=#857b6f gui=BOLD ctermfg=white ctermbg=darkgray cterm=NONE
hi Pmenu guifg=#f6f3e8 guibg=#444444 gui=NONE ctermfg=white ctermbg=darkgray cterm=NONE
hi PmenuSel guifg=#000000 guibg=#cae682 gui=NONE ctermfg=white ctermbg=black cterm=underline
hi Search guifg=NONE guibg=#2F2F00 gui=underline ctermfg=NONE ctermbg=NONE cterm=underline
endif
" Syntax highlighting
hi Comment guifg=#7C7C7C guibg=NONE gui=NONE ctermfg=darkgray ctermbg=NONE cterm=NONE
hi String guifg=#A8FF60 guibg=NONE gui=NONE ctermfg=green ctermbg=NONE cterm=NONE
hi Number guifg=#FF73FD guibg=NONE gui=NONE ctermfg=magenta ctermbg=NONE cterm=NONE
hi Keyword guifg=#96CBFE guibg=NONE gui=NONE ctermfg=blue ctermbg=NONE cterm=NONE
hi PreProc guifg=#96CBFE guibg=NONE gui=NONE ctermfg=blue ctermbg=NONE cterm=NONE
hi Conditional guifg=#6699CC guibg=NONE gui=NONE ctermfg=blue ctermbg=NONE cterm=NONE " if else end
hi Todo guifg=#8f8f8f guibg=NONE gui=NONE ctermfg=red ctermbg=NONE cterm=NONE
hi Constant guifg=#99CC99 guibg=NONE gui=NONE ctermfg=cyan ctermbg=NONE cterm=NONE
hi Identifier guifg=#C6C5FE guibg=NONE gui=NONE ctermfg=cyan ctermbg=NONE cterm=NONE
hi Function guifg=#FFD2A7 guibg=NONE gui=NONE ctermfg=brown ctermbg=NONE cterm=NONE
hi Type guifg=#FFFFB6 guibg=NONE gui=NONE ctermfg=yellow ctermbg=NONE cterm=NONE
hi Statement guifg=#6699CC guibg=NONE gui=NONE ctermfg=lightblue ctermbg=NONE cterm=NONE
hi Special guifg=#E18964 guibg=NONE gui=NONE ctermfg=white ctermbg=NONE cterm=NONE
hi Delimiter guifg=#00A0A0 guibg=NONE gui=NONE ctermfg=cyan ctermbg=NONE cterm=NONE
hi Operator guifg=white guibg=NONE gui=NONE ctermfg=white ctermbg=NONE cterm=NONE
hi link Character Constant
hi link Boolean Constant
hi link Float Number
hi link Repeat Statement
hi link Label Statement
hi link Exception Statement
hi link Include PreProc
hi link Define PreProc
hi link Macro PreProc
hi link PreCondit PreProc
hi link StorageClass Type
hi link Structure Type
hi link Typedef Type
hi link Tag Special
hi link SpecialChar Special
hi link SpecialComment Special
hi link Debug Special
" Special for Ruby
hi rubyRegexp guifg=#B18A3D guibg=NONE gui=NONE ctermfg=brown ctermbg=NONE cterm=NONE
hi rubyRegexpDelimiter guifg=#FF8000 guibg=NONE gui=NONE ctermfg=brown ctermbg=NONE cterm=NONE
hi rubyEscape guifg=white guibg=NONE gui=NONE ctermfg=cyan ctermbg=NONE cterm=NONE
hi rubyInterpolationDelimiter guifg=#00A0A0 guibg=NONE gui=NONE ctermfg=blue ctermbg=NONE cterm=NONE
hi rubyControl guifg=#6699CC guibg=NONE gui=NONE ctermfg=blue ctermbg=NONE cterm=NONE "and break, etc
"hi rubyGlobalVariable guifg=#FFCCFF guibg=NONE gui=NONE ctermfg=lightblue ctermbg=NONE cterm=NONE "yield
hi rubyStringDelimiter guifg=#336633 guibg=NONE gui=NONE ctermfg=lightgreen ctermbg=NONE cterm=NONE
"rubyInclude
"rubySharpBang
"rubyAccess
"rubyPredefinedVariable
"rubyBoolean
"rubyClassVariable
"rubyBeginEnd
"rubyRepeatModifier
"hi link rubyArrayDelimiter Special " [ , , ]
"rubyCurlyBlock { , , }
hi link rubyClass Keyword
hi link rubyModule Keyword
hi link rubyKeyword Keyword
hi link rubyOperator Operator
hi link rubyIdentifier Identifier
hi link rubyInstanceVariable Identifier
hi link rubyGlobalVariable Identifier
hi link rubyClassVariable Identifier
hi link rubyConstant Type
" Special for Java
" hi link javaClassDecl Type
hi link javaScopeDecl Identifier
hi link javaCommentTitle javaDocSeeTag
hi link javaDocTags javaDocSeeTag
hi link javaDocParam javaDocSeeTag
hi link javaDocSeeTagParam javaDocSeeTag
hi javaDocSeeTag guifg=#CCCCCC guibg=NONE gui=NONE ctermfg=darkgray ctermbg=NONE cterm=NONE
hi javaDocSeeTag guifg=#CCCCCC guibg=NONE gui=NONE ctermfg=darkgray ctermbg=NONE cterm=NONE
"hi javaClassDecl guifg=#CCFFCC guibg=NONE gui=NONE ctermfg=white ctermbg=NONE cterm=NONE
" Special for XML
hi link xmlTag Keyword
hi link xmlTagName Conditional
hi link xmlEndTag Identifier
" Special for HTML
hi link htmlTag Keyword
hi link htmlTagName Conditional
hi link htmlEndTag Identifier
" Special for Javascript
hi link javaScriptNumber Number
" Special for Python
"hi link pythonEscape Keyword
" Special for CSharp
hi link csXmlTag Keyword
" Special for PHP
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment