Skip to content

Instantly share code, notes, and snippets.

@ylt6
Created April 1, 2019 10:14
Show Gist options
  • Save ylt6/283246d96fe8292b981a316a65bbcc80 to your computer and use it in GitHub Desktop.
Save ylt6/283246d96fe8292b981a316a65bbcc80 to your computer and use it in GitHub Desktop.
.vimrc
syntax enable
"line numbers
set number
set relativenumber
augroup numbertoggle
autocmd!
autocmd BufEnter,FocusGained,InsertLeave * set relativenumber
autocmd BufLeave,FocusLost,InsertEnter * set norelativenumber
augroup END
set fileencoding=utf-8
set listchars=eol:$,tab:>-,extends:>,precedes:<
set list
set tabstop=4 expandtab softtabstop=4 shiftwidth=4
autocmd Filetype html setlocal tabstop=2 softtabstop=2 shiftwidth=2
autocmd Filetype javasript setlocal tabstop=2 softtabstop=2 shiftwidth=2
autocmd Filetype python setlocal tabstop=4 sts=4 shiftwidth=4
"use shift-tab to input real tab instead of soft tab
inoremap <S-Tab> <C-V><Tab>
set autoindent
"display cursor line
set cursorline
"show match phrase in searching
set showmatch
"clipboard settings
"http://stackoverflow.com/questions/30691466/what-is-difference-between-vims-clipboard-unnamed-and-unnamedplus-settings
set clipboard^=unnamed,unnamedplus
"set folding
set foldmethod=indent
set foldlevel=99
"use space to fold and unfold
nnoremap <space> za
" Make `jj` and `jk` throw you into normal mode
inoremap jj <esc>
inoremap jk <esc>
"Plugins
call plug#begin('~/.vim/plugged')
Plug 'vim-airline/vim-airline' | Plug 'vim-airline/vim-airline-themes'
Plug 'scrooloose/nerdtree', { 'on': 'NERDTreeToggle' }
Plug 'ctrlpvim/ctrlp.vim'
Plug 'editorconfig/editorconfig-vim'
Plug 'vim-scripts/taglist.vim'
Plug 'mhartington/oceanic-next'
Plug 'vim-perl/vim-perl', { 'for': 'perl', 'do': 'make clean carp dancer highlight-all-pragmas moose test-more try-tiny' }
call plug#end()
colorscheme OceanicNext
" NerdTree
autocmd StdinReadPre * let s:std_in=1
autocmd VimEnter * if argc() == 1 && isdirectory(argv()[0]) && !exists("s:std_in") | exe 'NERDTree' argv()[0] | wincmd p | ene | endif
"vim-airline
let g:airline_section_b = '%{strftime("%c")}'
let g:airline_section_y = 'BN: %{bufnr("%")}'
"CtrlP settings
let g:ctrlp_map = '<c-p>'
let g:ctrlp_cmd = 'CtrlP'
let g:ctrlp_working_path_mode = 'ra'
set wildignore+=*/tmp/*,*.so,*.swp,*.zip " MacOSX/Linux
let g:ctrlp_custom_ignore = '\v[\/]\.(git|hg|svn)$'
let g:ctrlp_custom_ignore = {
\ 'dir': '\v[\/]\.(git|hg|svn)$',
\ 'file': '\v\.(exe|so|dll)$',
\ 'link': 'some_bad_symbolic_links',
\
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment