Skip to content

Instantly share code, notes, and snippets.

@bsiegfreid
Created October 22, 2020 13:26
Show Gist options
  • Save bsiegfreid/a34dbc416d61b0af157e89275c974433 to your computer and use it in GitHub Desktop.
Save bsiegfreid/a34dbc416d61b0af157e89275c974433 to your computer and use it in GitHub Desktop.
My personal .vimrc
" .vimrc
"
" Vundle
"
" Manually clone Vundle.vim into ~/.vim
" After editing run :source % and :PluginInstall
"
set nocompatible " Vundle required
filetype off " Vundle required
syntax enable
set hidden " Turn off warning about unsaved buffers
" Set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
Plugin 'VundleVim/Vundle.vim'
" Git support, Tim is working on a version compatible with Vim 8
Plugin 'tpope/vim-fugitive'
Plugin 'altercation/vim-colors-solarized'
Plugin 'vim-airline/vim-airline'
Plugin 'vim-airline/vim-airline-themes'
" NerdTree
Plugin 'scrooloose/nerdtree'
Plugin 'Xuyuanp/nerdtree-git-plugin'
" Tabularize
Plugin 'godlygeek/tabular'
" Add writing support
Plugin 'reedes/vim-pencil'
Plugin 'tpope/vim-markdown'
" Syntax checking
Plugin 'vim-syntastic/syntastic'
Plugin 'ekalinin/Dockerfile.vim'
Plugin 'akhaku/vim-java-unused-imports'
" Tag support and code structure
Plugin 'majutsushi/tagbar'
" Plugin 'artur-shaik/vim-javacomplete2'
" Automatically update ctags
Plugin 'xolox/vim-misc'
Plugin 'xolox/vim-easytags'
" XML editing
" Plugin 'othree/xml.vim'
" All of your Plugins must be added before the following line
call vundle#end() " required
filetype plugin indent on " required
" Syntastic
set statusline+=%#warningmsg#
" Enable syntax highlighting
set background=dark
colorscheme solarized
" With a map leader it's possible to do extra key combinations
" like <leader>w saves the current file
let mapleader = ","
" NERDTree
" Open automatically
autocmd StdinReadPre * let s:std_in=1
autocmd VimEnter * if argc() == 0 && !exists("s:std_in") | NERDTree | endif
autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTree") && b:NERDTree.isTabTree()) | q | endif
" Mappings
nnoremap <leader>n :NERDTreeToggle<CR>
nnoremap <silent> <leader>f :NERDTreeFind<CR>
" Improve buffer navigation
nnoremap <silent> [b :bprevious<CR>
nnoremap <silent> ]b :bnext<CR>
nnoremap <silent> [B :bfirst<CR>
nnoremap <silent> ]B :blast<CR>
" Improve split window navigation
" Use ctrl-[hjkl] to select the active split
nmap <silent> <c-k> :wincmd k<CR>
nmap <silent> <c-j> :wincmd j<CR>
nmap <silent> <c-h> :wincmd h<CR>
nmap <silent> <c-l> :wincmd l<CR>
" Tagbar
nmap <F8> :TagbarToggle<CR>
" Airline Theme
let g:airline_theme='solarized'
let g:airline_solarized_bg='dark'
" air-line
let g:airline_powerline_fonts = 1
if !exists('g:airline_symbols')
let g:airline_symbols = {}
endif
" The following symbol mapping does not work on Mac
" unicode symbols
" let g:airline_left_sep = '»'
" let g:airline_left_sep = 'â–¶'
" let g:airline_right_sep = '«'
" let g:airline_right_sep = 'â—€'
" let g:airline_symbols.linenr = '␊'
" let g:airline_symbols.linenr = '␤'
" let g:airline_symbols.linenr = '¶'
" let g:airline_symbols.branch = '⎇'
" let g:airline_symbols.paste = 'ρ'
" let g:airline_symbols.paste = 'Þ'
" let g:airline_symbols.paste = '∥'
" let g:airline_symbols.whitespace = 'Ξ'
" airline symbols
" let g:airline_left_sep = 'î‚°'
" let g:airline_left_alt_sep = ''
" let g:airline_right_sep = ''
" let g:airline_right_alt_sep = ''
" let g:airline_symbols.branch = 'î‚ '
" let g:airline_symbols.readonly = 'î‚¢'
" let g:airline_symbols.linenr = 'î‚¡'
" Pencil
let g:pencil#textwidth = 74
let g:pencil#joinspaces = 0 " 0=one_space (def), 1=two_spaces
let g:airline_section_x = '%{PencilMode()}'
let g:pencil#wrapModeDefault = 'soft'
augroup pencil
autocmd!
autocmd FileType markdown,mkd call pencil#init()
autocmd FileType text call pencil#init()
augroup END
" XML editing
let g:xml_syntax_folding=1
au FileType xml setlocal foldmethod=syntax
" my configuration which depends on bundles
set statusline=+'%<\ %f\ %{fugitive#statusline()}'
set statusline+=%#warningmsg#
set statusline+=%{SyntasticStatuslineFlag()}
set statusline+=%*
let g:syntastic_always_populate_loc_list = 1
let g:syntastic_auto_loc_list = 1
let g:syntastic_check_on_open = 0
let g:syntastic_check_on_wq = 0
" Set utf8 as standard encoding and en_US as the standard language
set encoding=utf8
" Use spaces instead of tabs
set expandtab
" Be smart when using tabs ;)
set smarttab
" 1 tab == 4 spaces
set shiftwidth=4
set tabstop=4
" Search down into subfolders
" Provide tab completion for all file related tasks
" Use :find and tab for partial matching, * for fuzzy matching
set path+=**
" Display all matching files when using tab complete
set wildmenu
" See line numbers
set number
" javacomplete
autocmd FileType java setlocal omnifunc=javacomplete#Complete
nmap <F4> <Plug>(JavaComplete-Imports-AddSmart)
imap <F4> <Plug>(JavaComplete-Imports-AddSmart)
nmap <F5> <Plug>(JavaComplete-Imports-Add)
imap <F5> <Plug>(JavaComplete-Imports-Add)
nmap <F6> <Plug>(JavaComplete-Imports-AddMissing)
imap <F6> <Plug>(JavaComplete-Imports-AddMissing)
nmap <F7> <Plug>(JavaComplete-Imports-RemoveUnused)
imap <F7> <Plug>(JavaComplete-Imports-RemoveUnused)
" Stop autocompletion from automatically selecting the first option
:set completeopt=longest,menuone
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment