Skip to content

Instantly share code, notes, and snippets.

@razimantv
Last active April 10, 2017 20:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save razimantv/b2ca7aa9857c261a9baf to your computer and use it in GitHub Desktop.
Save razimantv/b2ca7aa9857c261a9baf to your computer and use it in GitHub Desktop.
"" vimrc file
" contains settings for vim and gvim
"Vundle=========================================================================
set nocompatible
filetype off
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
Plugin 'mileszs/ack.vim'
Plugin 'vim-scripts/Conque-GDB'
Plugin 'sjl/gundo.vim'
Plugin 'yggdroot/indentline'
Plugin 'alfredodeza/khuno.vim'
Plugin 'scrooloose/nerdcommenter'
Plugin 'francoiscabrol/ranger.vim'
Plugin 'majutsushi/tagbar'
Plugin 'SirVer/ultisnips'
Plugin 'altercation/vim-colors-solarized'
Plugin 'tpope/vim-fugitive'
Plugin 'sheerun/vim-polyglot'
Plugin 'honza/vim-snippets'
Plugin 'VundleVim/Vundle.vim'
Plugin 'Valloric/YouCompleteMe'
call vundle#end()
filetype plugin indent on
"===============================================================================
"YouCompleteMe==================================================================
let g:ycm_global_ycm_extra_conf = "~/.vim/ycm_extra_conf.py"
let g:ycm_filetype_blacklist = {
\ 'tagbar' : 1, 'qf' : 1, 'notes' : 1, 'markdown' : 1, 'unite' : 1,
\ 'vimwiki' : 1, 'pandoc' : 1, 'infolog' : 1,
\}
"let g:ycm_always_populate_location_list = 1
"===============================================================================
"UltiSnips======================================================================
" better key bindings for UltiSnipsExpandTrigger
let g:UltiSnipsExpandTrigger="<C-j>"
let g:UltiSnipsListSnippets="<S-C-a>"
let g:UltiSnipsJumpForwardTrigger="<C-j>"
let g:UltiSnipsJumpBackwardTrigger="<C-k>"
let g:UltiSnipsEditSplit="vertical"
let g:UltiSnipsSnippetsDir = '~/.vim/UltiSnips'
"===============================================================================
"Powerline======================================================================
"python3 from powerline.vim import setup as powerline_setup
"python3 powerline_setup()
"python3 del powerline_setup
set laststatus=2 " Always display the statusline in all windows
set showtabline=2 " Always display the tabline, even if there is only one tab
let g:Powerline_symbols = 'fancy'
set noshowmode " Hide the default mode text
"===============================================================================
syntax enable
behave mswin
set ruler cursorline relativenumber number
set expandtab shiftwidth=2 softtabstop=2 tabstop=2
set switchbuf=usetab,newtab
set incsearch showmatch hlsearch
nnoremap <leader><space> :noh<cr>
set wildmenu
set hidden "To be able to do things to an unsaved buffer
set autoread
set backspace=indent,eol,start
set formatoptions+=j
set sessionoptions-=options
set tags=./tags,tags
set cc=81
if &listchars ==# 'eol:$'
set listchars=tab:>\ ,trail:-,extends:>,precedes:<,nbsp:+
endif
if &history < 1000
set history=1000
endif
if &tabpagemax < 50
set tabpagemax=50
endif
"GUI vs console vim settings====================================================
if has("gui_running")
"Remove unnecessary window items
set guioptions-=T
set guioptions-=r
set guioptions-=e
set guioptions-=m
set guioptions-=R
set guioptions-=l
set guioptions-=L
set guifont=Ubuntu\ Mono\ Regular\ 11
set background=dark
let g:solarized_contrast="high"
colorscheme solarized
else
set t_Co=256
set mouse=a
set background=dark
let g:solarized_contrast="high"
colorscheme solarized
"Permit italicised comments inside tmux
if !empty($TMUX)
set t_ZH=
set t_ZR=
highlight Comment cterm=italic
endif
endif
"===============================================================================
"Remove trailing whitespace
nnoremap <Leader>rtw :%s/\s\+$//e<CR>
"Weird headings
nnoremap <leader>h= yypVr=o
nnoremap <leader>h- yypVr-o
nnoremap <leader>h. yypVr.o
"Change directory to that of current file
nnoremap <leader>cd :cd %:p:h<CR>
"Up down over visible line rather than actual line
nnoremap <Up> gk
nnoremap <Down> gj
inoremap <Up> <C-o>gk
inoremap <Down> <C-o>gj
"Diff
nnoremap <leader>diff :windo diffthis<CR>
nnoremap <leader>diffoff :diffoff<CR><C-w><C-w>:diffoff<CR>
"Paste from system clipboard
if has('unnamedplus')
set clipboard=unnamed,unnamedplus
else
set clipboard=unnamed
endif
"nnoremap <F1> "+P
cnoremap <F1> <C-R>+
inoremap <F1> <C-R>+
"Save and retrieve sessions
map <F5> :source .vim_session <cr>
map <F6> :mksession! .vim_session <cr>
"Shortcuts for Plugins
nnoremap <leader>tt :TagbarToggle<cr>
nnoremap <leader>gt :GundoToggle<cr>
nnoremap <leader>gr :GundoRenderGraph<cr>
"Move split to new tab
nnoremap <leader>nt <C-w><S-t>
inoremap <leader>nt <C-o><C-w><S-t>
"Detect gnuplot
au BufNewFile,BufRead *.plt,*.gnuplot,*plotter* setf gnuplot
let g:gundo_prefer_python3 = 1
if filereadable("~/.lvimrc")
so ~/.lvimrc
endif
" ~/.vimrc ends here
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment