Last active
June 19, 2021 03:25
-
-
Save jkjung-avt/26226c7265085e51d6a14efbe8c93b10 to your computer and use it in GitHub Desktop.
My .vimrc file
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
" JK Jung's .vmirc | |
" | |
" Reference: | |
" | |
" 1. Sample .vimrc by Martin Brochhaus, presented at PyCon APAC 2012 | |
" https://github.com/mbrochh/vim-as-a-python-ide | |
" 2. https://realpython.com/vim-and-python-a-match-made-in-heaven/ | |
" 3. https://github.com/fisadev/fisa-vim-config | |
" 4. https://github.com/thesheff17/youtube/blob/master/vim/vimrc | |
" 5. https://github.com/amix/vimrc | |
" 6. https://github.com/tpope/vim-sensible/blob/master/plugin/sensible.vim | |
" | |
" Installation: | |
" | |
" * https://gist.github.com/jkjung-avt/26226c7265085e51d6a14efbe8c93b10 | |
" * Download and executre: "install.sh" | |
" * Download and place under ${HOME}: ".vimrc" | |
function! RefreshUI() | |
if exists(':AirlineRefresh') | |
AirlineRefresh | |
else | |
" Clear & redraw the screen, then redraw all statuslines. | |
redraw! | |
redrawstatus! | |
endif | |
endfunction | |
" Automatic reloading of .vimrc | |
autocmd BufWritePost .vimrc source % | :call RefreshUI() | |
" Rebind <Leader> key | |
" I like to have it here becuase it is easier to reach than the default and | |
" it is next to ``m`` and ``n`` which I use for navigating between tabs. | |
"" let mapleader = ',' | |
" Easier formatting of paragraphs | |
"" vmap Q gq | |
"" nmap Q gqap | |
" Generate help tags | |
helptags ~/.vim/doc | |
" Set up Pathogen to manage your plugins | |
" $ mkdir -p ~/.vim/autoload ~/.vim/bundle | |
" $ curl -so ~/.vim/autoload/pathogen.vim https://raw.githubusercontent.com/tpope/vim-pathogen/master/autoload/pathogen.vim | |
" Now you can install any plugin into a .vim/bundle/plugin-name/ folder | |
set nocompatible | |
call pathogen#infect() | |
call pathogen#helptags() | |
" File types | |
" $ mkdir -p ~/.vim/ftplugin | |
" $ wget -O ~/.vim/ftplugin/python_editing.vim http://www.vim.org/scripts/download_script.php?src_id=5492 | |
"" set nofoldenable | |
" Settings for powerline | |
" $ sudo pip3 install powerline-status | |
" $ xset -q | |
" $ cd /tmp | |
" $ wget https://github.com/powerline/powerline/raw/develop/font/PowerlineSymbols.otf | |
" $ wget https://github.com/powerline/powerline/raw/develop/font/10-powerline-symbols.conf | |
" $ sudo cp PowerlineSymbols.otf /usr/share/fonts/X11/misc/ | |
" $ sudo fc-cache -vf /usr/share/fonts/X11/misc/ | |
" $ sudo cp 10-powerline-symbols.conf /etc/fonts/conf.d/ | |
"" set rtp+=/usr/local/lib/python3.6/dist-packages/powerline/bindings/vim/ | |
set laststatus=2 | |
" Settings for ctrlp | |
" $ cd ~/.vim/bundle | |
" $ git clone https://github.com/kien/ctrlp.vim.git | |
let g:ctrlp_max_height = 20 | |
set wildignore+=*.a,*.o,*.so,*.pyc,.git,*build/* | |
set wildignore+=*.jpg,*.png,*.gif,*.bmp,*.ico | |
set wildignore+=*.tmp,*.swp | |
" Settings for jedi-vim | |
" $ cd ~/.vim/bundle | |
" $ git clone https://github.com/davidhalter/jedi-vim.git | |
" $ cd jedi-vim | |
" $ git submodule update --init | |
" $ sudo pip3 install jedi | |
let g:jedi#popup_on_dot = 0 | |
let g:jedi#popup_select_first = 0 | |
let g:jedi#force_py_version = 3 | |
"" let g:jedi#goto_command = '<Leader>d' " Go to definition | |
"" let g:jedi#usages_command = '<Leader>n' " Find ocurrences | |
"" let g:jedi#goto_assignments_command = '<Leader>a' " Find assignments | |
"" nmap <Leader>D :tab split<CR>:call jedi#goto()<CR> " Go to definition in new tab | |
" python with virtualenv support | |
"" py << EOF | |
"" import os | |
"" import sys | |
"" if 'VIRTUAL_ENV' in os.environ: | |
"" project_base_dir = os.environ['VIRTUAL_ENV'] | |
"" activate_this = os.path.join(project_base_dir, 'bin/activate_this.py') | |
"" execfile(activate_this, dict(__file__=activate_this)) | |
"" EOF | |
" Auto completion for python | |
" $ cd ~/.vim/bundle | |
" $ git clone https://github.com/Valloric/YouCompleteMe.git | |
" $ cd ~/.vim/bundle/YouCompleteMe | |
" $ git submodule update --init --recursive | |
" $ python3 ./install.py --clang-completer --java-completer | |
"" let g:ycm_autoclose_preview_window_after_completion = 1 | |
"" let g:ycm_collect_identifiers_from_tags_files = 1 | |
"" let g:ycm_python_interpreter_path = '/usr/bin/python3' | |
"" let g:ycm_global_ycm_extra_conf = '$HOME/.ycm_extra_conf.py' | |
"" let g:ycm_extra_conf_globlist = ['$HOME'] | |
"" map <leader>g :YcmCompleter GoToDefinitionElseDeclaration<CR> | |
" Use vim-flake8 for PEP-8 check: invoke with <F5> | |
" $ cd ~/.vim/bundle | |
" $ https://github.com/nvie/vim-flake8.git | |
"" autocmd FileType python map <buffer> <F5> :call Flake8()<CR> | |
autocmd FileType python map <buffer> <Leader>m :call Flake8()<CR> | |
" Python syntax checking/highlighting | |
" $ cd ~/.vim/bundle | |
" $ git clone https://github.com/vim-syntastic/syntastic.git | |
nmap <leader>e :Errors<CR> | |
let g:syntastic_always_populate_loc_list = 0 | |
let g:syntastic_auto_loc_list = 0 | |
let g:syntastic_check_on_open = 0 | |
let g:syntastic_check_on_wq = 0 | |
let g:syntastic_python_checkers = ['python'] | |
let g:syntastic_python_python_exec = 'python3' | |
" General folding | |
" $ cd ~/.vim/bundle | |
" $ git clone https://github.com/vim-scripts/indentpython.vim.git | |
" $ git clone https://github.com/Konfekt/FastFold.git | |
" $ git clone https://github.com/tmhedberg/SimpylFold.git | |
set foldmethod=indent | |
set foldlevel=99 | |
nnoremap <space> za | |
"" let g:SimpylFold_docstring_preview=1 | |
" Map %% to expand directory of current active window | |
cnoremap <expr> %% getcmdtype() == ':' ? expand('%:h').'/' : '%%' | |
" vim-easymotion: use single <Leader> key | |
map <Leader> <Plug>(easymotion-prefix) | |
" Load matchit.vim, but only if the user hasn't installed a newer version. | |
if !exists('g:loaded_matchit') && findfile('plugin/matchit.vim', &rtp) ==# '' | |
runtime! macros/matchit.vim | |
endif | |
" Mouse and backspace | |
"" set mouse=a | |
set backspace=indent,eol,start | |
" Make backspaces more powerfull | |
set backspace=indent,eol,start | |
" Show partial command | |
set showcmd | |
" bind Ctrl+<movement> keys to move around the windows | |
map <C-j> <C-w>j | |
map <C-k> <C-w>k | |
map <C-l> <C-w>l | |
map <C-h> <C-w>h | |
map <C-Down> <C-w>j | |
map <C-Up> <C-w>k | |
map <C-Left> <C-w>l | |
map <C-Right> <C-w>h | |
" Showing line numbers and length | |
set rnu " show relative line numbers | |
set wrap " wrap lines visually | |
set textwidth=0 | |
set wrapmargin=0 | |
" Highlighting TABs | |
set list | |
set listchars=tab:T> | |
" Useful settings | |
set history=1000 | |
set undolevels=1000 | |
set tabpagemax=50 | |
" Set spell-check language | |
set spelllang=en | |
"" set spell | |
" Let all numbers default to decimal (for Ctrl-a and Ctrl-x) | |
set nrformats-=octal | |
" Make search case insensitive | |
set hlsearch | |
set incsearch | |
set ignorecase | |
set smartcase | |
" Disable stupid backup and swap files - they trigger too many events | |
" for file system watchers | |
set nobackup | |
set nowritebackup | |
set noswapfile | |
" Set encoding for python | |
autocmd BufNewFile,BufRead *.py,*.pyw,*.pxd,*.pyx | |
\ set encoding=utf-8 | |
"" autocmd BufNewFile,BufRead *.py,*.pyw,*.pxd,*.pyx,*.c,*.cpp,*.h,*.hpp,*.java,*.js,*.json | |
"" \ set fileformat=unix | |
" Enable syntax highlighting | |
" You need to reload this file for the change to apply | |
filetype plugin indent on | |
syntax enable | |
let python_highlight_all=1 | |
"" set cinkeys-=0# indentkeys-=0# | |
set autoindent | |
set smartindent | |
"" set cindent | |
set shiftwidth=4 tabstop=4 softtabstop=4 | |
set expandtab | |
set smarttab | |
set shiftround | |
" Disable format options for text and comment | |
"" set formatoptions-=tc | |
" Better copy & paste | |
"" set pastetoggle=<F12> | |
set clipboard=unnamed | |
set clipboard=unnamedplus | |
" Extra stuffs from sensible.vim | |
set wildmenu | |
if !&scrolloff | |
set scrolloff=1 | |
endif | |
if !&sidescrolloff | |
set sidescrolloff=5 | |
endif | |
set display+=lastline | |
" Color scheme | |
" $ mkdir -p ~/.vim/colors && cd ~/.vim/colors | |
" $ wget -O wombat256mod.vim http://www.vim.org/scripts/download_script.php?src_id=13400 | |
set t_Co=256 | |
color wombat256mod | |
if exists('$TMUX') | |
if has('nvim') | |
set termguicolors | |
else | |
set term=screen-256color | |
endif | |
endif | |
set colorcolumn=80 | |
highlight ColorColumn ctermbg=0 | |
" Highlight unwanted spaces | |
highlight ExtraWhitespace ctermbg=red guibg=red | |
match ExtraWhitespace /\s\+$/ | |
autocmd BufWinEnter * match ExtraWhitespace /\s\+$/ | |
autocmd InsertEnter * match ExtraWhitespace /\s\+\%#\@<!$/ | |
autocmd InsertLeave * match ExtraWhitespace /\s\+$/ | |
autocmd BufWinLeave * call clearmatches() |
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
def Settings(**kwargs): | |
return { | |
'flags': [ | |
'-x', | |
'c++', | |
'-Wall', | |
'-Wextra', | |
'-Werror', | |
'-std=c++11', | |
], | |
'interpreter_path': '/usr/bin/python3', | |
} |
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
#!/bin/bash | |
set -ex | |
# Prerequisite | |
sudo apt-get install -y build-essential make cmake cmake-curses-gui git g++ pkg-config | |
sudo apt-get install -y vim curl exuberant-ctags git ack-grep | |
sudo apt-get install -y python3-pip python3-dev python3-testresources | |
if ! python3 -c "import pip, setuptools" > /dev/null 2>&1; then | |
echo "ERROR: cannot find pip or setuptools" | |
exit | |
fi | |
pip3 install -U --user pep8 flake8 pyflakes isort yapf jedi powerline-status | |
mkdir -p ~/.vim/plugin ~/.vim/doc | |
mkdir -p ~/.vim/autoload ~/.vim/bundle ~/.vim/colors | |
# Taglist | |
wget https://www.vim.org/scripts/download_script.php?src_id=19574 -O /tmp/taglist_46.zip | |
cd ~/.vim | |
unzip /tmp/taglist_46.zip | |
chmod a-x doc/*.txt | |
# Color scheme | |
cd ~/.vim/colors | |
wget -O wombat256mod.vim http://www.vim.org/scripts/download_script.php?src_id=13400 | |
# Pathogen for managing plugins | |
wget -O ~/.vim/autoload/pathogen.vim https://raw.githubusercontent.com/tpope/vim-pathogen/master/autoload/pathogen.vim | |
# Powerline as a nicer-looking status bar | |
xset -q | |
mkdir -p ~/.local/share/fonts | |
wget https://github.com/powerline/powerline/raw/develop/font/PowerlineSymbols.otf -O ~/.local/share/fonts/PowerlineSymbols.otf | |
fc-cache -vf ~/.local/share/fonts/ | |
mkdir -p ~/.config/fontconfig/conf.d | |
wget https://github.com/powerline/powerline/raw/develop/font/10-powerline-symbols.conf -O ~/.config/fontconfig/conf.d/10-powerline-symbols.conf | |
mkdir -p ~/.config/powerline | |
cp -r ${HOME}/.local/lib/python3.?/site-packages/powerline/config_files ~/.config/powerline/ | |
cp -r ${HOME}/.local/lib/python3.?/site-packages/powerline/bindings/vim/autoload/* ~/.vim/autoload/ | |
cp -r ${HOME}/.local/lib/python3.?/site-packages/powerline/bindings/vim/plugin/* ~/.vim/plugin/ | |
# Ctrlp for finding files | |
cd ~/.vim/bundle | |
git clone https://github.com/kien/ctrlp.vim.git | |
# jedi-vim | |
cd ~/.vim/bundle | |
git clone --recursive https://github.com/davidhalter/jedi-vim.git | |
# YouCompleteMe for auto completion | |
## sudo apt-get install -y libclang-8-dev | |
## cd ~/.vim/bundle | |
## git clone https://github.com/Valloric/YouCompleteMe.git | |
## cd ~/.vim/bundle/YouCompleteMe | |
## git submodule update --init --recursive | |
## python3 ./install.py --clang-completer --java-completer --system-libclang | |
# Use vim-flake8 for PEP-8 check | |
cd ~/.vim/bundle | |
git clone https://github.com/nvie/vim-flake8.git | |
# Python syntax checking/highlighting | |
cd ~/.vim/bundle | |
git clone https://github.com/vim-syntastic/syntastic.git | |
# File types | |
## mkdir -p ~/.vim/ftplugin | |
## wget -O ~/.vim/ftplugin/python_editing.vim http://www.vim.org/scripts/download_script.php?src_id=5492 | |
# General folding | |
## cd ~/.vim/bundle | |
## git clone https://github.com/vim-scripts/indentpython.vim.git | |
## git clone https://github.com/Konfekt/FastFold.git | |
## git clone https://github.com/tmhedberg/SimpylFold.git | |
# vim-easymotion | |
cd ~/.vim/bundle | |
git clone https://github.com/easymotion/vim-easymotion | |
# vim-unimpaired and repeat | |
cd ~/.vim/bundle | |
git clone https://github.com/tpope/vim-unimpaired.git | |
git clone https://github.com/tpope/vim-repeat.git |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment