Skip to content

Instantly share code, notes, and snippets.

@grammy-jiang
Last active October 6, 2023 09:40
Show Gist options
  • Save grammy-jiang/162f271c59a97a424d228f0de10d05e9 to your computer and use it in GitHub Desktop.
Save grammy-jiang/162f271c59a97a424d228f0de10d05e9 to your computer and use it in GitHub Desktop.
$HOME/.vimrc
" =========================================================================== "
" Github URL
" https://gist.githubusercontent.com/grammy-jiang/162f271c59a97a424d228f0de10d05e9/raw
" Shorten URL
" https://git.io/JvpSM
" =========================================================================== "
set encoding=utf-8
if empty(glob('~/.vim/autoload/plug.vim'))
silent !curl -fLo ~/.vim/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('~/.vim/plugged')
" ======== theme ============================================================ "
" https://github.com/vim-airline/vim-airline
Plug 'vim-airline/vim-airline'
let g:airline#extensions#tabline#enabled = 1
let g:airline#extensions#tabline#formatter = 'unique_tail'
" https://github.com/vim-airline/vim-airline-themes
Plug 'vim-airline/vim-airline-themes'
let g:airline_theme='solarized'
let g:airline_solarized_bg='dark'
" https://github.com/altercation/vim-colors-solarized
Plug 'altercation/vim-colors-solarized'
" https://github.com/Yggdroot/indentLine
Plug 'Yggdroot/indentLine'
" ======== autocomplete ===================================================== "
" https://github.com/jiangmiao/auto-pairs
Plug 'jiangmiao/auto-pairs'
" https://github.com/ycm-core/YouCompleteMe
let g:ycm_python_interpreter_path = ''
let g:ycm_python_sys_path = []
let g:ycm_extra_conf_vim_data = [
\ 'g:ycm_python_interpreter_path',
\ 'g:ycm_python_sys_path'
\]
let g:ycm_global_ycm_extra_conf = '~/global_extra_conf.py'
Plug 'ycm-core/YouCompleteMe', {'do': './install.py && pip install --no-cache-dir --upgrade jedi'}
" ======== search =========================================================== "
" https://github.com/ctrlpvim/ctrlp.vim
Plug 'ctrlpvim/ctrlp.vim'
" https://github.com/tpope/vim-commentary
Plug 'tpope/vim-commentary'
" https://github.com/easymotion/vim-easymotion
Plug 'easymotion/vim-easymotion'
" ======== syntax highlight ================================================= "
" https://github.com/sheerun/vim-polyglot
Plug 'sheerun/vim-polyglot'
" https://github.com/tmux-plugins/vim-tmux
Plug 'tmux-plugins/vim-tmux'
" ======== git ============================================================== "
" https://github.com/tpope/vim-fugitive
Plug 'tpope/vim-fugitive'
" https://github.com/airblade/vim-gitgutter
Plug 'airblade/vim-gitgutter'
call plug#end()
" ======== altercation/vim-colors-solarized ================================= "
syntax enable
let g:solarized_termcolors=256
colorscheme solarized
if has('gui_running')
set background=light
else
set background=dark
endif
" ======== easymotion/vim-easymotion ======================================== "
let g:EasyMotion_do_mapping = 0 " Disable default mappings
let g:EasyMotion_smartcase = 1 " type `l` and match `l`&`L`
let g:EasyMotion_use_smartsign_us = 1 " Smartsign (type `3` and match `3`&`#`)
" Replace the default search of Vim
map / <Plug>(easymotion-sn)
omap / <Plug>(easymotion-tn)
map n <Plug>(easymotion-next)
map N <Plug>(easymotion-prev)
" JK motions: Line motions
map <Leader>j <Plug>(easymotion-j)
map <Leader>k <Plug>(easymotion-k)
" ======== auto reload the vimrc when it changes ============================ "
if has ('autocmd') " Remain compatible with earlier versions
augroup vimrc " Source vim configuration upon save
autocmd! BufWritePost $MYVIMRC source % | echom "Reloaded " . $MYVIMRC | redraw
autocmd! BufWritePost $MYGVIMRC if has('gui_running') | so % | echom "Reloaded " . $MYGVIMRC | endif | redraw
augroup END
endif " has autocmd
highlight CursorLine term=bold cterm=bold ctermbg=234
highlight CursorLineNR term=bold cterm=bold ctermbg=234
@grammy-jiang
Copy link
Author

grammy-jiang commented Apr 7, 2020

The python interpreter path is configured to use the one managed by pyenv.

Before running vim

Create SWAP Partition

sudo fallocate -l 1G /swapfile && \
sudo chmod 600 /swapfile && \
sudo mkswap /swapfile && \
sudo swapon /swapfile && \
sudo swapon --show

Install dependencies for YouCompleteMe

sudo -- sh -c "apt-get install -y build-essential cmake vim-nox python3-dev wget && apt-get install --yes libtinfo5"

Usage

curl -fLo ~/.vim/autoload/plug.vim --create-dirs https://git.io/VgrSsw && \
wget --output-document=$HOME/.vimrc https://git.io/JvpSM && vim -c "PlugInstall" -c "qa"

Related

TODO

Add the following plugins:

Reference

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment