Add colors.vim and split .vimrc into multiple files

This commit is contained in:
Donovan Glover 2017-12-25 18:07:46 -05:00
parent 47289b7fff
commit 9d977774fc
No known key found for this signature in database
GPG Key ID: 8FC5F7D90A5D8F4D
6 changed files with 486 additions and 207 deletions

287
dotfiles/.vim/colors.vim Normal file
View File

@ -0,0 +1,287 @@
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"
" New Start: A modern Arch workflow built with an emphasis on functionality.
" Copyright (C) 2017 Donovan Glover
"
" base16-vim: Base16 for Vim
" Copyright (C) 2012 Chris Kempson
" https://github.com/chriskempson/base16-vim
"
" This program is free software: you can redistribute it and/or modify
" it under the terms of the GNU General Public License as published by
" the Free Software Foundation, either version 3 of the License, or
" (at your option) any later version.
"
" This program is distributed in the hope that it will be useful,
" but WITHOUT ANY WARRANTY; without even the implied warranty of
" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
" GNU General Public License for more details.
"
" You should have received a copy of the GNU General Public License
" along with this program. If not, see <https://www.gnu.org/licenses/>.
"
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" This is a modified version of Chris Kempson's base16-vim that removes a lot of
" the settings you don't need when using your terminal's colors as the color scheme.
" Main colors
let s:cterm00 = "00"
let s:cterm03 = "08"
let s:cterm05 = "07"
let s:cterm07 = "15"
let s:cterm08 = "01"
let s:cterm0A = "03"
let s:cterm0B = "02"
let s:cterm0C = "06"
let s:cterm0D = "04"
let s:cterm0E = "05"
" Extra colors
let s:cterm01 = "18" " 10 without 256 colors
let s:cterm02 = "19" " 11
let s:cterm04 = "20" " 12
let s:cterm06 = "21" " 13
let s:cterm09 = "16" " 09
let s:cterm0F = "17" " 14
" Highlighting function
fun <sid>hi(group, ctermfg, ctermbg, attr)
if a:ctermfg != ""
exec "hi " . a:group . " ctermfg=" . a:ctermfg
endif
if a:ctermbg != ""
exec "hi " . a:group . " ctermbg=" . a:ctermbg
endif
if a:attr != ""
exec "hi " . a:group . " gui=" . a:attr . " cterm=" . a:attr
endif
endfun
" Vim editor colors
call <sid>hi("Normal", s:cterm05, s:cterm00, "")
call <sid>hi("Bold", "", "", "bold")
call <sid>hi("Debug", s:cterm08, "", "")
call <sid>hi("Directory", s:cterm0D, "", "")
call <sid>hi("Error", s:cterm00, s:cterm08, "")
call <sid>hi("ErrorMsg", s:cterm08, s:cterm00, "")
call <sid>hi("Exception", s:cterm08, "", "")
call <sid>hi("FoldColumn", s:cterm0C, s:cterm01, "")
call <sid>hi("Folded", s:cterm03, s:cterm01, "")
call <sid>hi("IncSearch", s:cterm01, s:cterm09, "none")
call <sid>hi("Italic", "", "", "none")
call <sid>hi("Macro", s:cterm08, "", "")
call <sid>hi("MatchParen", "", s:cterm03, "")
call <sid>hi("ModeMsg", s:cterm0B, "", "")
call <sid>hi("MoreMsg", s:cterm0B, "", "")
call <sid>hi("Question", s:cterm0D, "", "")
call <sid>hi("Search", s:cterm03, s:cterm0A, "")
call <sid>hi("Substitute", s:cterm03, s:cterm0A, "none")
call <sid>hi("SpecialKey", s:cterm03, "", "")
call <sid>hi("TooLong", s:cterm08, "", "")
call <sid>hi("Underlined", s:cterm08, "", "")
call <sid>hi("Visual", "", s:cterm02, "")
call <sid>hi("VisualNOS", s:cterm08, "", "")
call <sid>hi("WarningMsg", s:cterm08, "", "")
call <sid>hi("WildMenu", s:cterm08, "", "")
call <sid>hi("Title", s:cterm0D, "", "none")
call <sid>hi("Conceal", s:cterm0D, s:cterm00, "")
call <sid>hi("Cursor", s:cterm00, s:cterm05, "")
call <sid>hi("NonText", s:cterm03, "", "")
call <sid>hi("LineNr", s:cterm03, s:cterm01, "")
call <sid>hi("SignColumn", s:cterm03, s:cterm01, "")
call <sid>hi("StatusLine", s:cterm04, s:cterm02, "none")
call <sid>hi("StatusLineNC", s:cterm03, s:cterm01, "none")
call <sid>hi("VertSplit", s:cterm02, s:cterm02, "none")
call <sid>hi("ColorColumn", "", s:cterm01, "none")
call <sid>hi("CursorColumn", "", s:cterm01, "none")
call <sid>hi("CursorLine", "", s:cterm01, "none")
call <sid>hi("CursorLineNr", s:cterm04, s:cterm01, "")
call <sid>hi("QuickFixLine", "", s:cterm01, "none")
call <sid>hi("PMenu", s:cterm05, s:cterm01, "none")
call <sid>hi("PMenuSel", s:cterm01, s:cterm05, "")
call <sid>hi("TabLine", s:cterm03, s:cterm01, "none")
call <sid>hi("TabLineFill", s:cterm03, s:cterm01, "none")
call <sid>hi("TabLineSel", s:cterm0B, s:cterm01, "none")
" Standard syntax highlighting
call <sid>hi("Boolean", s:cterm09, "", "")
call <sid>hi("Character", s:cterm08, "", "")
call <sid>hi("Comment", s:cterm03, "", "")
call <sid>hi("Conditional", s:cterm0E, "", "")
call <sid>hi("Constant", s:cterm09, "", "")
call <sid>hi("Define", s:cterm0E, "", "none")
call <sid>hi("Delimiter", s:cterm0F, "", "")
call <sid>hi("Float", s:cterm09, "", "")
call <sid>hi("Function", s:cterm0D, "", "")
call <sid>hi("Identifier", s:cterm08, "", "none")
call <sid>hi("Include", s:cterm0D, "", "")
call <sid>hi("Keyword", s:cterm0E, "", "")
call <sid>hi("Label", s:cterm0A, "", "")
call <sid>hi("Number", s:cterm09, "", "")
call <sid>hi("Operator", s:cterm05, "", "none")
call <sid>hi("PreProc", s:cterm0A, "", "")
call <sid>hi("Repeat", s:cterm0A, "", "")
call <sid>hi("Special", s:cterm0C, "", "")
call <sid>hi("SpecialChar", s:cterm0F, "", "")
call <sid>hi("Statement", s:cterm08, "", "")
call <sid>hi("StorageClass", s:cterm0A, "", "")
call <sid>hi("String", s:cterm0B, "", "")
call <sid>hi("Structure", s:cterm0E, "", "")
call <sid>hi("Tag", s:cterm0A, "", "")
call <sid>hi("Todo", s:cterm0A, s:cterm01, "")
call <sid>hi("Type", s:cterm0A, "", "none")
call <sid>hi("Typedef", s:cterm0A, "", "")
" C highlighting
call <sid>hi("cOperator", s:cterm0C, "", "")
call <sid>hi("cPreCondit", s:cterm0E, "", "")
" C# highlighting
call <sid>hi("csClass", s:cterm0A, "", "")
call <sid>hi("csAttribute", s:cterm0A, "", "")
call <sid>hi("csModifier", s:cterm0E, "", "")
call <sid>hi("csType", s:cterm08, "", "")
call <sid>hi("csUnspecifiedStatement", s:cterm0D, "", "")
call <sid>hi("csContextualStatement", s:cterm0E, "", "")
call <sid>hi("csNewDecleration", s:cterm08, "", "")
" CSS highlighting
call <sid>hi("cssBraces", s:cterm05, "", "")
call <sid>hi("cssClassName", s:cterm0E, "", "")
call <sid>hi("cssColor", s:cterm0C, "", "")
" Diff highlighting
call <sid>hi("DiffAdd", s:cterm0B, s:cterm01, "")
call <sid>hi("DiffChange", s:cterm03, s:cterm01, "")
call <sid>hi("DiffDelete", s:cterm08, s:cterm01, "")
call <sid>hi("DiffText", s:cterm0D, s:cterm01, "")
call <sid>hi("DiffAdded", s:cterm0B, s:cterm00, "")
call <sid>hi("DiffFile", s:cterm08, s:cterm00, "")
call <sid>hi("DiffNewFile", s:cterm0B, s:cterm00, "")
call <sid>hi("DiffLine", s:cterm0D, s:cterm00, "")
call <sid>hi("DiffRemoved", s:cterm08, s:cterm00, "")
" Git highlighting
call <sid>hi("gitcommitOverflow", s:cterm08, "", "")
call <sid>hi("gitcommitSummary", s:cterm0B, "", "")
call <sid>hi("gitcommitComment", s:cterm03, "", "")
call <sid>hi("gitcommitUntracked", s:cterm03, "", "")
call <sid>hi("gitcommitDiscarded", s:cterm03, "", "")
call <sid>hi("gitcommitSelected", s:cterm03, "", "")
call <sid>hi("gitcommitHeader", s:cterm0E, "", "")
call <sid>hi("gitcommitSelectedType", s:cterm0D, "", "")
call <sid>hi("gitcommitUnmergedType", s:cterm0D, "", "")
call <sid>hi("gitcommitDiscardedType", s:cterm0D, "", "")
call <sid>hi("gitcommitBranch", s:cterm09, "", "bold")
call <sid>hi("gitcommitUntrackedFile", s:cterm0A, "", "")
call <sid>hi("gitcommitUnmergedFile", s:cterm08, "", "bold")
call <sid>hi("gitcommitDiscardedFile", s:cterm08, "", "bold")
call <sid>hi("gitcommitSelectedFile", s:cterm0B, "", "bold")
" GitGutter highlighting
call <sid>hi("GitGutterAdd", s:cterm0B, s:cterm01, "")
call <sid>hi("GitGutterChange", s:cterm0D, s:cterm01, "")
call <sid>hi("GitGutterDelete", s:cterm08, s:cterm01, "")
call <sid>hi("GitGutterChangeDelete", s:cterm0E, s:cterm01, "")
" HTML highlighting
call <sid>hi("htmlBold", s:cterm0A, "", "")
call <sid>hi("htmlItalic", s:cterm0E, "", "")
call <sid>hi("htmlEndTag", s:cterm05, "", "")
call <sid>hi("htmlTag", s:cterm05, "", "")
" JavaScript highlighting
call <sid>hi("javaScript", s:cterm05, "", "")
call <sid>hi("javaScriptBraces", s:cterm05, "", "")
call <sid>hi("javaScriptNumber", s:cterm09, "", "")
" pangloss/vim-javascript highlighting
call <sid>hi("jsOperator", s:cterm0D, "", "")
call <sid>hi("jsStatement", s:cterm0E, "", "")
call <sid>hi("jsReturn", s:cterm0E, "", "")
call <sid>hi("jsThis", s:cterm08, "", "")
call <sid>hi("jsClassDefinition", s:cterm0A, "", "")
call <sid>hi("jsFunction", s:cterm0E, "", "")
call <sid>hi("jsFuncName", s:cterm0D, "", "")
call <sid>hi("jsFuncCall", s:cterm0D, "", "")
call <sid>hi("jsClassFuncName", s:cterm0D, "", "")
call <sid>hi("jsClassMethodType", s:cterm0E, "", "")
call <sid>hi("jsRegexpString", s:cterm0C, "", "")
call <sid>hi("jsGlobalObjects", s:cterm0A, "", "")
call <sid>hi("jsGlobalNodeObjects", s:cterm0A, "", "")
call <sid>hi("jsExceptions", s:cterm0A, "", "")
call <sid>hi("jsBuiltins", s:cterm0A, "", "")
" Mail highlighting
call <sid>hi("mailQuoted1", s:cterm0A, "", "")
call <sid>hi("mailQuoted2", s:cterm0B, "", "")
call <sid>hi("mailQuoted3", s:cterm0E, "", "")
call <sid>hi("mailQuoted4", s:cterm0C, "", "")
call <sid>hi("mailQuoted5", s:cterm0D, "", "")
call <sid>hi("mailQuoted6", s:cterm0A, "", "")
call <sid>hi("mailURL", s:cterm0D, "", "")
call <sid>hi("mailEmail", s:cterm0D, "", "")
" Markdown highlighting
call <sid>hi("markdownCode", s:cterm0B, "", "")
call <sid>hi("markdownError", s:cterm05, s:cterm00, "")
call <sid>hi("markdownCodeBlock", s:cterm0B, "", "")
call <sid>hi("markdownHeadingDelimiter", s:cterm0D, "", "")
" NERDTree highlighting
call <sid>hi("NERDTreeDirSlash", s:cterm0D, "", "")
call <sid>hi("NERDTreeExecFile", s:cterm05, "", "")
" PHP highlighting
call <sid>hi("phpMemberSelector", s:cterm05, "", "")
call <sid>hi("phpComparison", s:cterm05, "", "")
call <sid>hi("phpParent", s:cterm05, "", "")
" Python highlighting
call <sid>hi("pythonOperator", s:cterm0E, "", "")
call <sid>hi("pythonRepeat", s:cterm0E, "", "")
call <sid>hi("pythonInclude", s:cterm0E, "", "")
call <sid>hi("pythonStatement", s:cterm0E, "", "")
" Ruby highlighting
call <sid>hi("rubyAttribute", s:cterm0D, "", "")
call <sid>hi("rubyConstant", s:cterm0A, "", "")
call <sid>hi("rubyInterpolationDelimiter", s:cterm0F, "", "")
call <sid>hi("rubyRegexp", s:cterm0C, "", "")
call <sid>hi("rubySymbol", s:cterm0B, "", "")
call <sid>hi("rubyStringDelimiter", s:cterm0B, "", "")
" SASS highlighting
call <sid>hi("sassidChar", s:cterm08, "", "")
call <sid>hi("sassClassChar", s:cterm09, "", "")
call <sid>hi("sassInclude", s:cterm0E, "", "")
call <sid>hi("sassMixing", s:cterm0E, "", "")
call <sid>hi("sassMixinName", s:cterm0D, "", "")
" Signify highlighting
call <sid>hi("SignifySignAdd", s:cterm0B, s:cterm01, "")
call <sid>hi("SignifySignChange", s:cterm0D, s:cterm01, "")
call <sid>hi("SignifySignDelete", s:cterm08, s:cterm01, "")
" Spelling highlighting
call <sid>hi("SpellBad", "", s:cterm00, "undercurl")
call <sid>hi("SpellLocal", "", s:cterm00, "undercurl")
call <sid>hi("SpellCap", "", s:cterm00, "undercurl")
call <sid>hi("SpellRare", "", s:cterm00, "undercurl")
" Startify highlighting
call <sid>hi("StartifyBracket", s:cterm03, "", "")
call <sid>hi("StartifyFile", s:cterm07, "", "")
call <sid>hi("StartifyFooter", s:cterm03, "", "")
call <sid>hi("StartifyHeader", s:cterm0B, "", "")
call <sid>hi("StartifyNumber", s:cterm09, "", "")
call <sid>hi("StartifyPath", s:cterm03, "", "")
call <sid>hi("StartifySection", s:cterm0E, "", "")
call <sid>hi("StartifySelect", s:cterm0C, "", "")
call <sid>hi("StartifySlash", s:cterm03, "", "")
call <sid>hi("StartifySpecial", s:cterm03, "", "")
" Remove functions
delf <sid>hi
" Remove color variables
unlet s:cterm00 s:cterm01 s:cterm02 s:cterm03 s:cterm04 s:cterm05 s:cterm06 s:cterm07 s:cterm08 s:cterm09 s:cterm0A s:cterm0B s:cterm0C s:cterm0D s:cterm0E s:cterm0F

39
dotfiles/.vim/config.vim Normal file
View File

@ -0,0 +1,39 @@
filetype plugin indent on " Attempt to determine the file type of extensionless files
syntax enable " Turn syntax highlighting on
set nocompatible " Use vim defaults (i.e. ignore vi compatibility)
set backspace=indent,eol,start " Make the backspace key function as you would expect
set encoding=utf-8 " Always show files as utf-8
set fileencoding=utf-8 " Ensure that we always save files as utf-8
set autoindent " Automatically indent new lines
set ignorecase " By default use case-insensitive search (combine with smartcase)
set smartcase " Make search case-sensitive when using capital letters
set showcmd " Always show the current keybinding being executed
set spell " Enable spell check by default
set incsearch " Automatically move to text as you search for it
set wildmenu " Show a menu of the different options when you tab in command mode
set display+=lastline " Show as much of a long line as possible
set laststatus=0 " Disable the status line (removes filename and increases working space)
set history=100 " Only keep the last 100 commands
set tabpagemax=50 " Set the maximum number of tabs to be opened in any window to 50
set viminfo^=! " Use viminfo to store workspace and other data automatically
set sessionoptions-=options " When you explicitly save a workspace, save the entire environment
set t_Co=256 " Tell vim that we want to use 256 colors
set scrolloff=1 " The minimal number of rows to show when scrolling up/down
set sidescrolloff=5 " The minimal number of columns to show when scrolling left/right
set undofile " Keep track of undos even after you close a file
set undodir=~/.vim/undo " Save the undo history here (not that the directory must exist)
set undolevels=1000 " We can undo this many times
set undoreload=10000 " The maximum number of lines to keep in the undo file
set tabstop=4 " Show a tab character as 4 spaces
set softtabstop=0 " Edit soft tabs as if they're regular spaces
set shiftwidth=4 " Make autoindent appear as 4 spaces
set expandtab " When using <Tab>, replace the tab character with 4 spaces
set smarttab " Always indent based on column number to align things easier

55
dotfiles/.vim/ctags.vim Normal file
View File

@ -0,0 +1,55 @@
" Add elixir support to ctags
let g:tagbar_type_elixir = {
\ 'ctagstype' : 'elixir',
\ 'kinds' : [
\ 'f:functions',
\ 'functions:functions',
\ 'c:callbacks',
\ 'd:delegates',
\ 'e:exceptions',
\ 'i:implementations',
\ 'a:macros',
\ 'o:operators',
\ 'm:modules',
\ 'p:protocols',
\ 'r:records',
\ 't:tests'
\ ]
\ }
" Add rust support to ctags
let g:tagbar_type_rust = {
\ 'ctagstype' : 'rust',
\ 'kinds' : [
\'T:types,type definitions',
\'f:functions,function definitions',
\'g:enum,enumeration names',
\'s:structure names',
\'m:modules,module names',
\'c:consts,static constants',
\'t:traits',
\'i:impls,trait implementations',
\]
\}
" Add crystal support to ctags
let g:tagbar_type_crystal = {
\'ctagstype': 'crystal',
\'ctagsbin': 'crystalctags',
\'kinds': [
\'c:classes',
\'m:modules',
\'d:defs',
\'x:macros',
\'l:libs',
\'s:sruct or unions',
\'f:fun'
\],
\'sro': '.',
\'kind2scope': {
\'c': 'namespace',
\'m': 'namespace',
\'l': 'namespace',
\'s': 'namespace'
\},
\}

View File

@ -0,0 +1,63 @@
" Change the global leader to the space bar
let mapleader = ' '
" Easily switch between buffers
nnoremap <silent> gn :bn<CR>
nnoremap <silent> gp :bp<CR>
nnoremap <silent> gd :bd<CR>
" ================== Top row
"nnoremap <silent> <leader><TAB>
nnoremap <silent> <leader>q :Files<CR>
nnoremap <silent> <leader>w :Commits<CR>
nnoremap <silent> <leader>e :set nu!<CR>
nnoremap <silent> <leader>r :call matchadd('OverLength', '\%101v', 100)<CR>
nnoremap <silent> <leader>t :OverCommandLine<CR>%s/
"nnoremap <silent> <leader>y
nnoremap <silent> <leader>u <C-w>w
nnoremap <silent> <leader>i <C-w><C-p>
nnoremap <silent> <leader>o <C-d>
nnoremap <silent> <leader>p <C-u>
" Easily show all git diffs
nnoremap <silent> <leader>[ :GFiles?<CR>
" Easily show all git files
nnoremap <silent> <leader>] :GFiles<CR>
" Easily go through all the commits for a specific file
nnoremap <silent> <leader>\ :BCommits<CR>
" ================== Middle row
nnoremap <silent> <leader>a :NERDTreeToggle<CR>
"nnoremap <silent> <leader>s
nnoremap <silent> <leader>d :TagbarToggle<CR>
nnoremap <silent> <leader>f :VimFiler<CR>
nnoremap <silent> <leader>g :set hlsearch!<CR>
nnoremap <silent> <leader>h :Buffers<CR>
" Easily jump between lines in all open files
nnoremap <silent> <leader>j :Lines<CR>
" Easily jump between lines in the same file
nnoremap <silent> <leader>k :BLines<CR>
" Easily search for any line in all files in the project
nnoremap <silent> <leader>l :Ag<CR>
" Easily open new files in horizontal and vertical splits
nnoremap <silent> <leader>; :split<CR> <C-w>w :Files<CR>
nnoremap <silent> <leader>' :vsplit<CR> <C-w>w :Files<CR>
" ================== Bottom row
" Note that I personally don't use <space> + z/x/c/n/m/,/.
nnoremap <silent> <leader>v :Ack! "\b<cword>\b"<CR>
"nnoremap <silent> <leader>b
nnoremap <silent> <leader>n o<Esc>
nnoremap <silent> <leader>m O<Esc>
" Bind the right beautify function based on what file is open
autocmd FileType javascript map <leader>b :call JsBeautify()<CR>
autocmd FileType json map <leader>b :call JsonBeautify()<CR>
autocmd FileType jsx map <leader>b :call JsxBeautify()<CR>
autocmd FileType html map <leader>b :call HtmlBeautify()<CR>
autocmd FileType css map <leader>b :call CSSBeautify()<CR>
" Easily enter 'zen mode' with Goyo and Pencil
" We have to explicitly set vertsplit again since Goyo resets it for some reason
nnoremap <silent> <leader>2 :PencilSoft<CR>:Goyo<CR>:hi vertsplit ctermfg=8 ctermbg=none<CR>
nnoremap <silent> <leader>3 :mksession! ~/.vim_session<CR>
nnoremap <silent> <leader>4 :source ~/.vim_session<CR>
nnoremap <silent> <leader>8 :15winc -<CR>
nnoremap <silent> <leader>9 :15winc +<CR>
nnoremap <silent> <leader>0 :winc =<CR>

37
dotfiles/.vim/plugins.vim Normal file
View File

@ -0,0 +1,37 @@
call plug#begin('~/.vim/plugged') " Use vim-plug as our package manager of choice
Plug 'airblade/vim-gitgutter'
Plug 'osyo-manga/vim-over' " Automatically highlight find and replace
Plug 'jiangmiao/auto-pairs' " Close brackets and other pairs automatically
Plug 'sukima/xmledit' " Automatically close tags when writing html
Plug 'w0rp/ale' " Automatically check language syntax for errors
Plug 'maksimr/vim-jsbeautify' " Make it easier to work with foreign code
Plug 'lervag/vimtex' " Make editing LaTeX a breeze
Plug 'dbeniamine/todo.txt-vim' " Easily manage any part of your todo.txt
Plug 'Kjwon15/vim-transparent' " Add transparency by default for all color schemes
Plug 'elixir-editors/vim-elixir' " Add syntax highlighting and autoindent for Elixir
Plug 'tpope/vim-fugitive' " Add fugitive.vim, enabling us to use git in vim
Plug 'junegunn/fzf' " Add fuzzy finding to easily move between files
Plug 'junegunn/fzf.vim' " Add the vim functionality of fuzzy finding
Plug 'rhysd/vim-crystal' " Add support for the crystal language
Plug 'scrooloose/nerdtree' " Add a file browser to vim
Plug 'majutsushi/tagbar' " Add tagbar to show functions on the side
Plug 'lvht/tagbar-markdown' " Add support for markdown to tagbar
Plug 'rust-lang/rust.vim' " Add rust support to vim
Plug 'jamessan/vim-gnupg' " Easily use GPG encryption inside of vim
Plug 'reedes/vim-pencil' " Use vim as a tool for writing
Plug 'mileszs/ack.vim' " Testing ack.vim with ag
Plug 'tpope/vim-endwise' " Automatically add end
Plug 'junegunn/goyo.vim' " Distraction-free writing
Plug 'Yggdroot/indentLine' " Show indentation levels
Plug 'Shougo/unite.vim' " Required by vimfiler
Plug 'Shougo/vimfiler.vim' " Yet another file explorer
Plug 'mattn/emmet-vim' " Add emmet support
Plug 'sgur/vim-editorconfig' " Add editorconfig support
call plug#end() " Start the plugins

View File

@ -18,94 +18,14 @@
" "
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" =================================== Plugins =================================== source ~/.vim/plugins.vim
source ~/.vim/config.vim
call plug#begin('~/.vim/plugged') " Use vim-plug as our package manager of choice source ~/.vim/colors.vim
Plug 'airblade/vim-gitgutter' source ~/.vim/ctags.vim
Plug 'osyo-manga/vim-over' " Automatically highlight find and replace source ~/.vim/keybindings.vim
Plug 'jiangmiao/auto-pairs' " Close brackets and other pairs automatically
Plug 'sukima/xmledit' " Automatically close tags when writing html
Plug 'w0rp/ale' " Automatically check language syntax for errors
Plug 'maksimr/vim-jsbeautify' " Make it easier to work with foreign code
Plug 'lervag/vimtex' " Make editing LaTeX a breeze
Plug 'dbeniamine/todo.txt-vim' " Easily manage any part of your todo.txt
Plug 'Kjwon15/vim-transparent' " Add transparency by default for all color schemes
Plug 'elixir-editors/vim-elixir' " Add syntax highlighting and autoindent for Elixir
Plug 'tpope/vim-fugitive' " Add fugitive.vim, enabling us to use git in vim
Plug 'junegunn/fzf' " Add fuzzy finding to easily move between files
Plug 'junegunn/fzf.vim' " Add the vim functionality of fuzzy finding
Plug 'rhysd/vim-crystal' " Add support for the crystal language
Plug 'scrooloose/nerdtree' " Add a file browser to vim
Plug 'majutsushi/tagbar' " Add tagbar to show functions on the side
Plug 'lvht/tagbar-markdown' " Add support for markdown to tagbar
Plug 'rust-lang/rust.vim' " Add rust support to vim
Plug 'jamessan/vim-gnupg' " Easily use GPG encryption inside of vim
Plug 'reedes/vim-pencil' " Use vim as a tool for writing
Plug 'mileszs/ack.vim' " Testing ack.vim with ag
Plug 'tpope/vim-endwise' " Automatically add end
Plug 'junegunn/goyo.vim' " Distraction-free writing
Plug 'Yggdroot/indentLine' " Show indentation levels
Plug 'Shougo/unite.vim' " Required by vimfiler
Plug 'Shougo/vimfiler.vim' " Yet another file explorer
Plug 'mattn/emmet-vim' " Add emmet support
Plug 'sgur/vim-editorconfig' " Add editorconfig support
call plug#end() " Start the plugins
" =================================== Configuration ===================================
filetype plugin indent on " Attempt to determine the file type of extensionless files
syntax enable " Turn syntax highlighting on
set nocompatible " Use vim defaults (i.e. ignore vi compatibility)
set backspace=indent,eol,start " Make the backspace key function as you would expect
set encoding=utf-8 " Always show files as utf-8
set fileencoding=utf-8 " Ensure that we always save files as utf-8
set autoindent " Automatically indent new lines
set ignorecase " By default use case-insensitive search (combine with smartcase)
set smartcase " Make search case-sensitive when using capital letters
set showcmd " Always show the current keybinding being executed
set spell " Enable spell check by default
set incsearch " Automatically move to text as you search for it
set wildmenu " Show a menu of the different options when you tab in command mode
set display+=lastline " Show as much of a long line as possible
set laststatus=0 " Disable the status line (removes filename and increases working space)
set history=100 " Only keep the last 100 commands
set tabpagemax=50 " Set the maximum number of tabs to be opened in any window to 50
set viminfo^=! " Use viminfo to store workspace and other data automatically
set sessionoptions-=options " When you explicitly save a workspace, save the entire environment
set t_Co=256 " Tell vim that we want to use 256 colors
set scrolloff=1 " The minimal number of rows to show when scrolling up/down
set sidescrolloff=5 " The minimal number of columns to show when scrolling left/right
set undofile " Keep track of undos even after you close a file
set undodir=~/.vim/undo " Save the undo history here (not that the directory must exist)
set undolevels=1000 " We can undo this many times
set undoreload=10000 " The maximum number of lines to keep in the undo file
set tabstop=4 " Show a tab character as 4 spaces
set softtabstop=0 " Edit soft tabs as if they're regular spaces
set shiftwidth=4 " Make autoindent appear as 4 spaces
set expandtab " When using <Tab>, replace the tab character with 4 spaces
set smarttab " Always indent based on column number to align things easier
" =================================== Plugin-Specific =================================== " =================================== Plugin-Specific ===================================
let base16colorspace=256 " Tell base16 to use 256 colors
" source ~/.vimrc_background " Load the same base16 theme used in the shell
source ~/Home/Contributing/base16-vim/colors/base16-atelier-cave-light.vim
let g:ale_lint_on_text_changed = 'never' " Do not lint while typing let g:ale_lint_on_text_changed = 'never' " Do not lint while typing
let g:ale_lint_on_insert_leave = 1 " Only lint after leaving insert mode let g:ale_lint_on_insert_leave = 1 " Only lint after leaving insert mode
let g:ackprg = 'ag --vimgrep' " Use ag instead of ack / grep let g:ackprg = 'ag --vimgrep' " Use ag instead of ack / grep
@ -160,11 +80,6 @@ nnoremap <localleader>e <plug>(vimtex-cmd-toggle-star)
inoremap ]] <plug>(vimtex-delim-close) inoremap ]] <plug>(vimtex-delim-close)
" =================================== Custom Keybindings ===================================
" Change the global leader to the space bar
let mapleader = ' '
" Use incsearch and tab / shift+tab to go through the results " Use incsearch and tab / shift+tab to go through the results
cno <expr> <tab> getcmdtype() =~ '[?/]' ? '<c-g>' : feedkeys('<tab>', 'int')[1] cno <expr> <tab> getcmdtype() =~ '[?/]' ? '<c-g>' : feedkeys('<tab>', 'int')[1]
cno <expr> <s-tab> getcmdtype() =~ '[?/]' ? '<c-t>' : feedkeys('<s-tab>', 'int')[1] cno <expr> <s-tab> getcmdtype() =~ '[?/]' ? '<c-t>' : feedkeys('<s-tab>', 'int')[1]
@ -178,62 +93,6 @@ highlight OverLength ctermbg=red ctermfg=white guibg=#592929
" Automatically close the file viewer when it's the only thing left " Automatically close the file viewer when it's the only thing left
autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTree") && b:NERDTree.isTabTree()) | q | endif autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTree") && b:NERDTree.isTabTree()) | q | endif
" Add elixir support to ctags
let g:tagbar_type_elixir = {
\ 'ctagstype' : 'elixir',
\ 'kinds' : [
\ 'f:functions',
\ 'functions:functions',
\ 'c:callbacks',
\ 'd:delegates',
\ 'e:exceptions',
\ 'i:implementations',
\ 'a:macros',
\ 'o:operators',
\ 'm:modules',
\ 'p:protocols',
\ 'r:records',
\ 't:tests'
\ ]
\ }
" Add rust support to ctags
let g:tagbar_type_rust = {
\ 'ctagstype' : 'rust',
\ 'kinds' : [
\'T:types,type definitions',
\'f:functions,function definitions',
\'g:enum,enumeration names',
\'s:structure names',
\'m:modules,module names',
\'c:consts,static constants',
\'t:traits',
\'i:impls,trait implementations',
\]
\}
" Add crystal support to ctags
let g:tagbar_type_crystal = {
\'ctagstype': 'crystal',
\'ctagsbin': 'crystalctags',
\'kinds': [
\'c:classes',
\'m:modules',
\'d:defs',
\'x:macros',
\'l:libs',
\'s:sruct or unions',
\'f:fun'
\],
\'sro': '.',
\'kind2scope': {
\'c': 'namespace',
\'m': 'namespace',
\'l': 'namespace',
\'s': 'namespace'
\},
\}
" Use w!! to force write a file as sudo " Use w!! to force write a file as sudo
" cmap w!! w !sudo tee > /dev/null % " cmap w!! w !sudo tee > /dev/null %
@ -275,64 +134,3 @@ match Function /@requires/
" Use syntax highlighting for .ecr files " Use syntax highlighting for .ecr files
autocmd BufNewFile,BufRead *.ecr set syntax=html autocmd BufNewFile,BufRead *.ecr set syntax=html
" Easily switch between buffers
nnoremap <silent> gn :bn<CR>
nnoremap <silent> gp :bp<CR>
nnoremap <silent> gd :bd<CR>
" ================== Top row
"nnoremap <silent> <leader><TAB>
nnoremap <silent> <leader>q :Files<CR>
nnoremap <silent> <leader>w :Commits<CR>
nnoremap <silent> <leader>e :set nu!<CR>
nnoremap <silent> <leader>r :call matchadd('OverLength', '\%101v', 100)<CR>
nnoremap <silent> <leader>t :OverCommandLine<CR>%s/
"nnoremap <silent> <leader>y
nnoremap <silent> <leader>u <C-w>w
nnoremap <silent> <leader>i <C-w><C-p>
nnoremap <silent> <leader>o <C-d>
nnoremap <silent> <leader>p <C-u>
" Easily show all git diffs
nnoremap <silent> <leader>[ :GFiles?<CR>
" Easily show all git files
nnoremap <silent> <leader>] :GFiles<CR>
" Easily go through all the commits for a specific file
nnoremap <silent> <leader>\ :BCommits<CR>
" ================== Middle row
nnoremap <silent> <leader>a :NERDTreeToggle<CR>
"nnoremap <silent> <leader>s
nnoremap <silent> <leader>d :TagbarToggle<CR>
nnoremap <silent> <leader>f :VimFiler<CR>
nnoremap <silent> <leader>g :set hlsearch!<CR>
nnoremap <silent> <leader>h :Buffers<CR>
" Easily jump between lines in all open files
nnoremap <silent> <leader>j :Lines<CR>
" Easily jump between lines in the same file
nnoremap <silent> <leader>k :BLines<CR>
" Easily search for any line in all files in the project
nnoremap <silent> <leader>l :Ag<CR>
" Easily open new files in horizontal and vertical splits
nnoremap <silent> <leader>; :split<CR> <C-w>w :Files<CR>
nnoremap <silent> <leader>' :vsplit<CR> <C-w>w :Files<CR>
" ================== Bottom row
" Note that I personally don't use <space> + z/x/c/n/m/,/.
nnoremap <silent> <leader>v :Ack! "\b<cword>\b"<CR>
"nnoremap <silent> <leader>b
nnoremap <silent> <leader>n o<Esc>
nnoremap <silent> <leader>m O<Esc>
" Bind the right beautify function based on what file is open
autocmd FileType javascript map <leader>b :call JsBeautify()<CR>
autocmd FileType json map <leader>b :call JsonBeautify()<CR>
autocmd FileType jsx map <leader>b :call JsxBeautify()<CR>
autocmd FileType html map <leader>b :call HtmlBeautify()<CR>
autocmd FileType css map <leader>b :call CSSBeautify()<CR>
" Easily enter 'zen mode' with Goyo and Pencil
" We have to explicitly set vertsplit again since Goyo resets it for some reason
nnoremap <silent> <leader>2 :PencilSoft<CR>:Goyo<CR>:hi vertsplit ctermfg=8 ctermbg=none<CR>
nnoremap <silent> <leader>3 :mksession! ~/.vim_session<CR>
nnoremap <silent> <leader>4 :source ~/.vim_session<CR>
nnoremap <silent> <leader>8 :15winc -<CR>
nnoremap <silent> <leader>9 :15winc +<CR>
nnoremap <silent> <leader>0 :winc =<CR>