Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- " let g:livepreview_previewer = 'evince'
- " YCM {
- set nocompatible
- filetype off
- set rtp+=~/.vim/bundle/Vundle.vim
- call vundle#begin()
- Plugin 'VundleVim/Vundle.vim'
- Plugin 'Valloric/YouCompleteMe'
- call vundle#end()
- set omnifunc=syntaxcomplete#Complete
- autocmd BufEnter * sign define dummy
- autocmd BufEnter * execute 'sign place 9999 line=1 name=dummy buffer=' . bufnr('')
- set splitbelow
- let g:ycm_global_ycm_extra_conf = '~/.vim/ycm_extra_conf.py'
- let g:ycm_autoclose_preview_window_after_completion = 1
- let g:jedi#popup_on_dot = 1
- let g:EclimCompletionMethod = 'omnifunc'
- filetype plugin indent on
- " }
- " Main configuration {
- syntax on
- set ai "autoindent
- set si "smartindent
- set nu "number
- set et "expandtab
- set ts=2 "tabstop
- set sts=2 "softtabstop
- set sw=2 "shiftwidth
- set cinw+=forn,forab,ford "cinwords
- au FileType c,cpp,h,hpp set cin
- set tm=300 "timeoutlen
- set spr "splitright
- " }
- autocmd BufRead,BufNewFile *.in setfiletype text
- " Mappings {
- " map <f4> :!geany %<cr>
- map <f4> :w<Enter>:!xclip -i -sel clip < %<Enter><Enter>
- map <c-j> 5j
- map <c-k> 5k
- imap jj <esc>
- imap jk <esc>:w<cr>
- " imap kj <esc>:w<cr>
- map H ^
- map L $
- imap {<cr> {<cr>}<esc>O
- " map gc I//<esc>
- " map gu ^xx
- " }
- " Compile & run {
- let $CXXFLAGS = "-O2 -std=c++14 -DLOCAL -Wall -Wextra -Wno-char-subscripts -Wno-unused-result"
- map <F9> :w<Enter>:make! %:r<Enter>
- imap <F9> <Esc>:w<Enter>:make! %:r<Enter>
- " au BufEnter *.c,*.cpp,*.h,*.hpp map <f5> :!./%<<cr>
- " au BufEnter *.py map <f5> :w<Enter>:!python3 %<Enter>
- " au BufEnter *.java map <f5> :Java %<cr>
- " au BufEnter *.lua map <f5> :!lua %<cr>
- "
- " func! Compile()
- " :w<Enter>
- " if &filetype == "java"
- " :!javac %
- " else
- " :make! %:r
- " endif
- " endf
- " map <F9> :call Compile()<Enter>
- func! Run()
- :w
- if &filetype == "python"
- :!python3 %
- elseif &filetype == "text"
- write
- wincmd w
- call Run()
- wincmd w
- elseif &filetype == "java"
- :!java %<
- else
- :!./%<
- endif
- endf
- map <F5> :call Run()<Enter>
- imap <F5> <Esc>:call Run()<Enter>
- " }
- " Modern comments {
- func! GetCommentString()
- if &filetype == "cpp" || &filetype == "c" || &filetype == "h" || &filetype == "hpp" || &filetype == "java"
- return "//"
- elseif &filetype == "vim"
- return "\" "
- elseif &filetype == "tex"
- return "% "
- elseif &filetype == "lua"
- return "--"
- endif
- return "# "
- endf
- func! Comment()
- let s = getline(".")
- let pos = 0
- while pos < len(s) && (s[pos] == ' ' || s[pos] == '\t')
- let pos += 1
- endwhile
- if pos < len(s)
- call setline(".", strpart(s, 0, pos) . GetCommentString() . strpart(s, pos))
- let shift = 0
- normal l
- normal l
- endif
- endf
- func! Uncomment()
- let s = getline(".")
- let comment = GetCommentString()
- let pos = 0
- while pos < len(s) && (s[pos] == ' ' || s[pos] == '\t')
- let pos += 1
- endwhile
- if pos + len(comment) <= len(s)
- if strpart(s, pos, len(comment)) == comment
- call setline(".", strpart(s, 0, pos) . strpart(s, pos + len(comment)))
- normal h
- normal h
- endif
- endif
- endf
- map gc :call Comment()<cr>
- map gu :call Uncomment()<cr>
- " }
- " Abbreviations {
- ia templ #include <bits/stdc++.h>
- \<cr>using namespace std;
- \<cr>#define forn(i,n) for (int i = 0; i < int(n); ++i)
- \<cr>#define sz(x) ((int) (x).size())
- \<cr>typedef long long ll;
- \<cr>typedef long double ld;
- \<cr>
- " }
- " Extra menu {
- func! Switch()
- echo "h: highlight"
- echo "p: paste"
- echo "c: copy"
- echo ""
- let c = nr2char(getchar())
- if c == 'h'
- set hlsearch!
- elseif c == 'p'
- set paste!
- elseif c == 'c'
- if &nu
- sign unplace 9999
- else
- execute 'sign place 9999 line=1 name=dummy buffer=' . bufnr('')
- endif
- set nu!
- else
- echo "fail"
- endif
- endf
- map <f8> :call Switch()<cr>
- " }
- " Default template
- func! Template()
- " 0r ~/disk/src/templates/jinotega.cpp
- 0r ~/disk/src/templates/bufnewfile.cpp
- normal 14j
- endf
- au BufNewFile *.cpp call Template()
- " Non-C++ features {
- " let g:livepreview_previewer = 'zathura'
- au Filetype make setlocal noet
- set keymap=russian-jcukenwin
- set iminsert=0
- set imsearch=0
- " map <f4> :!xclip i < %<cr><cr>
- " }
- " let $CPPFLAGS .= " -Wno-misleading-indentation"
- map <F6> :!xinput set-prop "SynPS/2 Synaptics TouchPad" "Device Enabled" 0<Enter>
- map <F7> :!xinput set-prop "SynPS/2 Synaptics TouchPad" "Device Enabled" 1<Enter>
- set keymap=russian-jcukenwin
- set iminsert=0
- set imsearch=0
- highlight lCursor guifg=NONE guibg=Cyan
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement