Last active
October 27, 2021 20:58
-
-
Save awave1/5af1f9fa51af38694d2d1baf277377e6 to your computer and use it in GitHub Desktop.
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
call plug#begin("~/.vim/plugged") | |
" Themes | |
Plug 'dracula/vim' | |
Plug 'dikiaap/minimalist' | |
" fern | |
"Plug 'lambdalisue/nerdfont.vim' | |
"Plug 'lambdalisue/fern.vim' | |
"Plug 'antoinemadec/FixCursorHold.nvim' | |
"Plug 'lambdalisue/fern-renderer-nerdfont.vim' | |
"Plug 'ryanoasis/vim-devicons' | |
"Plug 'lambdalisue/fern-hijack.vim' | |
"Plug 'lambdalisue/fern-git-status.vim' | |
"let g:fern#renderer = "nerdfont" | |
" Toggle | |
" noremap <silent> <leader>f :Fern . -drawer -reveal=% -toggle -width=35<CR><C-w>= | |
"nmap <buffer><expr> | |
" \ <Plug>(fern-my-open-expand-collapse) | |
" \ fern#smart#leaf( | |
" \ "\<Plug>(fern-action-open:select)", | |
" \ "\<Plug>(fern-action-expand)", | |
" \ "\<Plug>(fern-action-collapse)", | |
\ ) | |
"nmap <buffer> <CR> <Plug>(fern-my-open-expand-collapse) | |
" fzf | |
Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' } | |
Plug 'junegunn/fzf.vim' | |
Plug 'yuki-yano/fzf-preview.vim', { 'branch': 'release/rpc' } | |
nnoremap <C-p> :FZF<CR> | |
let g:fzf_action = { | |
\ 'ctrl-t': 'tab split', | |
\ 'ctrl-s': 'split', | |
\ 'ctrl-v': 'vsplit' | |
\} | |
let $FZF_DEFAULT_COMMAND = 'ag -g ""' | |
" coc | |
Plug 'neoclide/coc.nvim', {'branch': 'release'} | |
let g:coc_global_extensions = [ | |
'coc-tsserver', | |
'coc-styled-components', | |
'coc-prettier', | |
'coc-html', | |
'coc-fzf-preview', | |
'coc-explorer', | |
'coc-eslint', | |
'coc-emmet', | |
'coc-json', | |
'coc-css', | |
] | |
" use <tab> for trigger completion and navigate to the next complete item | |
function! s:check_back_space() abort | |
let col = col('.') - 1 | |
return !col || getline('.')[col - 1] =~ '\s' | |
endfunction | |
inoremap <silent><expr> <Tab> | |
\ pumvisible() ? "\<C-n>" : | |
\ <SID>check_back_space() ? "\<Tab>" : | |
\ coc#refresh() | |
command! -nargs=0 Prettier :CocCommand prettier.formatFile | |
vmap <leader>ff <Plug>(coc-format-selected) | |
nmap <leader>ff <Plug>(coc-format-selected) | |
nmap <space>e <Cmd>CocCommand explorer<CR> | |
nmap <Leader>f <Cmd>CocCommand explorer<CR> | |
" TypeScript | |
Plug 'leafgarland/typescript-vim' | |
Plug 'peitalin/vim-jsx-typescript' | |
Plug 'styled-components/vim-styled-components' | |
Plug 'tpope/vim-sleuth' | |
Plug 'jiangmiao/auto-pairs' | |
Plug 'qpkorr/vim-bufkill' | |
" vim-gitgutter | |
Plug 'airblade/vim-gitgutter' | |
let g:gitgutter_grep = 'rg' | |
let g:gitgutter_map_keys = 0 | |
nmap [g <Plug>(GitGutterPrevHunk) | |
nmap ]g <Plug>(GitGutterNextHunk) | |
nmap <Leader>p <Plug>(GitGutterPreviewHunk) | |
nmap <Leader>+ <Plug>(GitGutterStageHunk) | |
nmap <Leader>- <Plug>(GitGutterUndoHunk) | |
Plug 'vim-airline/vim-airline' | |
Plug 'vim-airline/vim-airline-themes' | |
let g:airline#extensions#tabline#enabled = 1 | |
let g:airline#extensions#tabline#formatter = 'jsformatter' | |
" 'zen'/focus mode, run :Goyo | |
Plug 'junegunn/goyo.vim' | |
let g:goyo_width = 120 | |
" to comment multiple lines | |
Plug 'preservim/nerdcommenter' | |
call plug#end() | |
if executable('fish') | |
" use fish for embedded terminals | |
set shell=fish | |
" use bash for else | |
let $SHELL = 'bash' | |
endif | |
set nu | |
set cursorline | |
" Theme | |
if (has("termguicolors")) | |
set termguicolors | |
endif | |
syntax enable | |
colorscheme minimalist | |
" open new split panes to right and below | |
set splitright | |
set splitbelow | |
" turn terminal to normal mode with escape | |
tnoremap <Esc> <C-\><C-n> | |
" start terminal in insert mode | |
au BufEnter * if &buftype == 'terminal' | :startinsert | endif | |
" open terminal on ctrl+n | |
function! OpenTerminal() | |
split term://fish | |
resize 10 | |
endfunction | |
nnoremap <C-n> :call OpenTerminal()<CR> | |
" use alt+hjkl to move between split/vsplit panels | |
tnoremap <A-h> <C-\><C-n><C-w>h | |
tnoremap <A-j> <C-\><C-n><C-w>j | |
tnoremap <A-k> <C-\><C-n><C-w>k | |
tnoremap <A-l> <C-\><C-n><C-w>l | |
nnoremap <A-h> <C-w>h | |
nnoremap <A-j> <C-w>j | |
nnoremap <A-k> <C-w>k | |
nnoremap <A-l> <C-w>l | |
" set filetypes as typescriptreact | |
autocmd BufNewFile,BufRead *.tsx,*.jsx set filetype=typescriptreact | |
map <leader>[ :bprev<cr> | |
map <leader>] :bnext<cr> | |
map <leader>dd :BD<cr> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment