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 tt
- " 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()
- if &filetype == "java"
- :!javac %
- else
- :make! %:r
- endif
- endf
- map <f9> :w<Enter>:call Compile()<Enter>
- imap <f9> <Esc>:w<Enter>: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
- imap mm <c-^>
- map mm i<c-^><esc>
- " map <c-a> ^^
- " imap <c-a> ^^
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement