Created
July 29, 2018 09:50
-
-
Save ariunbayar/68751bfe48e1942766ef7c5b7a6b1e20 to your computer and use it in GitHub Desktop.
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
| set nocompatible " be iMproved, required | |
| filetype off " required | |
| let g:airline_powerline_fonts=1 | |
| " set the runtime path to include Vundle and initialize | |
| set rtp+=~/.vim/bundle/Vundle.vim | |
| call vundle#begin() | |
| " alternatively, pass a path where Vundle should install plugins | |
| "call vundle#begin('~/some/path/here') | |
| " let Vundle manage Vundle, required | |
| Plugin 'VundleVim/Vundle.vim' | |
| " The following are examples of different formats supported. | |
| " Keep Plugin commands between vundle#begin/end. | |
| " plugin on GitHub repo | |
| Plugin 'scrooloose/nerdtree' | |
| Plugin 'kien/ctrlp.vim' | |
| Plugin 'tpope/vim-surround' | |
| Plugin 'scrooloose/nerdcommenter' | |
| Plugin 'altercation/vim-colors-solarized' | |
| Plugin 'morhetz/gruvbox' | |
| Plugin 'nathanaelkane/vim-indent-guides' | |
| Plugin 'jistr/vim-nerdtree-tabs' | |
| Plugin 'vim-airline/vim-airline' | |
| Plugin 'vim-airline/vim-airline-themes' | |
| " plugin from http://vim-scripts.org/vim/scripts.html | |
| "Plugin 'L9' | |
| " The sparkup vim script is in a subdirectory of this repo called vim. | |
| " Pass the path to set the runtimepath properly. | |
| "Plugin 'rstacruz/sparkup', {'rtp': 'vim/'} | |
| " All of your Plugins must be added before the following line | |
| call vundle#end() " required | |
| filetype plugin indent on " required | |
| " To ignore plugin indent changes, instead use: | |
| "filetype plugin on | |
| " | |
| " Brief help | |
| " :PluginList - lists configured plugins | |
| " :PluginInstall - installs plugins; append `!` to update or just :PluginUpdate | |
| " :PluginSearch foo - searches for foo; append `!` to refresh local cache | |
| " :PluginClean - confirms removal of unused plugins; append `!` to auto-approve removal | |
| " | |
| " see :h vundle for more details or wiki for FAQ | |
| " Put your non-Plugin stuff after this line | |
| " Your GUI stuff | |
| set number | |
| "set relativenumber | |
| set cursorline | |
| set expandtab | |
| set autoindent | |
| set tabstop=4 | |
| set softtabstop=4 | |
| set shiftwidth=4 | |
| set background=dark | |
| " let g:solarized_contrast = "high" | |
| " colorscheme solarized | |
| let g:gruvbox_contrast_dark ="medium" | |
| let g:gruvbox_contrast_light="medium" | |
| colorscheme gruvbox | |
| set grepprg=ack\ -s\ -H\ --nogroup\ --nocolor\ --column | |
| set grepformat=%f:%l:%c:%m,%f:%l:%m | |
| set list | |
| "set listchars=tab:\â—\ | |
| set listchars=tab:\â–¸\ | |
| " NOTE copy fonts to: /home/user/.local/share/fonts/ | |
| set hlsearch | |
| function! NumberToggle() | |
| "set guifont=Inconsolata\ 11 | |
| if (g:k9_font == "source-code-pro-10") | |
| let g:k9_font="source-code-pro-13" | |
| set guifont=Source\ Code\ Pro\ Semibold\ 13 | |
| elseif (g:k9_font == "source-code-pro-13") | |
| let g:k9_font="source-code-pro-18" | |
| set guifont=Source\ Code\ Pro\ Semibold\ 18 | |
| elseif (g:k9_font == "source-code-pro-18") | |
| let g:k9_font="pragmata-pro-8" | |
| set guifont=PragmataPro\ for\ Powerline\ 8 | |
| elseif (g:k9_font == "pragmata-pro-8") | |
| let g:k9_font="pragmata-pro-10" | |
| set guifont=PragmataPro\ for\ Powerline\ 10 | |
| elseif (g:k9_font == "pragmata-pro-10") | |
| let g:k9_font="pragmata-pro-13" | |
| set guifont=PragmataPro\ for\ Powerline\ 13 | |
| else | |
| let g:k9_font="source-code-pro-10" | |
| set guifont=Source\ Code\ Pro\ Semibold\ 10 | |
| endif | |
| endfunc | |
| let g:k9_font="pragmata-pro-8" | |
| call NumberToggle() | |
| let g:indent_guides_enable_on_vim_startup = 1 | |
| " Miscellaneous | |
| " | |
| set nowrap | |
| set ignorecase " you can also search with /<pattern>\c OR /<pattern>\C | |
| set clipboard=unnamedplus | |
| let mapleader="," | |
| " Highlight trailing 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() | |
| " Store last state like fold and filetype | |
| autocmd BufWinLeave *.* mkview | |
| autocmd BufWinEnter *.* silent loadview | |
| " NERDTree stuff | |
| let NERDTreeIgnore = ['\.pyc$'] | |
| """ Mapping (Shortcuts) | |
| map <leader>a :NERDTreeTabsToggle<CR> | |
| map <leader>e :NERDTreeTabsFind<CR> | |
| " 1. :grep <pattern>, 2. Ctrl+L or Ctrl+H | |
| nnoremap <silent> <C-L> :cn<CR>zz | |
| nnoremap <silent> <C-H> :cp<CR>zz | |
| " TODO rename the function name | |
| nnoremap <C-Y> :call NumberToggle()<cr> | |
| nmap <silent> <C-S-PageUp> :tabm -1<CR> | |
| nmap <silent> <C-S-PageDown> :tabm +1<CR> | |
| nnoremap <C-K> :call search('^'. matchstr(getline('.'), '\(^\s*\)') .'\%<' . line('.') . 'l\S', 'be')<CR> | |
| nnoremap <C-J> :call search('^'. matchstr(getline('.'), '\(^\s*\)') .'\%>' . line('.') . 'l\S', 'e')<CR> | |
| " Open a new tab in Vim | |
| nnoremap <silent> <C-S-T> :tabnew<CR> | |
| """ Auto completion | |
| inoremap <C-K> <C-R>=CtrlK()<CR> | |
| function! CtrlK() | |
| let line = getline('.') " current line | |
| let text = substitute(line, '^\s*\(.\{-}\)\s*$', '\1', '') " last of the line | |
| let bs = repeat("\<Backspace>", len(text)) | |
| " | |
| " HTMLDjango for Django and Flask templates | |
| " | |
| if (&filetype == "htmldjango") | |
| if (text == "{%") | |
| return bs . "{% %}" . repeat("\<Left>", 3) | |
| endif | |
| if (text == "{{") | |
| return bs . "{{ }}" . repeat("\<Left>", 3) | |
| endif | |
| if (text == "if") | |
| return bs . "{% if %}" . "\<CR>\<CR>{% endif %}" . "\<Up>\<Up>" . repeat("\<Left>", 3) | |
| endif | |
| if (text == "for") | |
| return bs . "{% for %}" . "\<CR>\<CR>{% endfor %}" . "\<Up>\<Up>" . repeat("\<Left>", 3) | |
| endif | |
| if (text == "comment") | |
| return bs . "{% comment %}" . "\<CR>{% endcomment %}" | |
| endif | |
| endif | |
| " HTML and HTMLDjango | |
| " | |
| " | |
| if (&filetype == "htmldjango" || &filetype == "html") | |
| if (text == "table") | |
| let rval = bs . "<table>" | |
| let rval = rval . "\<CR><thead>\<CR><tr>\<CR><th></th>\<CR><th></th>\<CR>\<Backspace></tr>\<CR>\<Backspace></thead>" | |
| let rval = rval . "\<CR><tbody>\<CR>\<Tab><tr>\<CR><td></td>\<CR><td></td>\<CR>\<Backspace></tr>\<CR>\<Backspace></tbody>\<CR>\<Backspace>" | |
| let rval = rval . "</table>" | |
| let rval = rval . repeat("\<Up>", 10) . repeat("\<Right>", 8) | |
| return rval | |
| endif | |
| " TODO ul tag | |
| endif | |
| " | |
| " Python | |
| " | |
| if (&filetype == "python") | |
| if (text == "pprint") | |
| return bs . "import pprint; pprint.pprint()" . "\<Left>" | |
| endif | |
| if (text == "pdb") | |
| return bs . "import pdb; pdb.set_trace()" | |
| endif | |
| endif | |
| " | |
| " Javascript | |
| " | |
| if (&filetype == "javascript") | |
| if (text == "cl") | |
| return bs . "console.log();" . repeat("\<Left>", 2) | |
| endif | |
| if (text == "for") | |
| return bs . "for (var i=0; i<; i++) {\<CR>\<CR>}" . repeat("\<Up>", 2) . repeat("\<Right>", 15) | |
| endif | |
| if (text == "if") | |
| return bs . "if () {\<CR>\<CR>}" . repeat("\<Up>", 2) . repeat("\<Right>", 3) | |
| endif | |
| if (text == "fn") | |
| return bs . "function () {\<CR>\<CR>}" . repeat("\<Up>", 2) . repeat("\<Right>", 8) | |
| endif | |
| endif | |
| endfunction |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment