Skip to content

Instantly share code, notes, and snippets.

@rafacouto
Last active October 31, 2019 23:59
Show Gist options
  • Save rafacouto/014471c62d076ba1d333 to your computer and use it in GitHub Desktop.
Save rafacouto/014471c62d076ba1d333 to your computer and use it in GitHub Desktop.
This is my vimrc
" general
set nocompatible
set number
set ruler
set textwidth=78
set nowrap
set colorcolumn=+3,+43
set encoding=utf-8
set fileformats=unix,dos,mac
set history=100
set undolevels=100
set wildmenu
set lazyredraw
set modeline
syntax on
" ignored files
set wildignore+=*.jpg,*.jpeg,*.png,*.gif " images
set wildignore+=*.pdf " PDF documents
set wildignore+=*.o " compiled object files
" search tag list from current dir up till root.
set tags=./tags;/
map <M-Left> <C-T>
map <M-Right> <C-]>
" vim bundle manager (git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim)
filetype off
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
Plugin 'VundleVim/Vundle.vim' " The plug-in manager for Vim
Plugin 'scrooloose/nerdtree' " A tree explorer plugin for vim
Plugin 'rstacruz/sparkup' " A parser for a condensed HTML format
Plugin 'xolox/vim-misc' " Miscellaneous auto-load Vim scripts
Plugin 'xolox/vim-session' " Extended session management for Vim
Plugin 'sjl/badwolf' " A color scheme for Vi by Steve Losh
Plugin 'bling/vim-airline' " Status/tabline that's light as air
Plugin 'tpope/vim-fugitive' " A Git wrapper
Plugin 'kien/ctrlp.vim' " Fuzzy file, buffer, mru, tag... finder
Plugin 'majutsushi/tagbar' " Displays tags in a window, ordered by scope
Plugin 'mattn/emmet-vim' " HTML and CSS hi-speed coding
Plugin 'rust-lang/rust.vim' " Rust language
Plugin 'w0rp/ale' " Asynchronous Lint Engine
Plugin 'junegunn/goyo.vim' " Distraction-free writing in Vim
Plugin 'godlygeek/tabular' " Vim script for text filtering and alignment
call vundle#end()
filetype plugin indent on
" vim-session
let g:session_autoload = 'no'
let g:session_autosave = 'no'
" vim-airline (install https://github.com/powerline/fonts/)
let g:airline_powerline_fonts = 1
let g:airline_symbols = {}
let g:airline#extensions#tabline#enabled = 1
let g:airline#extensions#tabline#fnamemod = ':t'
let g:airline#extensions#tabline#switch_buffers_and_tabs = 1
let g:airline#extensions#tabline#buffer_nr_show = 1
let g:airline#extensions#tabline#buffer_nr_format = '%s:'
let g:airline#extensions#tabline#tab_nr_type = 1
let g:airline#extensions#csv#enabled = 1
" ALE
let g:ale_echo_msg_error_str = 'E'
let g:ale_echo_msg_warning_str = 'W'
let g:ale_echo_msg_info_str = 'I'
let g:ale_echo_msg_format = '[%linter%][%severity%] %s'
let g:ale_lint_on_text_changed = 'insert'
let g:ale_cpp_clangtidy_options = '-Wall -std=c++11 -x c++'
let g:ale_cpp_clangcheck_options = '-- -Wall -std=c++11 -x c++'
let g:airline#extensions#ale#enabled = 1
nmap <silent> <C-k> <Plug>(ale_previous_wrap)
nmap <silent> <C-j> <Plug>(ale_next_wrap)
" markdown filetype
autocmd BufNewFile,BufRead *.markdown,*.mdown,*.mkd,*.mkdn,*.md
\ set filetype=markdown
" remove trailing whitespaces
autocmd FileType c,cpp,text,php,lua
\ autocmd BufWritePre <buffer> :%s/\s\+$//e
" C/C++ PHP Rust C#
autocmd BufWinEnter,FileType c,cpp,php,rs,cs
\ set expandtab smarttab tabstop=4 softtabstop=4 shiftwidth=4
" Lua JSON Yaml
autocmd BufWinEnter,FileType lua,json,yaml
\ set expandtab smarttab tabstop=2 softtabstop=2 shiftwidth=2
" text files
autocmd FileType text
\ set wrap
" colors
colorscheme badwolf
" keys
let mapleader=","
map <leader>, :NERDTreeToggle<CR>
map <leader>t :TagbarToggle<CR>
map <leader>m :bnext<CR>
map <leader>M :bprev<CR>
" Alt-right/left to navigate forward/backward in the tags stack
map <leader>, :NERDTreeToggle<CR>
map <leader>t :TagbarToggle<CR>
map <M-Left> <C-T>
map <M-Right> <C-]>
" highlight search and shortcut to mute highlight
set hlsearch
nnoremap <silent> <C-l> :<C-u>nohlsearch<CR><C-l>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment