" ---------------------------------------------------------------------- " This is basically a copy of the starting vimrc, just to make sure I " have all the cool things enabled " ---------------------------------------------------------------------- set encoding=utf-8 " Use Vim settings, rather then Vi settings (much better!). " This must be first, because it changes other options as a side effect. set nocompatible " allow backspacing over everything in insert mode set backspace=indent,eol,start " Don't use Ex mode, use Q for formatting map Q gq " Map Y to do the same (well, almost) as the D command map Y y$ " This is an alternative that also works in block mode, but the deleted " text is lost and it only works for putting the current register. " Switch syntax highlighting on, when the terminal has colors " Also switch on highlighting the last used search pattern. if &t_Co > 2 || has("gui_running") syntax on set hlsearch endif " ---------------------------------------------------------------------- " Those are my settings " ---------------------------------------------------------------------- set nocompatible " force no compatibility with standard "vi" set tabstop=4 " tabs are displayed as 4 spaces set shiftwidth=4 " by default, when auto-identing, add 4 spaces (or 1 tabstop) set foldmethod=marker " fold on markers set foldlevel=3 " number of folds to open automatically set scrolloff=1 " always show one line around the cursor set laststatus=2 " always show the status bar ('cause I like to see the line and column, always) set showtabline=2 " always show the tabline set showmatch " show matching bracket set noerrorbells " no error bells set autowrite " write the file when switching between files or something set nowrap " do not wrap long lines set nobackup " do not keep a backup file, use versions instead set history=50 " keep 50 lines of command line history set ruler " show the cursor position all the time set showcmd " display incomplete commands set incsearch " do incremental searching set formatoptions=tcq " wrap with textwidth, wrap comments, insert commend leader (twice), format comments set smartindent " smart identation set number " show line numbers set wim=longest,list " file auto-completion set background=dark " to follow most of the colorschemes I use set vb t_vb= " convert bells to visual bells and do nothing as visual bell set t_Co=256 " 256 color terminal set modeline " Enable modelines " set undofile " saves undo changes in a separate file, so we can undo anytime set lcs=tab:¦\ " uses a special char at the start of a tab character, uses spaces after that set nolist " ... but don't display them by default set path+=** " glob the search path for files (helps :find) set wildmenu " display all found files let mapleader=" " " use space to start user-defined (in plugins) functions syntax sync minlines=1500 " increases the number of lines to find the proper syntax " ---------------------------------------------------------------------- " Vundle stuff starts here " ---------------------------------------------------------------------- filetype off set rtp+=~/.vim/bundle/Vundle.vim call vundle#begin() " ---------------------------------------------------------------------- " Bundles " ---------------------------------------------------------------------- " Vundle itself! Plugin 'VundleVim/Vundle.vim' " Magic "every updated syntax" plugin Plugin 'sheerun/vim-polyglot' " Lint files on save " Plugin 'scrooloose/syntastic' Plugin 'w0rp/ale' " status line Plugin 'itchyny/lightline.vim' " git support Plugin 'tpope/vim-fugitive' " comment code with keys Plugin 'tpope/vim-commentary' " align things Plugin 'godlygeek/tabular' " close pairs " Plugin 'jiangmiao/auto-pairs' " snippets Plugin 'SirVer/ultisnips' Plugin 'honza/vim-snippets' " fuzzy file open " Plugin 'kien/ctrlp.vim' " Plugin 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' } " Plugin 'junegunn/fzf.vim' Plugin 'Yggdroot/LeaderF' " select multiple strings at the same time Plugin 'terryma/vim-multiple-cursors' " colorschemes Plugin 'croaker/mustang-vim' Plugin 'crusoexia/vim-monokai' Plugin 'arcticicestudio/nord-vim' " Improved syntax files Plugin 'Glench/Vim-Jinja2-Syntax' Plugin 'fmoralesc/vim-pinpoint' Plugin 'kchmck/vim-coffee-script' Plugin 'mattn/emmet-vim' " Automatically detect and change the display of CSS colors Plugin 'gorodinskiy/vim-coloresque' " Project tree " Plugin 'scrooloose/nerdtree' " Plugin 'jistr/vim-nerdtree-tabs' Plugin 'tpope/vim-vinegar' " Editor configuration Plugin 'editorconfig/editorconfig-vim' " Selection Plugin 'terryma/vim-expand-region' " Unhighlight stuff when moving Plugin 'romainl/vim-cool' " Better "around stuff" Plugin 'tpope/vim-surround' " Tiling split manager Plugin 'zhamlin/tiler.vim' call vundle#end() " done with plugins " color mustang " looks awesome on gvim, looks alright in vim if you have 256 color support " color monokai color nord " Enable file type detection. " Use the default filetype settings, so that mail gets 'tw' set to 72, " 'cindent' is on in C files, etc. " Also load indent files, to automatically do language-dependent indenting. filetype plugin indent on " Put these in an autocmd group, so that we can delete them easily. augroup vimrcEx au! " For all text files set 'textwidth' to 78 characters. autocmd FileType text setlocal textwidth=78 " When editing a file, always jump to the last known cursor position. " Don't do it when the position is invalid or when inside an event handler " (happens when dropping a file on gvim). autocmd BufReadPost * \ if line("'\"") > 0 && line("'\"") <= line("$") | \ exe "normal g`\"" | \ endif augroup END " Files that should be ignored in most file operations set wildignore+=*/build/*,*.egginfo,*.pyc,*.mo,*/dist/*,*.class " ---------------------------------------------------------------------- " Auto-commands " ---------------------------------------------------------------------- " default python style " (use spaces instead of tabs (expandtab), uses 4 spaces for tabs (tabstop), " when auto-indenting, also use 4 spaces (shiftwidth), when deleting text, 4 " spaces are a tab (softtabstop) and break the line at column 78 (textwidth)) " also, remove all tailing spaces au FileType python setlocal expandtab tabstop=4 shiftwidth=4 softtabstop=4 textwidth=78 colorcolumn=79 " Default C/C++ style " show a column marker at column 100, break the line at line 100, use tabs " instead of sapces and display a "¦" for tabs (this way we can see the lines " that are not using real tabs) au FileType c setlocal colorcolumn=100 tw=100 noet list au FileType cpp setlocal colorcolumn=100 tw=100 noet list " Default ReStructured document style " reStructured files follow python closely, but use 3 tab stops instead of 4 au FileType rst setlocal expandtab tabstop=3 sw=3 sts=3 textwidth=78 " Default Jinja2/Django styles " These options reflect most of the same style as Python. au FileType htmldjango setlocal noet tabstop=4 shiftwidth=4 softtabstop=4 textwidth=0 au FileType jinja setlocal noet tabstop=4 shiftwidth=4 softtabstop=4 textwidth=0 " Default Smarty style " Smarty doesn't have a proper syntax (I think) so we enable autoidentation " for it to indent HTML properly. au FileType smarty setlocal ai " Default PHP style " PHP should break at column 79 (pretty much like Python). " We also enable a syntax option, which will colorize instance members in a " different way (so we know when a variable is an instance member or something " coming from outside). au FileType php setlocal textwidth=79 let php_smart_members=1 " Default Subversion style. " Simply break lines at column 70. au FileType svn setlocal tw=70 " Default Email style. " This is mostly used by Mutt. au FileType mail setlocal spell spelllang=en " Default JavaScript style " This mirrors Python, except we'll be using 2 spaces instead of 4. Also, " there is no hard-break, as JavaScript seems more prone to break in the wrong " place than Python. au FileType javascript setlocal expandtab tabstop=4 sw=4 sts=4 textwidth=0 " Default style for cofeescript files au FileType coffee setlocal noet ts=2 sw=2 sts=2 list " Default JSON styles " Every file with the extesion "json" should have the filetype "json"; " Use spaces instead of tabs and use 4 spaces for it. " Remove tailing spaces. " Also, in case we are using vim-json (through Polyglot), do not conceal any " characters (check elzr/vim-json on Github about this feature) let g:vim_json_syntax_conceal = 0 autocmd BufNewFile,BufRead *.json set filetype=json autocmd Filetype json set et ts=4 sts=4 " Vue files can be treated as HTML files just fine autocmd BufNewFile,BufRead *.vue set ft=html " Default Pinpoint style au BufNewFile,BufRead *.pin set filetype=pinpoint au FileType pinpoint setlocal colorcolumn=79 textwidth=78 " Default Yang style au FileType yang set et " Yaml; same as JavaScript au FileType yaml setlocal expandtab tabstop=2 sw=2 sts=2 textwidth=0 " For Java, we need to display tabs au FileType java setlocal noet list " On Markdown files, we want automatic breaks and spell checking au FileType markdown setlocal tw=78 spell spelllang=en_au wrap " ---------------------------------------------------------------------- " Remove tailing spaces " ---------------------------------------------------------------------- autocmd FileType c,cpp,python,yang,json,yaml,javascript,scala,java autocmd BufWritePre :%s/\s\+$//e " ---------------------------------------------------------------------- " mapings " ---------------------------------------------------------------------- " Easy switching between tabs (just use Alt+) if has('mac') map :tabn 1 map :tabn 2 map :tabn 3 map :tabn 4 map :tabn 5 map :tabn 6 map :tabn 7 map :tabn 8 map :tabn 9 map :tabn 10 imap :tabn 1a imap :tabn 2a imap :tabn 3a imap :tabn 4a imap :tabn 5a imap :tabn 6a imap :tabn 7a imap :tabn 8a imap :tabn 9a imap :tabn 10a else map :tabn 1 map :tabn 2 map :tabn 3 map :tabn 4 map :tabn 5 map :tabn 6 map :tabn 7 map :tabn 8 map :tabn 9 map :tabn 10 imap :tabn 1a imap :tabn 2a imap :tabn 3a imap :tabn 4a imap :tabn 5a imap :tabn 6a imap :tabn 7a imap :tabn 8a imap :tabn 9a imap :tabn 10a endif " Easy swtich between splits nnoremap nnoremap nnoremap nnoremap " Use ';' as ':' nnoremap ; : " ---------------------------------------------------------------------- " Autopair settings " ---------------------------------------------------------------------- let g:AutoPairsMapCR = 1 " ---------------------------------------------------------------------- " Airline configuration " ---------------------------------------------------------------------- let g:airline_powerline_fonts = 1 let g:airline_theme = 'understated' let g:airline#extensions#branch#enabled = 1 let g:airline#extensions#syntastic#enabled = 1 let g:airline#extensions#tabline#enabled = 1 let g:airline#extensions#tabline#show_buffers = 0 let g:airline#extensions#tabline#show_tab_type = 0 let g:airline#extensions#tabline#tab_nr_type = 1 let g:airline#extensions#whitespace#enabled = 0 "disabled " ---------------------------------------------------------------------- " Lightline configuration " ---------------------------------------------------------------------- let g:lightline = { \ 'colorscheme': 'wombat', \ } " ---------------------------------------------------------------------- " CtrlP and extensions configuration " ---------------------------------------------------------------------- " let g:ctrlp_extensions = ['funky'] " nnoremap :CtrlPFunky " ---------------------------------------------------------------------- " Indent guides " ---------------------------------------------------------------------- let g:indent_guides_start_level=2 let g:indent_guides_guide_size=1 " ---------------------------------------------------------------------- " Jedi-VIM " ---------------------------------------------------------------------- " this disables the documentation/preview split autocmd FileType python setlocal completeopt-=preview let g:jedi#show_call_signatures = "0" " ---------------------------------------------------------------------- " UltiSnips " ---------------------------------------------------------------------- let g:UltiSnipsEditSplit = "horizontal" let g:UltiSnipsExpandTrigger = "" let g:UltiSnipsJumpForwardTrigger = "" let g:UltiSnipsJumpBackwardTrigger = "" let g:ultisnips_python_style = "sphinx" let g:UltiSnipsSnippetDirectories=[$HOME.'/.vim/UltiSnips'] " ---------------------------------------------------------------------- " Nerdtree and Nerdtree tabs " ---------------------------------------------------------------------- let NERDTreeChDirMode=2 let NERDTreeIgnore=['\.rbc$', '\~$', '\.pyc$', '\.db$', '\.sqlite$', '__pycache__'] let NERDTreeSortOrder=['^__\.py$', '\/$', '*', '\.swp$', '\.bak$', '\~$'] let NERDTreeShowBookmarks=1 let g:nerdtree_tabs_focus_on_files=1 let g:NERDTreeMapOpenInTabSilent = '' let g:NERDTreeWinSize = 40 "noremap :NERDTreeToggle "nnoremap :NERDTreeFind " map \ NERDTreeTabsToggle " ---------------------------------------------------------------------- " Syntastic " ---------------------------------------------------------------------- " * Global options let g:syntastic_aggregate_errors = 1 let g:syntastic_always_populate_loc_list = 1 let g:syntastic_auto_loc_list = 2 let g:syntastic_loc_list_height = 4 " * Checker options " ** C: let g:syntastic_c_check_header = 1 let g:syntastic_c_cflags = '-Wall -Werror -W -Wno-unused-parameter -Werror=unused-variable' let g:syntastic_cpp_compiler_options = '-std=c++11' " ---------------------------------------------------------------------- " ALE " ---------------------------------------------------------------------- let g:ale_sign_column_always=1 " ---------------------------------------------------------------------- " Clang formatter " ---------------------------------------------------------------------- let g:clang_format#style_options = { \ "Language": "Cpp", \ "AccessModifierOffset": -1, \ "ConstructorInitializerIndentWidth": 4, \ "AlignEscapedNewlinesLeft": "true", \ "AlignTrailingComments": "true", \ "AllowAllParametersOfDeclarationOnNextLine": "true", \ "AllowShortBlocksOnASingleLine": "false", \ "AllowShortIfStatementsOnASingleLine": "false", \ "AllowShortLoopsOnASingleLine": "false", \ "AllowShortFunctionsOnASingleLine": "None", \ "AlwaysBreakTemplateDeclarations": "true", \ "AlwaysBreakBeforeMultilineStrings": "true", \ "BreakBeforeBinaryOperators": "true", \ "BreakBeforeTernaryOperators": "true", \ "BreakConstructorInitializersBeforeComma": "false", \ "BinPackParameters": "true", \ "ColumnLimit": 100, \ "ConstructorInitializerAllOnOneLineOrOnePerLine": "true", \ "DerivePointerAlignment": "true", \ "ExperimentalAutoDetectBinPacking": "false", \ "IndentCaseLabels": "true", \ "IndentWrappedFunctionNames": "true", \ "IndentFunctionDeclarationAfterType": "true", \ "MaxEmptyLinesToKeep": 1, \ "KeepEmptyLinesAtTheStartOfBlocks": "true", \ "NamespaceIndentation": "None", \ "ObjCSpaceAfterProperty": "false", \ "ObjCSpaceBeforeProtocolList": "false", \ "PenaltyBreakBeforeFirstCallParameter": 1, \ "PenaltyBreakComment": 300, \ "PenaltyBreakString": 1000, \ "PenaltyBreakFirstLessLess": 120, \ "PenaltyExcessCharacter": 1000000, \ "PenaltyReturnTypeOnItsOwnLine": 200, \ "PointerAlignment": "Left", \ "SpacesBeforeTrailingComments": 2, \ "Cpp11BracedListStyle": "false", \ "Standard": "Auto", \ "IndentWidth": 4, \ "TabWidth": 8, \ "UseTab": "Never", \ "BreakBeforeBraces": "Stroustrup", \ "SpacesInParentheses": "false", \ "SpacesInAngles": "false", \ "SpaceInEmptyParentheses": "false", \ "SpacesInCStyleCastParentheses": "false", \ "SpacesInContainerLiterals": "true", \ "SpaceBeforeAssignmentOperators": "true", \ "ContinuationIndentWidth": 4, \ "CommentPragmas": "^ IWYU pragma:", \ "SpaceBeforeParens": "ControlStatements", \ "DisableFormat": "false" } " ---------------------------------------------------------------------- " Vim Expand Region " ---------------------------------------------------------------------- vmap v (expand_region_expand) vmap (expand_region_shrink) " ---------------------------------------------------------------------- " Special options for Python syntax " ---------------------------------------------------------------------- let g:python_highlight_all = 1 " ---------------------------------------------------------------------- " Tiler keybinds " ---------------------------------------------------------------------- nmap n :TilerNew nmap :TilerFocus nmap :TilerReorder let g:tiler#master#size = 55 " ---------------------------------------------------------------------- " fzf keybinds " ---------------------------------------------------------------------- nmap :FZF " ---------------------------------------------------------------------- " Lastly, load configurations available only to this computer " ---------------------------------------------------------------------- if filereadable(expand("~/.vim/local.vim")) source ~/.vim/local.vim endif