Created
April 29, 2020 23:51
-
-
Save runningdemo/b4480bdc72182564ea93eaf49659e347 to your computer and use it in GitHub Desktop.
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
syntax on | |
set noerrorbells | |
set shiftwidth=2 | |
set expandtab | |
set smartindent | |
set nu | |
set nowrap | |
set smartcase | |
set noswapfile | |
set nobackup | |
set undodir=~/.vim/undodir | |
set undofile | |
set incsearch | |
set cmdheight=2 | |
set splitbelow | |
set splitright | |
let mapleader = " " | |
set colorcolumn=80 | |
highlight ColorColumn ctermbg=0 guibg=lightgray | |
call plug#begin() | |
Plug 'morhetz/gruvbox' | |
Plug 'pangloss/vim-javascript' | |
Plug 'mxw/vim-jsx' | |
Plug 'dense-analysis/ale' | |
Plug 'preservim/nerdtree' | |
Plug 'junegunn/fzf', { 'do': { -> fzf#install() } } | |
Plug 'junegunn/fzf.vim' | |
if has('nvim') | |
Plug 'Shougo/deoplete.nvim', { 'do': ':UpdateRemotePlugins' } | |
else | |
Plug 'Shougo/deoplete.nvim' | |
Plug 'roxma/nvim-yarp' | |
Plug 'roxma/vim-hug-neovim-rpc' | |
endif | |
Plug 'carlitux/deoplete-ternjs', { 'do': 'npm install -g tern' } | |
Plug 'autozimu/LanguageClient-neovim', { | |
\ 'branch': 'next', | |
\ 'do': 'bash install.sh', | |
\ } | |
Plug 'bling/vim-airline' | |
Plug 'vim-airline/vim-airline-themes' | |
Plug 'Galooshi/vim-import-js' "need to do `npm install -g import-js` first | |
Plug 'tpope/vim-fugitive' | |
call plug#end() | |
colorscheme gruvbox | |
set background=dark | |
" Formatters | |
au FileType javascript setlocal formatprg=prettier | |
au FileType javascript.jsx setlocal formatprg=prettier | |
au FileType typescript setlocal formatprg=prettier\ --parser\ typescript | |
au FileType html setlocal formatprg=js-beautify\ --type\ html | |
au FileType scss setlocal formatprg=prettier\ --parser\ css | |
au FileType css setlocal formatprg=prettier\ --parser\ css | |
" ale | |
let g:ale_fixers = { | |
\ 'javascript': ['eslint'], | |
\ 'typescript': ['prettier', 'tslint'], | |
\ 'vue': ['eslint'], | |
\ 'scss': ['prettier'], | |
\ 'html': ['prettier'], | |
\ 'reason': ['refmt'] | |
\} | |
let g:ale_fix_on_save = 1 | |
nnoremap ]r :ALENextWrap<CR> " move to the next ALE warning / error | |
nnoremap [r :ALEPreviousWrap<CR> " move to the previous ALE warning / error | |
" NERDTree | |
let NERDTreeShowHidden=1 " Always show dot files | |
let NERDTreeQuitOnOpen=1 | |
map <Leader>n :NERDTreeToggle<CR> | |
" fzf.vim | |
nnoremap <C-p> :GFiles<Cr> | |
nnoremap <C-g> :Rg<Cr> | |
" deoplete.vim | |
let g:deoplete#enable_at_startup = 1 | |
" Language server | |
let g:LanguageClient_serverCommands = { | |
\ 'javascript': ['javascript-typescript-stdio'], | |
\ 'javascript.jsx': ['javascript-typescript-stdio'], | |
\ } | |
nnoremap <leader>l :call LanguageClient_contextMenu()<CR> | |
nnoremap K :call LanguageClient#textDocument_hover()<CR> | |
nnoremap gd :call LanguageClient#textDocument_definition()<CR> | |
nnoremap <leader>r :call LanguageClient#textDocument_rename()<CR> | |
" Clear highlight on pressing ESC | |
nnoremap <esc> :noh<return><esc> | |
" vim/airline | |
let g:airline_powerline_fonts = 0 | |
let g:airline_theme='dark' | |
let g:airline#extensions#tabline#enabled = 1 | |
let g:airline#extensions#tabline#fnamemod = ':t' | |
let g:airline#extensions#default#section_truncate_width = { | |
\ 'b': 79, | |
\ 'x': 60, | |
\ 'y': 88, | |
\ 'z': 45, | |
\ 'warning': 80, | |
\ 'error': 0, | |
\ } | |
let g:airline#parts#ffenc#skip_expected_string='utf-8[unix]' | |
let g:airline#extensions#default#layout = [ | |
\ [ 'a', 'b', 'c' ], | |
\ [ 'y', 'z', 'error', 'warning' ] | |
\ ] | |
" Move between windows | |
noremap <C-h> <C-w>h | |
noremap <C-j> <C-w>j | |
noremap <C-k> <C-w>k | |
noremap <C-l> <C-w>l | |
set hidden | |
" To open a new empty buffer | |
nmap <leader>T :enew<CR> | |
nmap <leader>h :bprevious<CR> | |
nmap <leader>l :bnext<CR> | |
" Close the current buffer and move to the previous one | |
nmap <leader>q :bp <BAR> bd #<CR> | |
" | |
nnoremap<leader>i :ImportJSFix<CR> | |
nnoremap<leader>g :ImportJSGoto<CR> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment