Last active
October 26, 2025 14:27
-
-
Save jkjung-avt/8d09eca6b60c2bdf1065fed417dc2f18 to your computer and use it in GitHub Desktop.
My new .vimrc (2025)
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: https://realpython.com/vim-and-python-a-match-made-in-heaven/ | |
| " | |
| " Installation: | |
| " 1. Download this file and save it to the proper location. | |
| " URL: https://gist.githubusercontent.com/jkjung-avt/8d09eca6b60c2bdf1065fed417dc2f18/raw/661afaa665b5fcc2aab3b935bebca2a8fb6994f0/.vimrc | |
| " Linux: ${HOME}/.vimrc | |
| " Windows: %USERPROFILE%/vimfiles/vimrc (Windows) | |
| " 2. Install Vundle. | |
| " Linux: $ git clone https://github.com/gmarik/Vundle.vim.git ~/.vim/bundle/Vundle.vim | |
| " Windows: $ git clone https://github.com/gmarik/Vundle.vim.git %USERPROFILE%/vimfiles/bundle/Vundle.vim | |
| " 3. Enter vim and do `:PluginInstall`. | |
| " use forward slash to expand file paths/names | |
| filetype off | |
| set shellslash | |
| " set the runtime path to include Vundle and initialize for Linux | |
| set rtp+=~/.vim/bundle/Vundle.vim | |
| call vundle#begin('~/.vim/bundle') | |
| " set the runtime path to include Vundle and initialize for Windows | |
| " set rtp+=~/vimfiles/bundle/Vundle.vim | |
| " call vundle#begin('~/vimfiles/bundle') | |
| " here goes the plugins | |
| Plugin 'gmarik/Vundle.vim' | |
| Plugin 'tmhedberg/SimpylFold' | |
| Plugin 'vim-scripts/indentpython.vim' | |
| Plugin 'vim-syntastic/syntastic' | |
| Plugin 'nvie/vim-flake8' | |
| Plugin 'davidhalter/jedi-vim' | |
| Plugin 'jnurmine/Zenburn' | |
| Plugin 'altercation/vim-colors-solarized' | |
| Plugin 'scrooloose/nerdtree' | |
| Plugin 'kien/ctrlp.vim' | |
| Plugin 'tpope/vim-fugitive' | |
| Plugin 'Lokaltog/powerline', {'rtp': 'powerline/bindings/vim/'} | |
| " finish setting up plugins | |
| call vundle#end() | |
| filetype plugin indent on | |
| " split behavior | |
| set splitbelow | |
| set splitright | |
| " auto-resize splits when vim gets resized | |
| autocmd VimResized * wincmd = | |
| " split navigations | |
| nnoremap <C-j> <C-w><C-j> | |
| nnoremap <C-k> <C-w><C-k> | |
| nnoremap <C-l> <C-w><C-l> | |
| nnoremap <C-h> <C-w><C-h> | |
| nnoremap <C-Down> <C-w><C-j> | |
| nnoremap <C-Up> <C-w><C-k> | |
| nnoremap <C-Left> <C-w><C-l> | |
| nnoremap <C-Right> <C-w><C-h> | |
| " treat visual lines as actual lines when moving around | |
| noremap j gj | |
| noremap k gk | |
| noremap <Down> gj | |
| noremap <Up> gk | |
| inoremap <Down> <C-o>gj | |
| inoremap <Up> <C-o>gk | |
| " navigate quickfix list with ease | |
| nnoremap <silent> <Leader>] :cnext<CR> | |
| nnoremap <silent> <Leader>[ :cprevious<CR> | |
| " enable folding with the spacebar | |
| nnoremap <space> za | |
| " show docstring for folded code (if wanted) | |
| " let g:SimpylFold_docstring_preview=1 | |
| " set encoding and indentation for python and shell scripts | |
| au BufRead,BufNewFile *.py,*.pyx,*pyw,*.sh set tabstop=4 softtabstop=4 shiftwidth=4 | |
| au BufRead,BufNewFile *.py,*.pyx,*pyw,*.sh set expandtab | |
| au BufRead,BufNewFile *.py,*.pyx,*pyw,*.sh set smarttab | |
| au BufRead,BufNewFile *.py,*.pyx,*pyw,*.sh set autoindent | |
| au BufRead,BufNewFile *.py,*.pyx,*pyw,*.sh set smartindent | |
| au BufRead,BufNewFile *.py,*.pyx,*pyw,*.sh set shiftround | |
| " ensure tabs don't get converted to spaces in Makefiles | |
| autocmd FileType make setlocal noexpandtab | |
| " 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() | |
| " enable UTF-8 support | |
| set encoding=utf-8 | |
| " show cursor line only in the active buffer | |
| augroup CursorLine | |
| au! | |
| au VimEnter,WinEnter,BufWinEnter * setlocal cursorline | |
| au WinLeave * setlocal nocursorline | |
| augroup END | |
| highlight CursorLine ctermbg=1 | |
| " turn on syntax highlighting | |
| let g:python_highlight_all=1 | |
| syntax on | |
| " set colorscheme | |
| if has('gui_running') | |
| set background=dark | |
| colorscheme solarized | |
| else | |
| colorscheme zenburn | |
| endif | |
| call togglebg#map("<Leader>b") | |
| " open/close NERDTree | |
| nnoremap <silent> <expr> <Leader>n g:NERDTree.IsOpen() ? " "\:NERDTreeClose<CR>" : bufexists(expand('%')) ? "\:NERDTreeFind<CR>" : " "\:NERDTree<CR>" | |
| " ignore certain failes in NERDTree | |
| " let g:NERDTreeIgnore=['\.pyc$', '\~$'] "ignore files in NERDTree | |
| let g:NERDTreeShowHidden=1 | |
| let g:NERDTreeAutoDeleteBuffer=1 | |
| let g:NERDTreeQuitOnOpen=0 | |
| " map key for CtrlP | |
| let g:ctrlp_map='<C-p>' | |
| let g:ctrlp_cmd='CtrlP' | |
| " show relative line numbers and wrap lines visually | |
| set rnu | |
| set wrap | |
| set sidescroll=5 | |
| set listchars+=precedes:<,extends:> | |
| " use system clipboard | |
| set clipboard=unnamed | |
| " disable stupid backup and swap files | |
| set nobackup | |
| set nowritebackup | |
| set noswapfile | |
| " highlight column 80 | |
| highlight ColorColumn ctermbg=8 | |
| set colorcolumn=80 | |
| " disable wrapping | |
| set textwidth=0 | |
| set wrapmargin=0 | |
| " always show status line | |
| set laststatus=2 | |
| " highlight tabs | |
| set list | |
| set listchars=tab:T> | |
| " enlarge history | |
| set history=1000 | |
| set undolevels=1000 | |
| " Set spell-check language | |
| set spelllang=en | |
| " set spell | |
| " let numbers default to decimal (for Ctrl-a increment and Ctrl-x decrement) | |
| set nrformats-=octal | |
| " make backspaces more powerfull | |
| set backspace=indent,eol,start | |
| " show partial command | |
| set showcmd | |
| " make search case insensitive | |
| set hlsearch | |
| set incsearch | |
| set ignorecase | |
| set smartcase | |
| " allow unsaved file buffers | |
| set hidden | |
| " add file finding path to all recursive subdirectories | |
| set path=.,** |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment