Skip to content

Instantly share code, notes, and snippets.

@DIGnmg
Created February 4, 2019 20:18
Show Gist options
  • Save DIGnmg/b918438c3265387d31889aed15dcaad0 to your computer and use it in GitHub Desktop.
Save DIGnmg/b918438c3265387d31889aed15dcaad0 to your computer and use it in GitHub Desktop.
current vimrc
"sessionCheckTime": 5000,yntax on
call plug#begin('~/.vim/plugged')
"""""""""""""""""""""""""""""""""
" VIM:
"""""""""""""""""""""""""""""""""
" wrap gitcommit file types at the appropriate length
filetype indent plugin on
" Fix Backspace
set backspace=indent,eol,start
" encoding
set encoding=utf-8
set fileencoding=utf-8
" no cowbells
set noerrorbells
" don't make it look like there are line breaks where there aren't:
set nowrap
"number of command lines to remember
set history=1000
" Turn off backups, etc.
set nobackup
set noswapfile
set nowb
" enable omnicomplete
set omnifunc=syntaxcomplete#Complete
" fix shitty mouse and nerdtree focus issue: thanks old Brad
if has("mouse_sgr")
set ttymouse=sgr
else
set ttymouse=xterm2
end
" better windows navigating
nnoremap <C-h> <C-w>h
nnoremap <C-j> <C-w>j
nnoremap <C-k> <C-w>k
nnoremap <C-l> <C-w>l
" Always show line numbers.
set number
" use spaces for all indentation
set expandtab
set shiftwidth=2
set softtabstop=2
" Sudo saving (w!!)
cmap w!! w !sudo tee % >/dev/null
set ignorecase " Ignore case when searching
set smartcase " When searching try to be smart about cases
set hlsearch " Highlight search resultsh
set incsearch " be like search in modern browsers
" Map space to / (search)
map <space> /
map <silent> <leader><cr> :noh<cr>
" Enable mouse (if terminal has support for it)
if has('mouse')
set mouse=a
endif
"hide when characters are typed
set mousehide
" Spellcheck en_CA
nnoremap <C-w>s :setlocal spell spelllang=en_ca<CR>
nnoremap <C-w>S :setlocal nospell<CR>
"sync with OS clipboard
set clipboard=unnamed
" Need +virtualedit to paste in insert mode.
exe 'inoremap <script> <C-V>' paste#paste_cmd['i']
exe 'vnoremap <script> <C-V>' paste#paste_cmd['v']
imap <S-Insert> <C-V>
vmap <S-Insert> <C-V>
"auto reload if file saved externally
set autoread
"add mac to auto-detection of file format line endings
set fileformats+=mac
" different cursors for insert vs normal mode
let &t_SI = "\<Esc>]50;CursorShape=1\x7"
let &t_EI = "\<Esc>]50;CursorShape=0\x7"
" formatting shortcuts
vmap <leader>s :sort<cr>
" remap arrow keys
nnoremap <down> :tabprev<CR>
nnoremap <left> :bprev<CR>
nnoremap <right> :bnext<CR>
nnoremap <up> :tabnext<CR>
" smash escape
inoremap jk <esc>
inoremap kj <esc>
" change cursor position in insert mode
inoremap <C-h> <left>
inoremap <C-l> <right>
" reselect visual block after indent
vnoremap < <gv
vnoremap > >gv
"""""""""""""""""""""""""""""""""
" GIST:
"""""""""""""""""""""""""""""""""
" gist-vim
let g:gist_detect_filetype = 1
let g:gist_post_private = 1
"""""""""""""""""""""""""""""""""
" JS Highlighting:
"""""""""""""""""""""""""""""""""
let g:javascript_plugin_flow = 1
"""""""""""""""""""""""""""""""""
" Ale:
"""""""""""""""""""""""""""""""""
let g:ale_lint_on_save = 1
let g:ale_lint_on_text_changed = 0
let g:ale_fixers = {
\ ‘javascript’: [‘eslint’]
\ }
nmap <leader>d <Plug>(ale_fix)
"""""""""""""""""""""""""""""""""
" JSBeautify:
"""""""""""""""""""""""""""""""""
".vimrc
map <c-f> :call JsBeautify()<cr>
" or
autocmd FileType javascript noremap <buffer> <c-f> :call JsBeautify()<cr>
" for json
autocmd FileType json noremap <buffer> <c-f> :call JsonBeautify()<cr>
" for jsx
autocmd FileType jsx noremap <buffer> <c-f> :call JsxBeautify()<cr>
" for html
autocmd FileType html noremap <buffer> <c-f> :call HtmlBeautify()<cr>
" for css or scss
autocmd FileType css noremap <buffer> <c-f> :call CSSBeautify()<cr>
"""""""""""""""""""""""""""""""""
" NERDTree:
"""""""""""""""""""""""""""""""""
" open when vim opens
autocmd vimenter * NERDTree
" open when C-j
map <C-a> :NERDTreeToggle<CR>
:w
let g:loaded_netrw = 1
let g:loaded_netrwPlugin = 1
" change arrows
let g:NERDTreeDirArrowExpandable = '৩'
let g:NERDTreeDirArrowCollapsible = '২'
"""""""""""""""""""""""""""""""""
" Airline:
"""""""""""""""""""""""""""""""""
" tabline enabled
let g:airline#extensions#tabline#enabled = 0
" use powerline fonts
let g:airline_powerline_fonts = 1
" show status line all the time
set laststatus=2
"""""""""""""""""""""""""""""""""
" ESlint:
"""""""""""""""""""""""""""""""""
set statusline+=%#warningmsg#
set statusline+=%{SyntasticStatuslineFlag()}
set statusline+=%*
let g:syntastic_always_populate_loc_list = 1
let g:syntastic_loc_list_height = 5
let g:syntastic_auto_loc_list = 0
let g:syntastic_check_on_open = 1
let g:syntastic_check_on_wq = 1
let g:syntastic_javascript_checkers = ['eslint']
let g:syntastic_error_symbol = 'ȩ'
let g:syntastic_style_error_symbol = 'ȿȩ'
let g:syntastic_warning_symbol = 'Ŵ'
let g:syntastic_style_warning_symbol = 'ȿŴ'
highlight link SyntasticErrorSign SignColumn
highlight link SyntasticWarningSign SignColumn
highlight link SyntasticStyleErrorSign SignColumn
highlight link SyntasticStyleWarningSign SignColumn
"""""""""""""""""""""""""""""""""
" YUNO:
"""""""""""""""""""""""""""""""""
" show dude when 10 modifications
let g:YUNOcommit_after = 10
"""""""""""""""""""""""""""""""""
" Plug:
"""""""""""""""""""""""""""""""""
" Ternjs: run `npm install` the first time
" .dotfiles/vim.symlink/plugged/tern_for_vim
Plug 'airblade/vim-gitgutter'
Plug 'chrisbra/csv.vim'
Plug 'chriskempson/base16-vim'
Plug 'ctrlpvim/ctrlp.vim'
Plug 'easymotion/vim-easymotion'
Plug 'editorconfig/editorconfig-vim'
"Plug 'edsono/vim-matchit'
Plug 'elzr/vim-json'
Plug 'ervandew/supertab'
Plug 'esneider/YUNOcommit.vim'
Plug 'garbas/vim-snipmate'
Plug 'heavenshell/vim-jsdoc'
Plug 'ivalkeen/vim-ctrlp-tjump'
Plug 'jasoncodes/ctrlp-modified.vim'
Plug 'jiangmiao/auto-pairs'
Plug 'jlanzarotta/bufexplorer'
Plug 'maksimr/vim-jsbeautify'
Plug 'marcweber/vim-addon-mw-utils'
Plug 'mattn/gist-vim'
Plug 'mattn/webapi-vim'
Plug 'mileszs/ack.vim'
Plug 'moll/vim-node'
Plug 'othree/yajs.vim'
Plug 'scrooloose/nerdcommenter'
Plug 'scrooloose/nerdtree', { 'on': 'NERDTreeToggle' }
Plug 'scrooloose/syntastic'
Plug 'sgur/ctrlp-extensions.vim'
Plug 'sjl/gundo.vim'
Plug 'suan/vim-instant-markdown'
Plug 'takac/vim-spotifysearch'
Plug 'ternjs/tern_for_vim'
Plug 'tomtom/tlib_vim'
Plug 'tpope/vim-abolish'
Plug 'tpope/vim-fugitive'
Plug 'tpope/vim-surround'
Plug 'vim-airline/vim-airline'
Plug 'vim-airline/vim-airline-themes'
Plug 'vim-scripts/winresizer.vim'
Plug 'xolox/vim-easytags'
Plug 'xolox/vim-misc'
Plug 'universal-ctags/ctags'
Plug 'terryma/vim-multiple-cursors'
Plug 'tpope/vim-surround'
Plug 'pangloss/vim-javascript'
Plug 'w0rp/ale'
Plug 'dracula/vim', { 'as': 'dracula' }
" Add plugins to &runtimepath
call plug#end()
"""""""""""""""""""""""""""""""""
" Colorscheme
"""""""""""""""""""""""""""""""""
"let base16colorspace=256
"set background=dark
"colorscheme base16-default-dark
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment