Last active
June 22, 2019 20:30
-
-
Save kaimallea/3786a8704c5c88cb86ae5b74ba65a561 to your computer and use it in GitHub Desktop.
.vimrc
This file contains hidden or 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
set nocompatible " disable compatibility with legacy vi (i.e., enable 'new' features) | |
set autoindent " copy indent from current line when starting new line | |
set backspace=indent,eol,start " allow backspacing over autoindent, line breaks, start of insert | |
set cursorline " highlight the screen line of the cursor | |
set encoding=utf-8 | |
set expandtab " in insert mode: use the appropriate number of spaces to insert a tab | |
if has("gui_running") | |
set antialias " use smooth (antialiased) fonts (OSX GUI only) | |
set guifont=Operator\ Mono:h16,Dank\ Mono:h16,Courier:h16 " list of fonts to use in GUI version of Vim | |
endif | |
set hlsearch " highlight all search matches | |
set incsearch " search as you type | |
set laststatus=2 " always show a status line | |
set list listchars=tab:▸\ ,trail:· " use characters to visualize tabs and trailing spaces | |
set matchpairs+=<:> " include <, > when using % to match character pairs | |
set relativenumber " display line numbers relative to the line with the cursor | |
set shell=/bin/zsh " name of shell to use for ! and :! commands | |
set shiftwidth=2 " number of spaces to use for each step of (auto)indent | |
set smartindent " do smart autoindenting when starting a new line | |
set smarttab " a tab in front of a line inserts blanks according to shiftwidth | |
set tabstop=2 " number of spaces that a tab in the file counts for | |
set undolevels=200 " max number of changes that can be undone (default 100) | |
if has("nvim") | |
set termguicolors | |
endif | |
" if missing, automatically install vim-plug to manage plugins | |
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 | |
" Configure ALE to run prettier on save | |
let g:ale_fixers = { | |
\ '*': ['trim_whitespace'], | |
\ 'javascript': ['prettier', 'eslint'], | |
\ 'typescript': ['prettier', 'eslint'], | |
\ 'css': ['prettier'], | |
\} | |
let g:ale_completion_enabled = 1 | |
let g:ale_fix_on_save = 1 | |
set background=light | |
" Set theme for airline | |
" let g:airline_powerline_fonts = 1 | |
let g:airline_theme='solarized' | |
let g:neosolarized_bold = 1 | |
let g:neosolarized_underline = 1 | |
let g:neosolarized_italic = 0 | |
" specify directory for plugins | |
call plug#begin('~/.vim/plugged') | |
" specify plugins to install | |
" IMPORTANT: use single quotes | |
Plug 'scrooloose/nerdtree' | |
Plug 'Xuyuanp/nerdtree-git-plugin' | |
Plug 'tpope/vim-surround' | |
Plug 'vim-airline/vim-airline' | |
Plug 'vim-airline/vim-airline-themes' | |
Plug 'iCyMind/NeoSolarized' | |
Plug 'w0rp/ale' | |
Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' } | |
Plug 'junegunn/fzf.vim' | |
Plug 'leafgarland/typescript-vim' | |
Plug 'ekalinin/dockerfile.vim' | |
" initialize plugin system | |
" (NOTE: automatically executes `filetype plugin indent on` and `syntax enable`) | |
call plug#end() | |
" Set colorscheme | |
colorscheme NeoSolarized | |
" Set leader key to spacebar | |
let mapleader="\<Space>" | |
" Save current buffer | |
nnoremap <leader>w :w<cr> | |
" Move lines around | |
nnoremap <leader>k :m-2<cr>== | |
nnoremap <leader>j :m+<cr>== | |
xnoremap <leader>k :m-2<cr>gv=gv | |
xnoremap <leader>j :m'>+<cr>gv=gv | |
" Activate FZF search pane | |
map ; :GFiles<cr> | |
" Ctrl+N toggles NERDTree | |
map <C-n> :NERDTreeToggle<CR> | |
" Close vim if NERDTree is the last window open | |
autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTreeType") && b:NERDTreeType == "primary") | q | endif | |
" Open NERDTree automatically if no filename specified | |
autocmd vimenter * if !argc() | NERDTree | endif |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment