Skip to content

Instantly share code, notes, and snippets.

@vtno
Created November 8, 2017 14:00
Show Gist options
  • Select an option

  • Save vtno/a557042a1113ea9f8e73bcb089991c32 to your computer and use it in GitHub Desktop.

Select an option

Save vtno/a557042a1113ea9f8e73bcb089991c32 to your computer and use it in GitHub Desktop.
My vimrc
set nocompatible " be iMproved, required
filetype off " required
syntax on
" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
set runtimepath^=~/.vim/bundle/ctrlp.vim
" alternatively, pass a path where Vundle should install plugins
"call vundle#begin('~/some/path/here')
" let Vundle manage Vundle, required
Plugin 'VundleVim/Vundle.vim'
Plugin 'bling/vim-airline'
Plugin 'tpope/vim-fugitive'
Plugin 'jeetsukumaran/vim-filebeagle'
Plugin 'mattn/emmet-vim'
Plugin 'othree/html5.vim'
Plugin 'leafgarland/typescript-vim'
Plugin 'scrooloose/nerdtree'
Plugin 'ctrlpvim/ctrlp.vim'
Plugin 'pangloss/vim-javascript'
Plugin 'chemzqm/vim-jsx-improve'
Plugin 'mxw/vim-jsx'
Plugin 'Yggdroot/indentLine'
Plugin 'scrooloose/nerdcommenter'
Plugin 'terryma/vim-multiple-cursors'
Plugin 'vim-syntastic/syntastic'
Plugin 'jiangmiao/auto-pairs'
Plugin 'tpope/vim-endwise'
Plugin 'mileszs/ack.vim'
Plugin 'rakr/vim-one'
Plugin 'mhartington/oceanic-next'
Plugin 'prettier/vim-prettier'
" All of your Plugins must be added before the following line
call vundle#end() " required
filetype plugin indent on " required
" To ignore plugin indent changes, instead use:
"filetype plugin on
"
" Brief help
" :PluginList - lists configured plugins
" :PluginInstall - installs plugins; append `!` to update or just :PluginUpdate
" :PluginSearch foo - searches for foo; append `!` to refresh local cache
" :PluginClean - confirms removal of unused plugins; append `!` to auto-approve removal
"
" see :h vundle for more details or wiki for FAQ
" Put your non-Plugin stuff after this line
"
"
" Theme
syntax enable
" for vim 7
set t_Co=256
if &term =~ '256color'
" Disable Background Color Erase (BCE) so that color schemes
" work properly when Vim is used inside tmux and GNU screen.
set t_ut=
endif
" for vim 8
if (has("termguicolors"))
set termguicolors
endif
colorscheme OceanicNext
"set background=dark " for the dark version
let g:airline_theme='one'
hi htmlArg gui=italic
hi Comment gui=italic
hi Type gui=italic
hi htmlArg cterm=italic
hi Comment cterm=italic
hi Type cterm=italic
"ctrlp customization
"Ignore large folders and files
set wildignore+=*/tmp/*,*.so,*.swp,*.zip
let g:ctrlp_custom_ignore='node_modules\|DS_Store\|git'
"Open NERDTree when open vim
autocmd StdinReadPre * let s:std_in=1
autocmd VimEnter * if argc() == 0 && !exists("s:std_in") | NERDTree | endif
"Enable click on NERDTree
set mouse=a
set nu
let g:NERDTreeMouseMode = 2
let NERDTreeShowHidden=1
"remap key so ctrlp open file in new tab
let g:ctrlp_prompt_mappings = {
\ 'AcceptSelection("e")': ['<c-t>'],
\ 'AcceptSelection("t")': ['<cr>', '<2-LeftMouse>'],
\ }
let g:ctrlp_tabpage_position = 'c'
let g:ctrlp_show_hidden = 1
" Press enter to add newline without going into insert mode
nmap <S-Enter> O<Esc>
nmap <CR> o<Esc>
nnoremap <C-v> "+P=']
inoremap <C-v> <C-o>"+P<C-o>=']
" IndentLine
let g:indentLine_enabled = 1
" enable jsx on js file
let g:jsx_ext_required = 0
" Auto Indent
set autoindent
set tabstop=2
set shiftwidth=2
set expandtab
" Syntastic
set statusline+=%#warningmsg#
set statusline+=%{SyntasticStatuslineFlag()}
set statusline+=%*
let g:syntastic_always_populate_loc_list = 1
let g:syntastic_auto_loc_list = 1
let g:syntastic_check_on_open = 0
let g:syntastic_check_on_wq = 0
let g:syntastic_ruby_checkers = ['rubocop']
let g:syntastic_javascript_checkers = ['eslint']
" Don't open new file
cnoreabbrev Ack Ack!
nnoremap <Leader>a :Ack!<Space>
function! MarkWindowSwap()
let g:markedWinNum = winnr()
endfunction
function! DoWindowSwap()
"Mark destination
let curNum = winnr()
let curBuf = bufnr( "%" )
exe g:markedWinNum . "wincmd w"
"Switch to source and shuffle dest->source
let markedBuf = bufnr( "%" )
"Hide and open so that we aren't prompted and keep history
exe 'hide buf' curBuf
"Switch to dest and shuffle source->dest
exe curNum . "wincmd w"
"Hide and open so that we aren't prompted and keep history
exe 'hide buf' markedBuf
endfunction
nmap <silent> <leader>mw :call MarkWindowSwap()<CR>
nmap <silent> <leader>pw :call DoWindowSwap()<CR>
" Universal Copy/Paste
set clipboard=unnamed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment