Skip to content

Instantly share code, notes, and snippets.

@alexsotocx
Created July 27, 2022 06:34
Show Gist options
  • Save alexsotocx/1d19e3fd98c12fe890cfb843a3fe6415 to your computer and use it in GitHub Desktop.
Save alexsotocx/1d19e3fd98c12fe890cfb843a3fe6415 to your computer and use it in GitHub Desktop.
call plug#begin("~/.vim/plugged")
" Theme
Plug 'dracula/vim'
" Language Client
Plug 'neoclide/coc.nvim', {'branch': 'release'}
let g:coc_global_extensions = ['coc-emmet', 'coc-css', 'coc-python', 'coc-go', 'coc-java', 'coc-html', 'coc-json', 'coc-prettier', 'coc-tsserver']
" TypeScript Highlighting
Plug 'leafgarland/typescript-vim'
Plug 'peitalin/vim-jsx-typescript'
" File Explorer with Icons
Plug 'scrooloose/nerdtree'
Plug 'ryanoasis/vim-devicons'
" File Search
Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' }
Plug 'junegunn/fzf.vim'
call plug#end()
" Enable theming support
if (has("termguicolors"))
set termguicolors
endif
" Theme
syntax enable
colorscheme dracula
let g:NERDTreeShowHidden = 1
let g:NERDTreeMinimalUI = 1
let g:NERDTreeIgnore = []
let g:NERDTreeStatusline = ''
" Automaticaly close nvim if NERDTree is only thing left open
autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTree") && b:NERDTree.isTabTree()) | q | endif
" Toggle
nnoremap <silent> <C-b> :NERDTreeToggle<CR>
nnoremap <C-p> :FZF<CR>
let g:fzf_action = {
\ 'ctrl-t': 'tab split',
\ 'ctrl-s': 'split',
\ 'ctrl-v': 'vsplit'
\}
" requires silversearcher-ag
" used to ignore gitignore files
let $FZF_DEFAULT_COMMAND='ag --nocolor --ignore node_modules -g ""'
" open new split panes to right and below
set splitright
set splitbelow
" turn terminal to normal mode with escape
tnoremap <Esc> <C-\><C-n>
" 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
nnoremap <C-Left> :tabprevious<CR>
nnoremap <C-Right> :tabnext<CR>
nnoremap <C-S-Left> <C-w>h
nnoremap <C-S-Right> <C-w>l
nnoremap <C-S-Down> <C-w>j
nnoremap <C-S-Up> <C-w>k
tnoremap <C-S-Left> <C-\><C-n><C-w>h
tnoremap <C-S-Down> <C-\><C-n><C-w>j
tnoremap <C-S-Up> <C-\><C-n><C-w>k
tnoremap <C-S-Right> <C-\><C-n><C-w>l
nnoremap <silent> <C-S-s> :update<CR>
vnoremap <silent><C-S-s> <c-c>:update<cr>gv
inoremap <silent><C-S-s> <c-o>:update<cr>
" start terminal in insert mode
au BufEnter * if &buftype == 'terminal' | :startinsert | endif
" open terminal on ctrl+;
" uses zsh instead of bash
function! OpenTerminal()
split term://zsh
resize 10
endfunction
nnoremap <c-n> :call OpenTerminal()<CR>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment