Skip to content

Instantly share code, notes, and snippets.

@kamath
Last active March 22, 2023 05:42
Show Gist options
  • Save kamath/7a21d9f8829d2d858385bc1d8355ac59 to your computer and use it in GitHub Desktop.
Save kamath/7a21d9f8829d2d858385bc1d8355ac59 to your computer and use it in GitHub Desktop.
vimrc
" NOTE: this is a .vimrc but a lot of plugins here are only compatible with neovim.
" To use this vimrc with neovim, use the init.vim below in ~/.config/nvim/init.vim
" NOTE: coc.nvim needs to be installed separately
" https://github.com/neoclide/coc.nvim
" Map space to vertical split + file explorer
nnoremap <Space> <C-w>v<C-w>l :Ex<CR>
nnoremap <s-Right> <C-w>l
nnoremap <s-Left> <C-w>h
syntax on
set number
set nomagic
set expandtab
set shiftwidth=4
set background=dark
let data_dir = has('nvim') ? stdpath('data') . '/site' : '~/.vim'
if empty(glob(data_dir . '/autoload/plug.vim'))
silent execute '!curl -fLo '.data_dir.'/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()
Plug 'sainnhe/everforest'
Plug 'FrenzyExists/aquarium-vim'
Plug 'autozimu/LanguageClient-neovim', {
\ 'branch': 'next',
\ 'do': 'bash install.sh',
\ }
" (Optional) Multi-entry selection UI.
Plug 'junegunn/fzf'
Plug 'github/copilot.vim'
Plug 'neoclide/coc.nvim', {'branch': 'release'}
call plug#end()
set background=dark
colorscheme everforest
" Required for operations modifying multiple buffers like rename.
set hidden
let g:LanguageClient_serverCommands = {
\ 'rust': ['~/.cargo/bin/rustup', 'run', 'stable', 'rls'],
\ 'javascript': ['/usr/local/bin/javascript-typescript-stdio'],
\ 'javascript.jsx': ['tcp://127.0.0.1:2089'],
\ 'python': ['/usr/local/bin/pyls'],
\ 'ruby': ['~/.rbenv/shims/solargraph', 'stdio'],
\ }
" note that if you are using Plug mapping you should not use `noremap` mappings.
nmap <F5> <Plug>(lcn-menu)
tnoremap <Esc> <C-\><C-n>
vnoremap <C-f> y:vimgrep /<C-r>/ ** %<CR>
" Disable tab completion for copilot
imap <silent><script><expr> <C-J> copilot#Accept("\<CR>")
let g:copilot_no_tab_map = v:true
" Make <CR> to accept selected completion item or notify coc.nvim to format
" <C-g>u breaks current undo, please make your own choice.
" " Use tab for trigger completion with characters ahead and navigate
" NOTE: There's always complete item selected by default, you may want to enable
" no select by `"suggest.noselect": true` in your configuration file
" NOTE: Use command ':verbose imap <tab>' to make sure tab is not mapped by
" other plugin before putting this into your config
inoremap <silent><expr> <TAB>
\ coc#pum#visible() ? coc#pum#next(1) :
\ CheckBackspace() ? "\<Tab>" :
\ coc#refresh()
inoremap <expr><S-TAB> coc#pum#visible() ? coc#pum#prev(1) : "\<C-h>"
" Make <CR> to accept selected completion item or notify coc.nvim to format
" <C-g>u breaks current undo, please make your own choice
inoremap <silent><expr> <CR> coc#pum#visible() ? coc#pum#confirm()
\: "\<C-g>u\<CR>\<c-r>=coc#on_enter()\<CR>"
" Make backslash-p copy visually selected to clipboard (similar with backslash-p to paste)
vnoremap \y y:call system("pbcopy", getreg("\""))<CR>
nnoremap \p :call setreg("\"", system("pbpaste"))<CR>p
noremap YY "+y<CR>
noremap P "+gP<CR>
noremap XX "+x<CR>
set runtimepath^=~/.vim runtimepath+=~/.vim/after
let &packpath = &runtimepath
source ~/.vimrc
# https://medium.com/airfrance-klm/beautify-your-iterm2-and-prompt-40f148761a49
# Homebrew
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
# iTerm2
brew install --cask iterm2
# Beautify iTerm2
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
brew install pure
brew install zplug
(curl -Ls https://raw.githubusercontent.com/sindresorhus/iterm2-snazzy/main/Snazzy.itermcolors > /tmp/Snazzy.itermcolors && open /tmp/Snazzy.itermcolors)
# Powerlevel10k
brew install romkatv/powerlevel10k/powerlevel10k
echo 'source $(brew --prefix powerlevel10k)/powerlevel10k.zsh-theme' >>! ~/.zshrc
# Plug for Vim
curl -fLo ~/.vim/autoload/plug.vim --create-dirs \
https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
# Github Copilot
# NeoVim
brew install neovim
# Node.js
brew install node
# Github
brew install gh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment