Last active
January 6, 2020 00:25
-
-
Save ninachaubal/b20ebb9f92478dd8a355f7a6338c05e6 to your computer and use it in GitHub Desktop.
.vimrc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if empty(glob('~/.vim/autoload/plug.vim')) | |
silent !curl -fLo ~/.vim/autoload/plug.vim --create-dirs | |
\ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim | |
autocmd VimEnter * PlugInstall --sync | source $MYVIMRC | |
endif | |
" Load plugins | |
call plug#begin('~/.vim/plugged') | |
Plug 'vim-airline/vim-airline' | |
Plug 'vim-airline/vim-airline-themes' | |
Plug 'Raimondi/delimitMate' | |
Plug 'mxw/vim-jsx' | |
Plug 'leafgarland/typescript-vim' | |
Plug 'peitalin/vim-jsx-typescript' | |
Plug 'pangloss/vim-javascript' | |
Plug 'wincent/Command-T' | |
Plug 'JamshedVesuna/vim-markdown-preview' | |
call plug#end() | |
" ui settings | |
set splitright " :vsp splits right | |
set number " line numbers | |
set showcmd " show commands as you type | |
set wrap " wraps long lines | |
colo slate " set editor theme | |
let g:airline_theme='bubblegum' " airline(status bar plugin) theme | |
" add an easy way to leave insert mode | |
imap jj <Esc> | |
" vim generated files | |
" '//' prevents filename collisions. | |
set nobackup " no ~ backup files | |
set noswapfile " no .swp files | |
set undodir=~/.vim/.undo// " undo files live in their own directory. | |
" tabs | |
filetype plugin indent on | |
set tabstop=2 " show existing tabgs with 2 spaces width | |
set shiftwidth=2 " when indenting with '>', use 2 spaces width | |
set expandtab " on pressing tab, insert 2 spaces | |
" syntax | |
syntax on " syntax highlighting | |
set showmatch "show matching parens | |
" search options | |
set ignorecase " make / searches case insensitive | |
set smartcase " (unless they contain a capital) | |
set hlsearch " highlight search results | |
set incsearch " jumps to next logical match as you type | |
" pasting | |
set pastetoggle=<leader>p | |
" auto-reload files that have changed | |
set autoread | |
" create directories if needed when saving a file | |
function s:MkNonExDir(file, buf) | |
if empty(getbufvar(a:buf, '&buftype')) && a:file!~#'\v^\w+\:\/' | |
let dir=fnamemodify(a:file, ':h') | |
if !isdirectory(dir) | |
call mkdir(dir, 'p') | |
endif | |
endif | |
endfunction | |
augroup BWCCreateDir | |
autocmd! | |
autocmd BufWritePre * :call s:MkNonExDir(expand('<afile>'), +expand('<abuf>')) | |
augroup END | |
" Remove trailing whitespace on save | |
" (except when editing `diffs`, which sometimes require trailing whitespace) | |
autocmd BufWritePre * if &ft != 'diff' | :%s/\s\+$//e | |
" Enable JS Flow support | |
let g:javascript_plugin_flow = 1 | |
" Use github style markdown (requires grip) | |
let vim_markdown_preview_github=1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment