Skip to content

Instantly share code, notes, and snippets.

@cuonggt
Created May 22, 2017 11:10
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 cuonggt/6ad2c7b7dd65a7dd6de032749e2fba5f to your computer and use it in GitHub Desktop.
Save cuonggt/6ad2c7b7dd65a7dd6de032749e2fba5f to your computer and use it in GitHub Desktop.
Vim dot files
"Disable the print key for Macvim.
if has("gui_macvim")
macmenu &File.Print key=<nop>
set macligatures "We want pretty symbols, when available.
endif
set nocompatible "We want the latest Vim settings/options.
so ~/.vim/plugins.vim
syntax enable
set backspace=indent,eol,start "Make backspace behave like every other editor.
let mapleader = ',' "The default leader is \, but a comma is much better.
set number "Let's activate line numbers.
"-------------Visuals--------------"
colorscheme atom-dark
set guifont=Operator_Mono:h17
set t_CO=256 "Use 256 colors. This is useful for Terminal Vim.
set guioptions-=e "We don't want GUI tabs.
set linespace=15 "Macvim-specific line-height.
set guioptions-=l "Disable GUI scrollbars.
set guioptions-=L
set guioptions-=r
set guioptions-=R
"-------------Search--------------"
set hlsearch "Highlight all matched terms.
set incsearch "Incrementally highlight, as we type.
"-------------Split Management--------------"
set splitbelow "Make splits default to below...
set splitright "And to the right. This feels more natural.
"We'll set simpler mappings to switch between splits.
nmap <C-J> <C-W><C-J>
nmap <C-K> <C-W><C-K>
nmap <C-H> <C-W><C-H>
nmap <C-L> <C-W><C-L>
"-------------Mappings--------------"
"Make it easy to edit the Vimrc file.
nmap <Leader>ev :tabedit $MYVIMRC<cr>
"Add simple highlight removal.
nmap <Leader><space> :nohlsearch<cr>
"Quickly browse to any tag/symbol in the project.
"Tip: run ctags -R to regenerated the index.
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:30,results:30'
nmap <D-p> :CtrlP<cr>
nmap <D-r> :CtrlPBufTag<cr>
nmap <D-e> :CtrlPMRUFiles<cr>
"/
"/ NERDTree
"/
let NERDTreeHijackNetrw = 0
"Make NERDTree easier to toggle.
nmap <D-1> :NERDTreeToggle<cr>
"-------------Auto-Commands--------------"
"Automatically source the Vimrc file on save.
augroup autosourcing
autocmd!
autocmd BufWritePost .vimrc source %
augroup END
"-------------Tips and Reminders--------------"
" - Press 'zz' to instantly center the line where the cursor is located.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment