Last active
December 29, 2020 09:21
-
-
Save zapstar/4a9ea3489d718cef200a to your computer and use it in GitHub Desktop.
My vimrc
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| """""""""""""""""" | |
| " PACKAGES START " | |
| """""""""""""""""" | |
| set nocompatible | |
| call plug#begin('~/.vim/plugged') | |
| " Start adding Vundle plugins from here | |
| " Package manager itself | |
| Plug 'junegunn/vim-plug' | |
| " Sensible VIM defaults | |
| Plugin 'tpope/vim-sensible' | |
| " Github wrapper | |
| Plugin 'tpope/vim-fugitive' | |
| " Easy paren/bracket replace | |
| Plugin 'tpope/vim-surround' | |
| " Vim airline bar | |
| Plugin 'bling/vim-airline' | |
| Plugin 'vim-airline/vim-airline-themes' | |
| " No comment + indent when paste on the screen | |
| Plugin 'ConradIrwin/vim-bracketed-paste' | |
| " Semantic Highlighting | |
| Plugin 'jaxbot/semantic-highlight.vim' | |
| " Airline Clock | |
| Plugin 'enricobacis/vim-airline-clock' | |
| " NERDTree file explorer | |
| Plugin 'scrooloose/nerdtree' | |
| Plugin 'Xuyuanp/nerdtree-git-plugin' | |
| " NERDCommenter | |
| Plugin 'scrooloose/nerdcommenter' | |
| " All of your Plugins must be added before the following line | |
| call plug#end() | |
| """""""""""""""" | |
| " PACKAGES END " | |
| """""""""""""""" | |
| "Exploit 256 colors terminal | |
| " set t_Co=256 | |
| "This is used to prevent X11 from slowing VIM startup | |
| " set clipboard=exclude:.* | |
| " Enable syntax highlighting | |
| syntax on | |
| " Set the background preference | |
| " set background=dark | |
| " 80-char wide only code | |
| "set textwidth=79 | |
| "set colorcolumn=+1 | |
| " Enable VIM Hard-Time by default | |
| " let g:hardtime_default_on = 1 | |
| " For bling/vim-airline | |
| set laststatus=2 | |
| " As we're using airline, we don't want to show mode in last line | |
| set noshowmode | |
| " Set Airline Theme | |
| let g:airline_theme='term' | |
| "Airline smarter tab line | |
| let g:airline#extensions#tabline#enabled = 1 | |
| " Use this Consolas font in PUTTY | |
| " https://github.com/runsisi/consolas-font-for-powerline.git | |
| " Display Powerline fonts | |
| let g:airline_powerline_fonts = 1 | |
| " Customize the clock on Airline to update every second | |
| let g:airline#extensions#clock#format = '%H:%M:%S' | |
| let g:airline#extensions#clock#updatetime = 1000 | |
| " NERDTree stuff | |
| " Shortcut - Ctrl+n | |
| map <C-n> :NERDTreeToggle<CR> | |
| " NERDTree window side to 49 characters | |
| let g:NERDTreeWinSize=49 | |
| " NERDTree show hidden files by default | |
| let NERDTreeShowHidden=1 | |
| " Open NERDTree on startup (file open) | |
| " autocmd VimEnter * NERDTree | wincmd p | |
| " Open NERDTree on startup (just plain vim) | |
| " autocmd StdinReadPre * let s:std_in=1 | |
| " autocmd VimEnter * if argc() == 0 && !exists("s:std_in") | NERDTree | endif | |
| " Close if NERDTree is the only Window | |
| " autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTree") && b:NERDTree.isTabTree()) | q | endif | |
| " Fix for NerdTree delimeter | |
| " let g:NERDTreeNodeDelimiter = "\u00a0" | |
| " NERD Commenter stuff | |
| " Add spaces after comment delimiters by default | |
| let g:NERDSpaceDelims = 1 | |
| " Allow commenting and inverting empty lines (useful when commenting a region) | |
| let g:NERDCommentEmptyLines = 1 | |
| " Enable trimming of trailing whitespace when uncommenting | |
| let g:NERDTrimTrailingWhitespace = 1 | |
| " VIM Table Mode - Markdown specific table separator | |
| let g:table_mode_corner='|' | |
| " Encoding stuff | |
| set encoding=utf-8 | |
| " setglobal fileencoding=latin1 | |
| " Shortcut to rapidly toggle `set list` | |
| " Usually it's \l | |
| nmap <leader>l :set list!<CR> | |
| " Use the same symbols as TextMate for tabstops | |
| " Mind you there's a space in the end, don't delete it | |
| set listchars=tab:▸\ | |
| " By default show tabstops list character | |
| set list! | |
| " Default Tabs and spaces | |
| set shiftwidth=4 | |
| set tabstop=4 | |
| set expandtab | |
| " File type specific modification | |
| autocmd FileType html, css, js, yaml, cmake setlocal shiftwidth=2 tabstop=2 expandtab | |
| " Highlighting | |
| set hlsearch | |
| set cursorline | |
| set nu rnu | |
| " Syntax highlighting off for VIMDIFF | |
| if &diff | |
| syntax off | |
| endif | |
| " Delete trailing spaces on save | |
| fun! <SID>StripTrailingWhitespaces() | |
| let l = line(".") | |
| let c = col(".") | |
| %s/\s\+$//e | |
| call cursor(l, c) | |
| endfun | |
| autocmd FileType c,cpp,proto,python autocmd BufWritePre <buffer> :call <SID>StripTrailingWhitespaces() | |
| " Show C & Python space errors | |
| let c_space_errors = 1 | |
| let python_space_errors = 1 | |
| autocmd VimEnter * redraw! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment