Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
- " => General
- set nocompatible
- filetype off
- set rtp+=~/.vim/bundle/vundle/
- call vundle#rc()
- filetype plugin indent on
- Bundle 'Igorjan94/codeforces.vim'
- Bundle 'vim-scripts/dbext.vim'
- Bundle 'kien/ctrlp.vim'
- Bundle 'Shougo/vimproc.vim'
- Bundle 'majutsushi/tagbar'
- Bundle 'Valloric/YouCompleteMe'
- Bundle 'scrooloose/syntastic'
- Bundle 'travitch/hasksyn' "*
- Bundle 'tpope/vim-surround' "*
- Bundle 'gmarik/vundle'
- Bundle 'vim-scripts/a.vim' "*
- Bundle 'scrooloose/nerdcommenter' "*
- Bundle 'scrooloose/nerdtree'
- Bundle 'eagletmt/neco-ghc' "*
- Bundle 'eagletmt/ghcmod-vim' "*
- Bundle 'mbbill/undotree'
- Bundle 'bling/vim-airline'
- Bundle 'tpope/vim-fugitive' "*
- Bundle 'Lokaltog/vim-easymotion'
- Bundle 'altercation/vim-colors-solarized'
- Bundle 'dhruvasagar/vim-table-mode' "*
- Bundle 'Twinside/vim-haskellConceal' "*
- Bundle 'Twinside/vim-hoogle' "*
- Bundle 'mattn/gist-vim' "*
- Bundle 'mattn/webapi-vim' "*
- Bundle 'bitc/lushtags' "*
- Bundle 'itchyny/calendar.vim'
- Bundle 'itchyny/thumbnail.vim' "*
- Bundle 'xuhdev/vim-latex-live-preview' "*
- Bundle 'LaTeX-Box-Team/LaTeX-Box' "*
- Bundle 'junegunn/vim-easy-align'
- Bundle 'airblade/vim-gitgutter'
- Bundle 'takac/vim-hardtime' "*
- Bundle 'vim-scripts/Tabmerge' "*
- Bundle 'powerman/vim-plugin-ruscmd'
- Bundle 'kien/rainbow_parentheses.vim'
- Bundle 'wting/rust.vim' "*
- Bundle 'idris-hackers/idris-vim'
- set nocp
- filetype plugin on
- set history=700
- set confirm
- set cindent
- "TODO disable in vimrc
- "for p in ["syntastic", "YouCompleteMe", "tagbar", "taglist", "vimproc", 'vimshell'] | exec 'set rtp+=~/.nix-profile/vim-plugins/'.p | endfor
- " Enable filetype plugins
- filetype plugin on
- filetype indent on
- "filetype on
- autocmd FileType * setlocal formatoptions-=c formatoptions-=r formatoptions-=o
- command WQ wq
- command Wq wq
- command W w
- command Q q
- autocmd vimenter * cd %:p:h
- set nocompatible
- set hidden
- filetype indent plugin on | syn on
- " Start interactive EasyAlign in visual mode
- vmap <Enter> <Plug>(EasyAlign)
- nmap s <Plug>(easymotion-s2)
- map / <Plug>(easymotion-sn)
- omap / <Plug>(easymotion-tn)
- map n <Plug>(easymotion-next)
- map N <Plug>(easymotion-prev)
- let g:calendar_google_calendar = 1
- let g:calendar_google_task = 1
- let g:gist_clip_command = 'xclip -selection clipboard'
- let g:gist_detect_filetype = 1
- let g:gist_use_password_in_gitconfig = 1
- let NERDTreeShowHidden=1
- let NERDTreeQuitOnOpen=1
- let g:necoghc_enable_detailed_browse = 1
- au VimEnter * RainbowParenthesesToggle
- au Syntax * RainbowParenthesesLoadRound
- au Syntax * RainbowParenthesesLoadSquare
- au Syntax * RainbowParenthesesLoadBraces
- let g:airline#extensions#syntastic#enabled = 1
- let g:airline_theme='dark'
- let g:airline_left_sep = '▶'
- let g:airline_right_sep = '◀'
- let g:airline_detect_modified=1
- let g:airline_detect_paste=1
- " How many lines should be searched for context
- let g:hasksyn_indent_search_backward = 100
- " Should we try to de-indent after a return
- let g:hasksyn_dedent_after_return = 1
- " Should we try to de-indent after a catchall case in a case .. of
- let g:hasksyn_dedent_after_catchall_case = 1
- let tagbar_autofocus=1
- let tagbar_autoclose=1
- let g:EclimCompletionMethod = 'omnifunc'
- let g:ycm_server_keep_logfiles = 1
- let g:ycm_server_log_level = 'debug'
- let g:ycm_path_to_python_interpreter = '/usr/bin/python2'
- let g:ycm_global_ycm_extra_conf = '~/.vim/bundle/YouCompleteMe/third_party/ycmd/cpp/ycm/.ycm_extra_conf.py'
- "autocmd FileType c let g:ycm_global_ycm_extra_conf = '~/.vim/bundle/YouCompleteMe/c/.ycm_extra_conf.py'
- let g:ycm_semantic_triggers = {
- \ 'c' : ['->', '.'],
- \ 'cpp' : ['->', '.', '::'],
- \ 'objc' : ['->', '.'],
- \ 'ocaml' : ['.', '#'],
- \ 'cpp,objcpp' : ['->', '.', '::'],
- \ 'perl' : ['->'],
- \ 'php' : ['->', '::'],
- \ 'cs,java,javascript,d,vim,python,perl6,scala,vb,elixir,go' : ['.'],
- \ 'ruby' : ['.', '::'],
- \ 'lua' : ['.', ':'],
- \ 'erlang' : [':'],
- \ }
- "set listchars=tab:
- "set list
- set fencs=utf-8,cp1251,koi8-r,ucs-2,cp866
- au FileType qf call AdjustWindowHeight(3, 10)
- function! AdjustWindowHeight(minheight, maxheight)
- exe max([min([line("$")+1, a:maxheight]), a:minheight]) . "wincmd _"
- endfunction
- " Set Russian key to understand
- "set keymap=russian-cukenwin
- set iminsert=0
- set imsearch=0
- imap <F10> <Esc>:TagbarToggle<CR>
- nmap <F10> <Esc>:TagbarToggle<CR>
- imap <F11> <Esc>:NERDTreeToggle<CR>
- nmap <F11> <Esc>:NERDTreeToggle<CR>
- " Num strings
- set nu!
- set ai!
- set cin!
- imap <C-S-v> <S-Insert>
- " Set to auto read when a file is changed from the outside
- set autoread
- " With a map leader it's possible to do extra key combinations
- " like <leader>w saves the current file
- let mapleader = ","
- let g:mapleader = ","
- set viminfo='10,\"100,:20,%,n~/.viminfo
- au BufReadPost * if line("'\"") > 0|if line("'\"") <= line("$")|exe("norm '\"")|else|exe "norm
- $"|endif|endif
- map <leader>Q :let @+ = system("pastebinit " . " -f " . &filetype . " " . expand("%"))<CR>
- " Fast saving
- "map <C-E> <Esc>:tabedit %<.h<CR>
- vnoremap p "_dP
- nnoremap <C-u> :UndotreeToggle<CR>
- imap <F5> <Esc> :tabprev<CR>
- nmap <leader>w :w!<cr>
- map <F2> <Esc>:w !sudo tee %<CR>
- imap <F2> <Esc>:w<CR>
- imap <F5> <Esc> :tabprev<CR>
- map <F5> :tabprev<CR>
- imap <F6> <Esc> :tabnext<CR>
- map <F6> :tabnext <CR>
- function! GAC()
- call inputsave()
- let commit = input('Commit message: ')
- call inputrestore()
- let aaa = system("git add " . expand("%") . " && git commit -m \"" . commit . "\"")
- echom aaa
- endfunction
- let Tlist_Exit_OnlyWindow = 1
- " put from clipboard
- nmap <leader>p "+p
- map cn <ESC>:cn<CR>
- map cb <ESC>:cp<CR>
- " yank to clipboard
- map <leader>y "+y
- map <leader>y "+y
- set wildmenu
- set wcm=<Tab>
- menu Exit.quit :quit<CR>
- menu Exit.quit! :quit!<CR>
- menu Exit.save :exit<CR>
- map <F3> :emenu Exit.<Tab>
- function! InsertTabWrapper(direction)
- let col = col('.') - 1
- if !col || getline('.')[col - 1] !~ '\k'
- return "\<tab>"
- elseif "backward" == a:direction
- return "\<c-p>"
- else
- return "\<c-n>"
- endif
- endfunction
- inoremap <tab> <c-r>=InsertTabWrapper ("forward")<cr>
- inoremap <s-tab> <c-r>=InsertTabWrapper ("backward")<cr>
- """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
- " => VIM user interface
- """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
- " Set 7 lines to the cursor - when moving vertically using j/k
- set so=7
- " Turn on the WiLd menu
- set wildmenu
- " Ignore compiled files
- set wildignore=*.o,*~,*.pyc
- "Always show current position
- set ruler
- " Height of the command bar
- set cmdheight=1
- " A buffer becomes hidden when it is abandoned
- set hid
- " Configure backspace so it acts as it should act
- set backspace=eol,start,indent
- set whichwrap+=<,>,h,l
- " Ignore case when searching
- set ignorecase
- " When searching try to be smart about cases
- set smartcase
- " Highlight search results
- set hlsearch
- " Makes search act like search in modern browsers
- set incsearch
- " Don't redraw while executing macros (good performance config)
- set lazyredraw
- " For regular expressions turn magic on
- set magic
- " Show matching brackets when text indicator is over them
- set showmatch
- " How many tenths of a second to blink when matching brackets
- set mat=2
- " No annoying sound on errors
- set noerrorbells
- set novisualbell
- set t_vb=
- set tm=500
- """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
- " => Colors and Fonts
- """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
- " Enable syntax highlighting
- syntax enable
- let g:solarized_termcolors=256
- colorscheme solarized "desert
- "colorscheme torte
- set background=dark
- " Set extra options when running in GUI mode
- if exists('$WINDOWID')
- set t_Co=256
- endif
- if has("gui_running")
- set guioptions-=T
- set guioptions+=e
- set guitablabel=%M\ %t
- endif
- " Set utf8 as standard encoding and en_US as the standard language
- set encoding=utf8
- " Use Unix as the standard file type
- set ffs=unix,dos,mac
- """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
- " => Files, backups and undo
- """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
- " Turn backup off, since most stuff is in SVN, git et.c anyway...
- set nobackup
- set nowb
- set noswapfile
- """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
- " => Text, tab and indent related
- """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
- " Use spaces instead of tabs
- set expandtab
- " Be smart when using tabs ;)
- set smarttab
- " 1 tab == 4 spaces
- set shiftwidth=4
- set tabstop=4
- set shiftround "Round spaces to nearest shiftwidth multiple
- set nojoinspaces "Don't convert spaces to tabs
- " Linebreak on 500 characters
- set lbr
- set tw=500
- set ai "Auto indent
- set si "Smart indent
- set wrap "Wrap lines
- """"""""""""""""""""""""""""""
- " => Visual mode related
- """"""""""""""""""""""""""""""
- " Visual mode pressing * or # searches for the current selection
- " Super useful! From an idea by Michael Naumann
- vnoremap <silent> * :call VisualSelection('f')<CR>
- vnoremap <silent> # :call VisualSelection('b')<CR>
- """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
- " => Moving around, tabs, windows and buffers
- """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
- " Treat long lines as break lines (useful when moving around in them)
- map j gj
- map k gk
- " Map <Space> to / (search) and Ctrl-<Space> to ? (backwards search)
- map <space> /
- map <leader><space> <ESC>:%s/
- " Disable highlight when <leader><cr> is pressed
- map <silent> <leader><cr> :noh<cr>
- " Smart way to move between windows
- map <C-j> <C-W>j
- map <C-k> <C-W>k
- map <C-h> <C-W>h
- map <C-l> <C-W>l
- " Close the current buffer
- map <leader>bd :Bclose<cr>
- " Close all the buffers
- map <leader>ba :1,1000 bd!<cr>
- " Useful mappings for managing tabs
- map <leader>tn :tabnew<cr>
- map <leader>to :tabonly<cr>
- map <leader>tc :tabclose<cr>
- map <leader>tm :tabmove
- " Opens a new tab with the current buffer's path
- " Super useful when editing files in the same directory
- map <leader>te :tabedit <c-r>=expand("%:p:h")<cr>/
- " Switch CWD to the directory of the open buffer
- map <leader>cd :cd %:p:h<cr>:pwd<cr>
- " Specify the behavior when switching between buffers
- try
- set switchbuf=useopen,usetab,newtab
- set stal=2
- catch
- endtry
- " Return to last edit position when opening files (You want this!)
- """"""""""""""""""""""""""""""
- " => Status line
- """"""""""""""""""""""""""""""
- " Always show the status line
- set laststatus=2
- " Format the status line
- set statusline=\ %{HasPaste()}%F%m%r%h\ %w\ \ CWD:\ %r%{getcwd()}%h\ \ \ Line:\ %l
- """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
- " => Editing mappings
- """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
- " Remap VIM 0 to first non-blank character
- map 0 ^
- " Delete trailing white space on save, useful for Python and CoffeeScript ;)
- func! DeleteTrailingWS()
- exe "normal mz"
- %s/\s\+$//ge
- exe "normal `z"
- endfunc
- autocmd BufWrite *.py :call DeleteTrailingWS()
- autocmd BufWrite *.coffee :call DeleteTrailingWS()
- " Toggle paste mode on and off
- map <leader>v :setlocal paste!<cr>
- """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
- " => Helper functions
- """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
- function! CmdLine(str)
- exe "menu Foo.Bar :" . a:str
- emenu Foo.Bar
- unmenu Foo
- endfunction
- " Returns true if paste mode is enabled
- function! HasPaste()
- if &paste
- return 'PASTE MODE '
- en
- return ''
- endfunction
- set langmap=ёйцукенгшщзхъфывапролджэячсмитьбюЁЙЦУКЕHГШЩЗХЪФЫВАПРОЛДЖЭЯЧСМИТЬБЮ;`qwertyuiop[]asdfghjkl\\;'zxcvbnm\\,.~QWERTYUIOP{}ASDFGHJKL:\\"ZXCVBNM<>
- set relativenumber
- vnoremap <C-r> "hy:%s/<C-r>h//gc<left><left><left>
- "set list
- "set listchars=tab:▸\ ,eol:¬
- " set cursorline
- set undofile
- autocmd FileType cpp call CppMake()
- function! CppMake()
- if filereadable("Makefile")
- set makeprg=make\ -s
- else
- if filereadable("makefile")
- set makeprg=make\ -s
- else
- set makeprg=clang++\ -O2\ -std=c++11\ -o\ %<\ %
- endif
- endif
- endfunction
- autocmd FileType java set makeprg=javac\ %
- autocmd FileType haskell set makeprg=ghc\ -o\ %<\ %
- nmap <F8> <ESC>:w<CR><ESC>:!./%<CR>
- imap <F8> <ESC>:w<CR><ESC>:!./%<CR>
- autocmd FileType cpp nmap <F8> <ESC>:w<CR><ESC>:!./%<<CR>
- autocmd FileType cpp imap <F8> <ESC>:w<CR><ESC>:!./%<<CR>
- autocmd FileType java nmap <F8> <ESC>:w<CR><ESC>:!java %<<CR>
- autocmd FileType java imap <F8> <ESC>:w<CR><ESC>:!java %<<CR>
- autocmd FileType haskell nmap <F8> <ESC>:w<CR><ESC>:!./%<<CR>
- autocmd FileType haskell imap <F8> <ESC>:w<CR><ESC>:!./%<<CR>
- autocmd FileType python nmap <F8> <ESC>:w<CR><ESC>:!python3 %<CR>
- autocmd FileType python imap <F8> <ESC>:w<CR><ESC>:!python3 %<CR>
- autocmd FileType cpp noremap <C-F9> <ESC>:w<CR><ESC>:make<CR>
- autocmd FileType java noremap <C-F9> <ESC>:w<CR><ESC>:make<CR>
- autocmd FileType python imap <F9> <ESC>:w<CR><ESC>:!python3 %<CR>
- autocmd FileType perl imap <F9> <ESC>:w<CR><ESC>:!perl %<CR>
- autocmd FileType java imap <F9> <ESC>:w<CR><ESC>:make<CR><ESC>:!java %<<CR>
- autocmd FileType cpp imap <F9> <ESC>:w<CR><ESC>:make<CR><ESC>:!./%<<CR>
- autocmd FileType c imap <F9> <ESC>:w<CR><ESC>:!clang % -o %<<CR><ESC>:!./%<<CR>
- autocmd FileType haskell imap <F9> <ESC>:w<CR><ESC>:make<CR><ESC>:!./%<<CR>
- autocmd FileType python nmap <F9> <ESC>:w<CR><ESC>:!python3 %<CR>
- autocmd FileType perl nmap <F9> <ESC>:w<CR><ESC>:!perl %<CR>
- autocmd FileType java nmap <F9> <ESC>:w<CR><ESC>:make<CR><ESC>:!java %<<CR>
- autocmd FileType cpp nmap <F9> <ESC>:w<CR><ESC>:make<CR><ESC>:!./%<<CR>
- autocmd FileType c nmap <F9> <ESC>:w<CR><ESC>:!clang % -o %<<CR><ESC>:!./%<<CR>
- autocmd FileType haskell nmap <F9> <ESC>:w<CR><ESC>:make<CR><ESC>:!./%<<CR>
- autocmd FileType cpp imap <F7> <ESC>:w<CR>:!clang++ -std=c++11 -E %<CR>
- autocmd FileType cpp nmap <F7> <ESC>:w<CR>:!clang++ -std=c++11 -E %<CR>
- autocmd FileType cpp imap <C-f> <Esc>:w<CR><Esc>:%!astyle --mode=c --style=allman --indent=spaces=4 --indent-namespaces --break-blocks --align-pointer=middle --align-reference=type --suffix=none<CR><CR>
- autocmd FileType java imap <C-f> <Esc>:w<CR><Esc>:%!astyle --mode=c --style=allman --indent=spaces=4 --indent-namespaces --break-blocks --align-pointer=middle --align-reference=type --suffix=none<CR><CR>
- autocmd BufRead *.hs imap <C-f> <Esc>:w<CR><Esc>:%!stylish-haskell<CR><CR>
- autocmd FileType cpp nmap <C-f> <Esc>:w<CR><Esc>:%!astyle --mode=c --style=allman --indent=spaces=4 --indent-namespaces --break-blocks --align-pointer=middle --align-reference=type --suffix=none<CR><CR>
- autocmd FileType java nmap <C-f> <Esc>:w<CR><Esc>:%!astyle --mode=c --style=allman --indent=spaces=4 --indent-namespaces --break-blocks --align-pointer=middle --align-reference=type --suffix=none<CR><CR>
- autocmd BufRead *.hs nmap <C-f> <Esc>:w<CR><Esc>:%!stylish-haskell<CR><CR>
- " Ctrl-Space for completions. Heck Yeah!
- inoremap <expr> <C-Space> pumvisible() \|\| &omnifunc == '' ?
- \ "\<lt>C-n>" :
- \ "\<lt>C-x>\<lt>C-o><c-r>=pumvisible() ?" .
- \ "\"\\<lt>c-n>\\<lt>c-p>\\<lt>c-n>\" :" .
- \ "\" \\<lt>bs>\\<lt>C-n>\"\<CR>"
- imap <C-@> <C-Space>
- let g:ycm_autoclose_preview_window_after_insertion = 1
- let g:ycm_complete_in_comments = 1
- let g:ycm_goto_buffer_command = 'new-tab'
- let g:ctrlp_map = '<c-p>'
- let g:ctrlp_cmd = 'CtrlP'
- let g:EclimJavaSearchSingleResult = 'tabnew'
- let g:undotree_SetFocusWhenToggle = 1
- let g:CodeForcesUsername = 'Igorjan94'
- let g:CodeForcesCount = 40
- let g:CodeForcesContestId = 518
- let g:CodeForcesShowUnofficial = 1
- let g:CodeForcesCommandLoadTask = 'vsplit'
- noremap <leader>vv <ESC>:CodeForces
- autocmd FileType cpp nnoremap <C-E> <ESC>:YcmCompleter GoToDefinitionElseDeclaration<CR>
- autocmd FileType java nnoremap <C-E> <ESC>:JavaSearch<CR>
- set timeoutlen=2000
- imap <leader>{ {<CR><CR>}<ESC>k$i
- imap <leader>re readln();<ESC>hi
- imap <leader>wr writeln();<ESC>hi
- imap <leader>S System.out.println();<ESC>hi
- imap <leader>esc <ESC>
- imap <leader>str struct<CR>{<CR><TAB><CR>};<ESC>k$i
- imap <leader>v vector<
- imap <leader>wh whole(
- imap <leader>el elohw(
- imap <leader>mne min_element(
- imap <leader>mxe max_element(
- imap <leader>b begin(),
- imap <leader>en end(),
- imap <leader>f first
- imap <leader>s second
- imap <leader>we writeln_range(
- imap <leader>[] []()<CR>{<CR>return<CR>};<ESC>kkk$i
- set foldenable
- set foldmethod=marker
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement