My .vimrc

set nocompatible
let mapleader=" "
set loadplugins

filetype plugin indent on
syntax on
au FileType * setlocal formatoptions-=cro

" set encoding
set fenc=utf-8
set fencs=utf-8,cp949,cp932,euc-kr,euc-jp,shift-jis,big5,ucs-2le,latin1
set encoding=utf-8


""""""""""""""""""""""""""""""""""""""""""
" configuration for vundle
""""""""""""""""""""""""""""""""""""""""""
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()

""""""""""""""""""""""""""""""""""""""""""
Plugin 'gmarik/Vundle.vim'
""""""""""""""""""""""""""""""""""""""""""
" None

""""""""""""""""""""""""""""""""""""""""""
" Python autocompletion
" Plugin 'davidhalter/jedi-vim'
Plugin 'ervandew/supertab'
""""""""""""""""""""""""""""""""""""""""""""
" let g:jedi#use_splits_not_buffers = "right"
" let g:jedi#goto_command = ""
" let g:jedi#goto_assignments_command = ""
" let g:jedi#goto_stubs_command = ""
" let g:jedi#goto_definitions_command = ""
" let g:jedi#documentation_command = "K"
" let g:jedi#usages_command = ""
" " 
" let g:jedi#completions_command = "<C-Space>"
" let g:jedi#rename_command = ""

""""""""""""""""""""""""""""""""""""""""""
Plugin 'vim-airline/vim-airline'
Plugin 'vim-airline/vim-airline-themes'
""""""""""""""""""""""""""""""""""""""""""
let g:airline_powerline_fonts = 1
let g:airline_theme='gruvbox'
let g:airline_exclude_preview = 1

let g:airline#extensions#tabline#enabled= 1
let g:airline#extensions#ctrlspace#enabled = 0

let g:airline#extensions#tabline#buffer_nr_show = 0
let g:airline#extensions#tabline#buffer_nr_format = '[%s]'

let g:airline#extensions#tabline#show_tabs = 0
let g:airline#extensions#tabline#show_tab_count = 2
let g:airline#extensions#tabline#tab_nr_type = 2 " tab number
let g:airline#extensions#tabline#ctrlspace_show_tab_nr = 1
"let g:airline#extensions#tabline#formatter = 'unique_tail_improved'
let g:airline#extensions#tabline#formatter = 'unique_tail'

let g:airline#extensions#tabline#left_sep = ''
let g:airline#extensions#tabline#left_alt_sep = '|'
let g:airline#extensions#tabline#right_sep = ''
let g:airline#extensions#tabline#right_alt_sep = '|'

""""""""""""""""""""""""""""""""""""""""""
Plugin 'vim-ctrlspace/vim-ctrlspace'
""""""""""""""""""""""""""""""""""""""""""
let g:CtrlSpaceStatuslineFunction = "airline#extensions#ctrlspace#statusline()"
let g:CtrlSpaceSaveWorkspaceOnExit = 1
let g:CtrlSpaceSaveWorkspaceOnSwitch = 1
let g:CtrlSpaceLoadLastWorkspaceOnStart = 0
" clear no name buffer on startup
"autocmd VimEnter * :CtrlSpace hDq
let g:CtrlSpaceSymbols = { "CS": "CS", "File": "◯", "CTab": "▣", "Tabs": "▢" }


""""""""""""""""""""""""""""""""""""""""""
Plugin 'The-NERD-tree'
""""""""""""""""""""""""""""""""""""""""""
let g:NERDChristmasTree=1
let g:NERDTreeAutoCenter=1
let g:NERDTreeChDirMode=1
let g:NERDTreeHighlightCursorline=1
let g:NERDTreeSortOrder=['\.py$', '\.m$', '\.pyc$', '*']
let g:NERDTreeBookmarksFile = $HOME.'/.vim/NERDTreeBookmarks'
let g:NERDTreeIgnore=['\.vim$', '\~$']
let g:NERDTreeWinSize=40
let g:NERDTreeMinimalUI=1
let g:NERDTreeShowHidden=1
let g:NERDTreeShowLineNumbers=1
let g:NERDTreeQuitOnOpen=1
let g:NERDTreeShowFiles=1
let g:NERDTreeWinPos="left"

""""""""""""""""""""""""""""""""""""""""""
"" Requires vim > 8.1
"Plugin 'Valloric/YouCompleteMe', { 'commit':'d98f896' }
"""""""""""""""""""""""""""""""""""""""""""
"let g:ycm_autoclose_preview_window_after_insertion = 1
"let g:ycm_filetype_whitelist = {
"            \ "sh":1,
"            \ "zsh":1,
"            \ "python":1,
"            \ }
"map <leader>g  :YcmCompleter GoToDefinitionElseDeclaration<CR>

""""""""""""""""""""""""""""""""""""""""""
" Vim Theme
Plugin 'morhetz/gruvbox'
""""""""""""""""""""""""""""""""""""""""""
set background=dark         "[light, dark]
let g:gruvbox_contrast_dark="hard"
let g:gruvbox_italic=0
let g:gruvbox_italicize_comments=1

""""""""""""""""""""""""""""""""""""""""""
Plugin 'vim-scripts/indentpython.vim'
""""""""""""""""""""""""""""""""""""""""""
" None

""""""""""""""""""""""""""""""""""""""""""
Plugin 'tmux-plugins/vim-tmux-focus-events'
""""""""""""""""""""""""""""""""""""""""""
au FocusGained,BufEnter * :checktime " this is not the option for the plugin. Refer here: https://vi.stackexchange.com/questions/444/how-do-i-reload-the-current-file/13092#13092


""""""""""""""""""""""""""""""""""""""""""
"Plugin 'vim-syntastic/syntastic'
"""""""""""""""""""""""""""""""""""""""""""
"set statusline+=%#warningmsg#
"set statusline+=%{SyntasticStatuslineFlag()}
"set statusline+=%*
"let g:syntastic_always_populate_loc_list = 1
"let g:syntastic_loc_list_height = 5
"let g:syntastic_auto_loc_list = 0
"let g:syntastic_check_on_open = 1
"let g:syntastic_check_on_wq = 0
"let g:syntastic_error_symbol = '❌'
"let g:syntastic_quiet_messages = { "type": "style" }
"let g:syntastic_style_error_symbol = '⚠️'
"let g:syntastic_warning_symbol = '⁉️'
"let g:syntastic_style_warning_symbol = '💩'
"let g:syntastic_python_pylint_post_args="--max-line-length=120"
"highlight link SyntasticErrorSign SignColumn
"highlight link SyntasticWarningSign SignColumn
"highlight link SyntasticStyleErrorSign SignColumn
"highlight link SyntasticStyleWarningSign SignColumn
"""""""""""""""""""""""""""""""""""""""""""
"Plugin 'nvie/vim-flake8'
""""""""""""""""""""""""""""""""""""""""""""
"let g:flake8_show_in_gutter=1
"let g:flake8_show_in_file=1
"let g:flake8_quickfix_height=3

call vundle#end()
filetype plugin indent on

""""""""""""""""""""""""""""""""""""""""""
" Appearance
""""""""""""""""""""""""""""""""""""""""""
set t_Co=256
"colorscheme wombat256mod
colorscheme gruvbox

""""""""""""""""""""""""""""""""""""""""""
" UI
""""""""""""""""""""""""""""""""""""""""""
set cursorcolumn                           " highlight the current column
set cursorline                             " highlight current line
set incsearch                              " BUT do highlight as you type you search phrase
set laststatus=2                           " always show the status line
set lazyredraw                             " do not redraw while running macros
set linespace=0                            " don't insert any extra pixel line betweens rows
"set list                                  " we do what to show tabs, to ensure we get them out of my files
"set listchars=tab:>-,trail:.,extends:>    " show tabs and trailing
set showtabline=2 "2
set matchtime=5                            " how many tenths of a second to blink matching brackets for
set hlsearch                               " do not highlight searched for phrases
set nostartofline                          " leave my cursor where it was
set novisualbell                           " don't blink
set noerrorbells                           " don't beep
set number                                 " turn on line numbers
set numberwidth=5                          " We are good up to 99999 lines
set report=0                               " tell us when anything is changed via :...
set ruler                                  " Always show current positions along the bottom
set scrolloff=10                           " Keep 10 lines (top/bottom) for scope
set shortmess=aOstT                        " shortens messages to avoid 'press a key' prompt
set showcmd                                " show the command being typed
set showmatch                              " show matching brackets
set sidescrolloff=10
set statusline+=%#warningmsg#
set statusline+=%*

""""""""""""""""""""""""""""""""""""""""""
" Smart Setting
""""""""""""""""""""""""""""""""""""""""""
set backspace=indent,eol,start             " allow backspacing over indention, line breaks and insertion start.
"set dir=~/.cache/vim            " Directory to store swap files.
set history=9999                           " Increase the undo limit.
set smartindent
set autoindent
set copyindent
set cindent
set nobackup
set mouse=a
set autoread
"set completeopt=                          " don't use a pop up menu for completions
set expandtab                              " no real tabs please!
set formatoptions-=cro                     " Automatically insert comment leader on return, and let gq format comments
set ignorecase                            " case insensitive by default
"set infercase                              " case inferred by default
set nowrap                                 " do not wrap line
"set wrap                                 " wrap line
set shiftround                             " when at 3 spaces, and I hit > ... go to 4, not 5
set smartcase                              " if there are caps, go case-sensitive
set shiftwidth=4                           " auto-indent amount when using cindent, >>, << and stuff like that
set softtabstop=4                          " when hitting tab or backspace, how many spaces should a tab be (see expandtab)
set tabstop=4                              " real tabs should be 8, and they will show with set list on
set ww=h,l,b                               " move the cursor left/right to move to the previous/next line when the cursor is on the first/last character in the line
set sol                                    " when moving cursor(ex:<C-d>), move the cursor to the start of line
set wmh=0                                  " minium hegith of window
set title                                  " change name of terminal
set pastetoggle=<leader>p                  " toggle vim into past mode
set noto ttimeout
set ttyfast                                " fast keyboard
set timeout timeoutlen=5000 ttimeoutlen=0  " fast keyboard
set clipboard=unnamedplus
set fillchars+=vert:│                      " vertical split char

""""""""""""""""""""""""""""""""""""""""""
" Python Specific Setting
""""""""""""""""""""""""""""""""""""""""""
let python_highlight_all=1

""""""""""""""""""""""""""""""""""""""""""
" Tab/Window/Buffer Setting
""""""""""""""""""""""""""""""""""""""""""
"" Buffer setting
set hidden
" To open a new empty buffer
" This replaces :tabnew which I used to bind to this mapping
nnoremap <leader>T :enew<cr>

" CTRLSPACE
"nnoremap <silent><C-j> :CtrlSpaceGoDown<cr>
nnoremap <silent><C-j> :bp<cr>
" next buffer
"nnoremap <silent><C-k> :CtrlSpaceGoUp<cr>
nnoremap <silent><C-k> :bn<cr>
" quit buffer and move to prev buffer
nnoremap <silent><C-w> :bp<BAR>bd #<cr>
" list buffer
nnoremap <leader>bl :ls<cr>

"" Window setting
nnoremap <silent><leader>h <C-w>h
nnoremap <silent><leader>j <C-w>j
nnoremap <silent><leader>k <C-w>k
nnoremap <silent><leader>l <C-w>l

"" Tab setting
" prev tab
nnoremap <silent><C-h> gT<cr>
" next tab
nnoremap <silent><C-l> gt<cr>


""""""""""""""""""""""""""""""""""""""""""
" MAPPINGS
""""""""""""""""""""""""""""""""""""""""""
inoremap jj <Esc>
nnoremap <leader>r :so ~/.vimrc<CR>

" Toggle NERDTree
nmap <leader>n :NERDTreeToggle<CR>
nnoremap <silent><leader>/ :nohlsearch<Bar>:echo<CR>

" remove trailing white space
nnoremap <F5> :let _s=@/<Bar>:%s/\s\+$//e<Bar>:let @/=_s<Bar><CR>

" prevent search jump
nnoremap * *``

" Apply macros with Q
" This mapping makes macros even easier to remember:
"   hit qq to record, q to stop recording, and Q to apply.
nnoremap Q @q
nnoremap <silent> Q :norm @q<cr>

"" ctrl-space pluginp
" fuzzy searh files
let g:CtrlSpaceDefaultMappingKey = "<space>w"
nnoremap <silent><C-p> :CtrlSpace or/<CR>
" rename tab
nnoremap <silent><leader>tn :CtrlSpaceTabLabel<cr> :CtrlSpace q<cr>
" close workspace and open new
"nnoremap <leader>wn :CtrlSpaceSaveWorkspace<cr> :CtrlSpaceNewWorkspace<cr> :CtrlSpace w<cr>
"nnoremap <leader>n :CtrlSpaceNewWorkspace<cr> :CtrlSpace w<cr>

" close workspace (and save) and quit
nnoremap <silent><leader>sq :CtrlSpaceSaveWorkspace<cr> :CtrlSpaceNewWorkspace<cr> :q<cr>
nnoremap <silent><leader>q :CtrlSpace Q<cr>
" delete noname buffers
nnoremap <silent><leader>bdn :CtrlSpace hDq<cr>
" Open fuzzsy file browser
nnoremap <silent><leader>O :CtrlSpace or/<cr>

Tags: ,

Categories:

Updated: