Skip to content

Instantly share code, notes, and snippets.

@pofat
Last active October 21, 2016 04:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pofat/f5c69984df76f11683b081505f638188 to your computer and use it in GitHub Desktop.
Save pofat/f5c69984df76f11683b081505f638188 to your computer and use it in GitHub Desktop.
Config file for my vim
set nocompatible " Make vim behave more usefule way
so ~/.vim/plugins.vim " Manage plugins by vundle
"-------------- Indentation ------------
set tabstop=4 " Number of space per tab
set shiftwidth=4 " Indent 4 columns for << and >> operations
set expandtab " Replace tab with space
set autoindent " Indent at the same level of the previous line
"-------------- Searching --------------
set hlsearch " Highlight search result
set incsearch " Search as characters in real time
"-------------- Mappings --------------
let mapleader=',' " Change leader to comma
" Turn off search highlight
nnoremap <leader><space> :noh<CR>
" Shortcut to open vimrc file quickly
nmap <leader>ev :tabedit ~/.vimrc <CR>
nmap <D-1> :tabn1<CR>
nmap <D-2> :tabn2<CR>
nmap <D-3> :tabn3<CR>
nmap <D-4> :tabn4<CR>
nmap <D-5> :tabn5<CR>
nmap <D-6> :tabn6<CR>
" Switch to alternatvie file quickly with ctrl+e
map <C-e> <C-^>
" Mover cursor among windows by ctrl + hjkl
nmap <C-h> <C-w><C-h>
nmap <C-j> <C-w><C-j>
nmap <C-k> <C-w><C-k>
nmap <C-l> <C-w><C-l>
" Toggle NERDTree sidebar
nmap <C-n> :NERDTreeToggle<CR>
" List all tags in the current buffer
nnoremap <C-r> :CtrlPBufTag<CR>
" Switch to MRU files quickly
nnoremap <D-e> :CtrlPMRUFiles<CR>
" Jump to a tag quickly
nmap <leader>f :tag<space>
"-------------------- Plugins --------------------
" CtrlP {
let g:ctrlp_custom_ignore='node_modules\DS_Store\.git'
let g:ctrlp_match_window='top,order:ttb,min:1,max:15,resutls:15'
" }
" Greplace {
set grepprg=ag
let g:grep_cmd_opts = '--line-numbers --noheading'
" }
"--------------------Autocmd--------------------
augroup autosourcing
" Clear all autocmds in this group
autocmd!
" Refresh vimrc automatically after changing setting
autocmd BufWritePost .vimrc so %
augroup END
"-------------- Themes and color --------------
set t_CO=256 " Number of colors in terminal
colorscheme atom-dark-256 " My Vim TUI color scheme
syntax on " Enable syntax highlighting
"--------------------UI tweaks--------------------
set guifont=Fira_Code:h18 " Monospaced font with programming ligatures
set guioptions-=e " Hide the native bar
if has("gui_running")
set macligatures
endif
set linespace=16 " Set the line height
set number " Show line numbers
set cursorline " Highlight current line
filetype indent on " Load filetype-specific indent files
set noerrorbells " Disable bell for errors that display messages
set guioptions-=l " Hide left scroll bar
set guioptions-=L " Hide left scroll bar in splitted window
set guioptions-=r " Hide right hand scroll bar
set guioptions-=R " Hide right hand scroll bar in splitted window
set showmatch " Highlight matching {[()]} automatically
set wildmenu " Visualize autocomplete menu for command
set scrolljump=5 " Lines to scroll when cursor leaves screen
set scrolloff=3 " Minium lines to keep above and below the cursor
set laststatus=2 " Always display status line
set ruler " Display the line and column of the cursor in status bar
set splitbelow " Split the window below the current
set splitright " Split the window at right of the current
set autowriteall " Automatically save the file whien switching buffers
"--------------------Backup--------------------
" Directories for the swp files
set directory=~/.vim-tmp,~/.tmp,~/tmp,/var/tmp,/tmp
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment