Last active
June 26, 2019 11:43
-
-
Save muellermartin/4650428 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" Disable vi compatibility mode for more functionality | |
set nocompatible | |
" Clear filetype flags before changing runtimepath to force Vim to reload them | |
" Required by Vundle | |
filetype off | |
filetype plugin indent off | |
" Vundle setup | |
" set the runtime path to include Vundle and initialize | |
set rtp+=~/.vim/bundle/Vundle.vim | |
call vundle#begin() | |
" Let Vundle manage Vundle | |
" required! | |
Plugin 'gmarik/Vundle.vim' | |
" Vundle bundles | |
" Has compiled part! | |
Plugin 'Valloric/YouCompleteMe' | |
"Plugin 'Lokaltog/powerline', { 'rtp': 'powerline/bindings/vim/' } | |
" Needs special fonts (for some themes)! | |
"Plugin 'Lokaltog/powerline' | |
" Alternative to Powerline: | |
Plugin 'vim-airline/vim-airline' | |
Plugin 'vim-airline/vim-airline-themes' | |
Plugin 'scrooloose/syntastic' | |
Plugin 'scrooloose/nerdtree' | |
Plugin 'majutsushi/tagbar' | |
Plugin 'nathanaelkane/vim-indent-guides' | |
"Plugin 'jaxbot/browserlink.vim' | |
Plugin 'plasticboy/vim-markdown' | |
Plugin 'airblade/vim-gitgutter' | |
Plugin 'tpope/vim-fugitive' | |
"Plugin 'Raimondi/delimitMate' | |
Plugin 'rust-lang/rust.vim' | |
"Plugin 'ctrlpvim/ctrlp.vim' | |
Plugin 'tpope/vim-surround' | |
call vundle#end() | |
" Code completion | |
filetype plugin on | |
" Also enable language dependent indentation | |
filetype plugin indent on | |
" YouCompleteMe 'fallback' config (instead of per project) | |
"let g:ycm_global_ycm_extra_conf = '~/.ycm_extra_conf.py' | |
" Auto-close preview after completion | |
let g:ycm_autoclose_preview_window_after_completion = 1 | |
"let g:ycm_server_use_vim_stdout = 1 | |
"let g:ycm_server_keep_logfile = 1 | |
"let g:ycm_server_log_level = 'debug' | |
autocmd FileType python set omnifunc=pythoncomplete#Complete | |
autocmd FileType javascript set omnifunc=javascriptcomplete#CompleteJS | |
autocmd FileType html set omnifunc=htmlcomplete#CompleteTags | |
autocmd FileType css set omnifunc=csscomplete#CompleteCSS | |
autocmd FileType xml set omnifunc=xmlcomplete#CompleteTags | |
" Indent Guides settings | |
let g:indent_guides_enable_on_vim_startup = 1 | |
" Set <leader> key to ',' (use ,<Space> for backwards character search) | |
let mapleader = "," | |
" vim-airline: automatically populate the g:airline_symbols dictionary with the powerline symbols | |
let g:airline_powerline_fonts = 1 | |
let g:airline_theme='powerlineish' | |
"let g:airline#extensions#tabline#enabled = 1 | |
" Disable folding configuration for Markdown | |
let g:vim_markdown_folding_disabled = 1 | |
" Use OmniComplete for eclim's auto completion | |
let g:EclimCompletionMethod = 'omnifunc' | |
" Disable Eclim for JavaScript (fixes «Unable to find the 'jsl' command») | |
let g:EclimJavascriptValidate = 0 | |
command StartEclim !/Applications/Eclipse.app/Contents/Eclipse/eclimd &>/dev/null & | |
" Set file encoding | |
set enc=utf-8 | |
scriptencoding utf-8 | |
" Autoread file when it is changed from the outside | |
set autoread | |
" Show matches while typing search pattern | |
set incsearch | |
" Highlight all matches for search pattern | |
set hlsearch | |
" Ignore case in search | |
"set ignorecase | |
" Ignore case if search pattern is all lowercase, case-sensitive otherwise | |
set smartcase | |
" Visual autocomplete for command menu | |
set wildmenu | |
" Auto indent (copies the indentation from the previous line) | |
"set autoindent | |
" Smart indent (inserts one extra level of indentation in some cases) | |
set smartindent | |
set copyindent | |
set preserveindent | |
" Enable folding | |
set foldenable | |
" Only use special characters to flag start and end of folds | |
set foldmethod=marker | |
" Set tab width to 4 characters | |
set tabstop=4 | |
" Affects what happens on >>, << and == | |
set shiftwidth=4 | |
" Set width of tabs in insert mode (depends on tabstop and (no)expandtab) | |
set softtabstop=4 | |
"set softtabstop=0 | |
" Don't replace tabs with spaces | |
set noexpandtab | |
" Backspace deletes a shiftwidth worth of spaces | |
set smarttab | |
" Set tabstop, shiftwidth, softtabstop and noexpandtab for Python files | |
autocmd FileType python setlocal ts=4 sw=4 sts=4 noet | |
" Enable Syntax Highlighting | |
syntax enable | |
" Show matching brackets | |
set showmatch | |
" Highlight line with cursor | |
set cursorline | |
" Visually highlight the 80th column (common default for line wrapping) | |
" Note: This does NOT wrap lines! | |
set colorcolumn=80 | |
" Detect type of file by checking file name and content | |
"filetype on | |
" Omni completion (not needed anymore since YouCompleteMe) | |
"set ofu=syntaxcomplete#Complete | |
" Show line numbers | |
set number | |
set relativenumber | |
" Enable mouse support in console | |
set mouse=a | |
" Use system clipboard on Mac OS X | |
set clipboard=unnamed | |
" Fix crontab editing on Mac OS X | |
" See http://vim.wikia.com/wiki/Editing_crontab | |
au BufEnter /tmp/crontab.* setl backupcopy=yes | |
" Show current position at bottom | |
set ruler | |
" Show invisible characters | |
set list | |
" Only show tabs, trailing whitespace and EOL | |
set listchars=tab:‣\ ,trail:·,eol:↲ | |
" Always show the status line | |
set laststatus=2 | |
" Enable vim settings through comments in files | |
set modeline | |
" Show information about the current command | |
set showcmd | |
" Keep temporary files in one place | |
" The directories must exist otherwise VIM won't work! | |
try | |
set backupdir=~/.vim/backup | |
set backup | |
set directory=~/.vim/tmp | |
if has('persistent_undo') | |
set undodir=~/.vim/undo | |
set undofile | |
endif | |
catch | |
endtry | |
" Expand w!! for saving as root | |
" Leaves the cursor at the end, so replacing the % with a custom file name is possible | |
cmap w!! w !sudo tee >/dev/null % | |
" Map Ctrl + n to toggle NERDTree | |
map <C-n> :NERDTreeToggle<CR> | |
map <C-o> :TagbarToggle<CR> | |
" Additional mapping to leave insert and visual/select mode | |
imap <M-Space> <Esc> | |
vmap <M-Space> <Esc> | |
imap <S-CR> <Esc> | |
vmap <S-CR> <Esc> | |
" Map : to the ö key which is useful on German keyboards | |
nnoremap ö : | |
" Move vertically by visual line (useful for wrapped lines) | |
nnoremap j gj | |
nnoremap k gk | |
" Retain the visual selection after (un)indentation | |
vnoremap > >gv | |
vnoremap < <gv | |
" Indent current line with Tab and unindent with Shift + Tab | |
nnoremap <Tab> >>_ | |
nnoremap <S-Tab> <<_ | |
vnoremap <Tab> >gv | |
vnoremap <S-Tab> <gv | |
" Exit select mode after pressing Tab | |
"vnoremap <Tab> >gV | |
"vnoremap <S-Tab> <gV | |
" Movement between tabs | |
" Apple CMD-key + > or < | |
"map <D-S-gt> gt | |
"map <D-lt> gT | |
map <D-1> 1gt | |
map <D-2> 2gt | |
map <D-3> 3gt | |
map <D-4> 4gt | |
map <D-5> 5gt | |
map <D-6> 6gt | |
map <D-7> 7gt | |
map <D-8> 8gt | |
map <D-9> 9gt | |
map <D-0> :tablast<CR> | |
" Use GHC functionality for Haskell files | |
autocmd bufenter *.hs compiler ghc | |
" Close vim if the only window left open is a NERDTree | |
autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTreeType") && b:NERDTreeType == "primary") | q | |
" See :help DiffOrig | |
if !exists(":DiffOrig") | |
command DiffOrig vert new | set bt=nofile | r # | 0d_ | diffthis | |
\ | wincmd p | diffthis | |
endif | |
" Append modeline after last line in buffer. | |
" Use substitute() instead of printf() to handle '%%s' modeline in LaTeX | |
" files. | |
" Credits: http://vim.wikia.com/wiki/Modeline_magic | |
function! AppendModeline() | |
let l:modeline = printf(" vim: set ts=%d sw=%d tw=%d %set :", | |
\ &tabstop, &shiftwidth, &textwidth, &expandtab ? '' : 'no') | |
let l:modeline = substitute(&commentstring, "%s", l:modeline, "") | |
call append(line("$"), l:modeline) | |
endfunction | |
" Type <Leader>ml to add a modeline based on current settings | |
nnoremap <silent> <Leader>ml :call AppendModeline()<CR> | |
" GUI settings | |
if has("gui_running") | |
colorscheme wombat | |
" Set font | |
set guifont=DejaVu\ Sans\ Mono\ for\ Powerline:h12 | |
" Remove Toolbar | |
set guioptions-=T | |
" Transparency | |
"set transparency=5 | |
" Set to fullscreen | |
"set fu | |
else | |
" Alternative theme for console | |
" There is a plugin for though... | |
colorscheme wombat256mod | |
endif |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment