Skip to content

Instantly share code, notes, and snippets.

@welcomeuniverse
Forked from mikowl/.vimrc
Created April 6, 2019 00:05
Show Gist options
  • Save welcomeuniverse/4af3d2a3f3f85aba4e9fbd7e663f92ae to your computer and use it in GitHub Desktop.
Save welcomeuniverse/4af3d2a3f3f85aba4e9fbd7e663f92ae to your computer and use it in GitHub Desktop.
My simple vim config
set encoding=UTF-8
set nocompatible
" enable syntax and plugins
syntax enable
filetype plugin on
" Plugins
call plug#begin('~/.vim/plugged')
Plug 'tpope/vim-sensible'
Plug 'tpope/vim-vinegar'
Plug 'tpope/vim-speeddating'
Plug 'tpope/vim-fugitive'
Plug 'pope/vim-repeat'
Plug 'easymotion/vim-easymotion'
Plug 'svermeulen/vim-easyclip'
Plug 'airblade/vim-gitgutter'
Plug 'scrooloose/nerdtree'
Plug 'ctrlpvim/ctrlp.vim'
Plug 'mhinz/vim-grepper'
Plug 'itchyny/lightline.vim'
Plug 'terryma/vim-multiple-cursors'
Plug 'drewtempelmeyer/palenight.vim'
Plug 'arcticicestudio/nord-vim'
Plug 'wincent/terminus'
Plug 'ryanoasis/vim-devicons'
Plug 'luochen1990/rainbow'
call plug#end()
set background=dark
" Set colorscheme
" Color schemes I like: one, night-owl, palenight
colorscheme nord
let g:nord_italic = 1
" let g:one_allow_italics = 1
" Bracket highlighting
let g:rainbow_active = 1
" Search down into subfolders, provides tab-completion
set path+=**
" Display all matching files when we tab complete
set wildmenu
set gdefault
" File browsing tweaks
let g:netrw_banner=0 " disable banner
let g:netrw_browse_split=4 " open in prior window
let g:netrw_liststyle=3 " treeview
" Make backspace behave more standardly
set bs=2
" Fix esc lag
set timeoutlen=1000 ttimeoutlen=0
" Indent
set expandtab
set shiftwidth=2
set autoindent
set smartindent
" Disable auto-wrap
set nowrap
set textwidth=0
set wrapmargin=0
" Make `jj` and `jk` throw you into normal mode
inoremap jj <esc>
inoremap jk <esc>
" I don't like d to copy
nnoremap <leader>d "_d
xnoremap <leader>d "_d
xnoremap <leader>p "_dP
" easymotion
nnoremap ,f H:call EasyMotion#WB(0, 0)<CR>
" let g:EasyMotion_use_upper = 1 " Use uppercase target labels and type as a lower case
let g:EasyMotion_smartcase = 1 " type `l` and match `l`&`L`
let g:EasyMotion_use_smartsign_us = 1 " Smartsign (type `3` and match `3`&`#`)
let g:EasyMotion_do_mapping = 0 " Disable default mappings
map <Leader> <Plug>(easymotion-prefix)
" Jump to anywhere you want with minimal keystrokes, with just one key binding.
" `s{char}{label}`
nmap s <Plug>(easymotion-overwin-f)
" JK motions: Line motions
map <Leader>j <Plug>(easymotion-j)
map <Leader>k <Plug>(easymotion-k)
" easy clip
set clipboard=unnamed
" Git gutter
set updatetime=100
" Grepper
let g:grepper = {}
let g:grepper.tools = ["rg"]
xmap gr <plug>(GrepperOperator)
" CtrlP
let g:ctrlp_map = '<c-p>'
let g:ctrlp_cmd = 'CtrlP'
let g:ctrlp_working_path_mode = 'ra'
let g:ctrlp_custom_ignore = 'node_modules\|DS_Store\|git|pub\'
" Find & replace helpers
" /foo<CR>, press CMD+d, fill and hit return
nnoremap <C-g> :%s///g<Left><Left>
" Split vertically to bottom
set splitbelow
" NERDTree
" Type ,ne in normal mode to open NERDTree
let mapleader = ","
nmap <leader>ne :NERDTreeToggle<cr>
" alternate shortcut
map <silent> <C-\> :NERDTreeToggle<CR>
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 | exe 'cd '.argv()[0] | endif
let NERDTreeMinimalUI = 1
let NERDTreeDirArrows = 1
hi Directory guifg=#838CBF ctermfg=6d
hi NERDTreeClosable guifg=#89DDFF ctermfg=175
hi NERDTreeOpenable guifg=#89DDFF ctermfg=108
" NERDTrees File highlighting
function! NERDTreeHighlightFile(extension, fg, bg, guifg, guibg)
exec 'autocmd filetype nerdtree highlight ' . a:extension .' ctermbg='. a:bg .' ctermfg='. a:fg .' guibg='. a:guibg .' guifg='. a:guifg
exec 'autocmd filetype nerdtree syn match ' . a:extension .' #^\s\+.*'. a:extension .'$#'
endfunction
call NERDTreeHighlightFile('jade', 'green', 'none', 'green', '#151515')
call NERDTreeHighlightFile('ini', 'yellow', 'none', 'yellow', '#151515')
call NERDTreeHighlightFile('md', 'blue', 'none', '#3366FF', '#151515')
call NERDTreeHighlightFile('yml', 'yellow', 'none', 'yellow', '#151515')
call NERDTreeHighlightFile('config', 'yellow', 'none', 'yellow', '#151515')
call NERDTreeHighlightFile('conf', 'yellow', 'none', 'yellow', '#151515')
call NERDTreeHighlightFile('json', 'yellow', 'none', 'yellow', '#151515')
call NERDTreeHighlightFile('html', 'yellow', 'none', 'yellow', '#151515')
call NERDTreeHighlightFile('styl', 'cyan', 'none', 'cyan', '#151515')
call NERDTreeHighlightFile('css', 'cyan', 'none', 'cyan', '#151515')
call NERDTreeHighlightFile('coffee', 'Red', 'none', 'red', '#151515')
call NERDTreeHighlightFile('js', 'Red', 'none', '#ffa500', '#151515')
call NERDTreeHighlightFile('php', 'Magenta', 'none', '#ff00ff', '#151515')
set number
highlight LineNr ctermfg=24
nnoremap <C-p> :Files<Cr>
let g:lightline = {
\ 'colorscheme': 'jellybeans',
\ }
set laststatus=2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment