Skip to content

Instantly share code, notes, and snippets.

@k41n
Last active September 20, 2021 10:20
Show Gist options
  • Select an option

  • Save k41n/ec63aa79fd46c59187281e22eaaef4f7 to your computer and use it in GitHub Desktop.

Select an option

Save k41n/ec63aa79fd46c59187281e22eaaef4f7 to your computer and use it in GitHub Desktop.
VIM config
set nocompatible " choose no compatibility with legacy vi
filetype off " required
"" 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
call plug#begin('~/.vim/plugged')
Plug 'tpope/vim-rails'
Plug 'scrooloose/nerdtree'
Plug 'ctrlpvim/ctrlp.vim'
Plug 'tpope/vim-rails'
Plug 'junegunn/fzf'
Plug 'junegunn/fzf.vim'
Plug 'mxw/vim-jsx'
Plug 'altercation/vim-colors-solarized'
Plug 'ayu-theme/ayu-vim'
Plug 'pangloss/vim-javascript'
Plug 'pangloss/vim-javascript'
Plug 'w0rp/ale'
Plug 'rafi/awesome-vim-colorschemes'
call plug#end()
set t_Co=256
colorscheme abstract
syntax enable
set encoding=utf-8
set showcmd " display incomplete commands
filetype plugin indent on " load file type plugins + indentation
"" Whitespace
set nowrap " don't wrap lines
set tabstop=2 shiftwidth=2 " a tab is two spaces (or set this to 4)
set expandtab " use spaces, not tabs (optional)
set backspace=indent,eol,start " backspace through everything in insert mode
"" Searching
set hlsearch " highlight matches
set incsearch " incremental searching
set ignorecase " searches are case insensitive...
set smartcase " ... unless they contain at least one capital letter
autocmd StdinReadPre * let s:std_in=1
autocmd VimEnter * if argc() == 0 && !exists("s:std_in") | NERDTree | endif
autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTree") && b:NERDTree.isTabTree()) | q | endif
map <C-n> :NERDTreeToggle<CR>
map <C-o> :CtrlPMRU<CR>
map <C-p> :Files<CR>
" Emmet
let g:user_emmet_leader_key='<Tab>'
let g:user_emmet_settings = {
\ 'javascript.jsx' : {
\ 'extends' : 'jsx',
\ },
\}
" Linter
let g:ale_sign_error = '●' " Less aggressive than the default '>>'
let g:ale_sign_warning = '.'
let g:ale_linters = {
\ 'javascript': ['flow', 'eslint'],
\ 'ruby': ['rubocop', 'reek']
\}
function! CtrlPCommand()
let c = 0
let wincount = winnr('$')
while !empty(getbufvar(+expand("<abuf>"), "&buftype")) && c < wincount
exec 'wincmd w'
let c = c + 1
endwhile
exec 'CtrlP'
endfunction
let g:ctrlp_cmd = 'call CtrlPCommand()'
function! CtrlPMRUCommand()
let c = 0
let wincount = winnr('$')
while !empty(getbufvar(+expand("<abuf>"), "&buftype")) && c < wincount
exec 'wincmd w'
let c = c + 1
endwhile
exec 'CtrlPMRU'
endfunction
map <C-o> :call CtrlPMRUCommand()<CR>
set number
let NERDTreeShowHidden=1
nmap <S-Enter> O<Esc>j
nnoremap <silent> <leader>aw :ArgWrap<CR>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment