Skip to content

Instantly share code, notes, and snippets.

@daemonza
Created April 21, 2015 11:32
Show Gist options
  • Save daemonza/f89aca7874e389af01ae to your computer and use it in GitHub Desktop.
Save daemonza/f89aca7874e389af01ae to your computer and use it in GitHub Desktop.
""" Daemonza vim setup
" Defaults
set nowrap " dont wrap lines
set tabstop=4 " a tab is four spaces
set backspace=indent,eol,start
" allow backspacing over everything in insert mode
set autoindent " always set autoindenting on
set copyindent " copy the previous indentation on autoindenting
set number " always show line numbers
set shiftwidth=4 " number of spaces to use for autoindenting
set shiftround " use multiple of shiftwidth when indenting with < and >
set showmatch " set show matching parenthesis
set ignorecase " ignore case when searching
set smartcase " ignore case if search pattern is all lowercase,
" case-sensitive otherwise
set smarttab " insert tabs on the start of a line according to
" shiftwidth, not tabstop
set hlsearch " highlight search terms
" Depending on your backup strategy, you might be able to
" enable the below to options
set nobackup " do not create backup file. Thats what git is for :)
set noswapfile " Stop creating a .swp file
set incsearch " show search matches as you type
set mouse=a " enabled mouse selection
set clipboard=unnamedplus "share vim clipboard with system clipboard
"Changing Leader Key
let mapleader = ","
" Remap the neovim terminal mode escape to use esc as normal
" trade off is you cannot send esc to the shell in terminal mode
tnoremap <Esc> <c-\><c-n>
"set cursorline
set ttyfast
set ruler
set backspace=indent,eol,start
set laststatus=2
set relativenumber
" stops the scratch view from opening
" in vim-go
set completeopt-=preview
let g:go_fmt_command = "goimports"
""" Key mappings
" maps ; to : saving 2 keystrokes on basically any vim command
nnoremap ; :
" List buffers
nnoremap <F5> :buffers<CR>:buffer<Space>
" Make Sure that Vim returns to the same line when we reopen a file"
augroup line_return
au!
au BufReadPost *
\ if line("'\"") > 0 && line("'\"") <= line("$") |
\ execute 'normal! g`"zvzz' |
\ endif
augroup END
" Load color theme if terminal supports 256 colors
if &t_Co >= 256 || has("gui_running")
colorscheme genericdc
"colorscheme mustang
"colorscheme spacegray
endif
if &t_Co > 2 || has("gui_running")
" switch syntax highlighting on, when the terminal has colors
syntax on
endif
" Easy commenting
" Commenting blocks of code.
autocmd FileType c,java,go let b:comment_leader = '// '
autocmd FileType sh,ruby,python let b:comment_leader = '# '
autocmd FileType vim let b:comment_leader = '" '
" Map <cmd>-/ to comment a line and <cmd>-. to uncomment
nmap <D-/> :<C-B>silent <C-E>s/^/<C-R>=escape(b:comment_leader,'\/')<CR>/<CR>:nohlsearch<CR>
nmap <D-.> :<C-B>silent <C-E>s/^\V<C-R>=escape(b:comment_leader,'\/')<CR>//e<CR>:nohlsearch<CR>
highlight Pmenu ctermbg=238 gui=bold
" Remove toolbar from macvim
if has("gui_running")
set guitablabel=%-0.12t%M
set guioptions-=T
set guioptions-=r
set guioptions-=L
set guioptions+=a
set guioptions+=m
color molokai
set guifont=Source\ Code\ Pro\ Light:h13
set listchars=tab:▸\ ,eol:¬ " Invisibles using the Textmate style
endif
" For some reason home and end keys are not mapping properly.
" Home key
imap <esc>OH <esc>0i
cmap <esc>OH <home>
nmap <esc>OH 0
" End key
nmap <esc>OF $
imap <esc>OF <esc>$a
cmap <esc>OF <end>
" vundle
set nocompatible
filetype off
set rtp+=~/.vim/bundle/vundle/
call vundle#rc()
" vundle plugin install
" Git gutter on the side.
Plugin 'airblade/vim-gitgutter'
" Ctrlp - find anything.
Plugin 'https://github.com/kien/ctrlp.vim.git'
" File brower
Plugin 'https://github.com/scrooloose/nerdtree.git'
" Syntax highlight
Plugin 'https://github.com/scrooloose/syntastic.git'
" Shows functions, structs, global vars etc..
Plugin 'https://github.com/majutsushi/tagbar.git'
" Bottom status / info bar
Plugin 'bling/vim-airline'
" Auto complete
Plugin 'https://github.com/Valloric/YouCompleteMe.git'
" git
Plugin 'https://github.com/tpope/vim-fugitive.git'
" Multiple cursors aka sublime text
Plugin 'https://github.com/terryma/vim-multiple-cursors.git'
" Go environment
Plugin 'fatih/vim-go'
" Jade syntax highlighting
Plugin 'https://github.com/digitaltoad/vim-jade'
" Dockerfile syntax highlighting
Plugin 'ekalinin/Dockerfile.vim'
" systemd syntax highlighting
Plugin 'Matt-Deacalion/vim-systemd-syntax'
" Hashicorp Terraform support
Plugin 'https://github.com/markcornick/vim-terraform'
" Comment and uncomment with ease
Plugin 'https://github.com/scrooloose/nerdcommenter'
" Git integration to Nerdtree
Plugin 'Xuyuanp/nerdtree-git-plugin'
" Switch to project root (identified by .git)
Plugin 'https://github.com/airblade/vim-rooter'
" Need to be after the vundle plugin install
if has('autocmd')
filetype plugin indent on
autocmd filetype python set expandtab
"autocmd BufWritePre *.go Fmt
endif
""""""""""""""""""""""""""""""""""""""""""
"""" Plugin configuration starts here """"
""""""""""""""""""""""""""""""""""""""""""
" vim-go
" Show a list of interfaces which is implemented by the type under your cursor with <leader>s
au FileType go nmap <Leader>s <Plug>(go-implements)
"Show type info for the word under your cursor with <leader>i
"(useful if you have disabled auto showing type info via g:go_auto_type_info)
au FileType go nmap <Leader>i <Plug>(go-info)
" Go definition
au FileType go nmap <Leader>ds <Plug>(go-def-split)
au FileType go nmap <Leader>dv <Plug>(go-def-vertical)
au FileType go nmap <Leader>dt <Plug>(go-def-tab)
" ctags bin dir
let g:tagbar_ctags_bin = '/Users/wgillmer/Code/bin/ctags-5.8/ctags'
" Airline
let g:airline_theme = "jellybeans"
" Top buffer bar with seperators. Disabled.
let g:airline#extensions#tabline#enabled = 0
let g:airline#extensions#tabline#left_sep = ' '
let g:airline#extensions#tabline#left_alt_sep = '|'
" Show date and time
"let g:airline_section_b = '%{strftime("%c")}'
let g:airline_symbols = {}
" 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 = 'Ξ'
" git branch
let g:airline_enable_branch = 1
"let g:airline_enable_syntastic = 1
" airline fugitive integration
let g:airline#extensions#branch#enabled = 1
let g:airline#extensions#branch#empty_message = 'no branch'
let g:airline#extensions#branch#displayed_head_limit = 10
" airline syntastic
let g:airline#extensions#syntastic#enabled = 1
" Ctrlp
"let g:ctrlp_map = '<D-p>'
"let g:ctrlp_cmd = 'CtrlP'
" airline tagbar integration
let g:airline#extensions#tagbar#enabled = 1
"change how tags are displayed (:help tagbar-statusline) >
"let g:airline#extensions#tagbar#flags = '' (default)
let g:airline#extensions#tagbar#flags = 'f'
let g:airline#extensions#tagbar#flags = 's'
let g:airline#extensions#tagbar#flags = 'p'
let g:airline_detect_modified=1
" Tagbar
nmap <F8> :TagbarToggle<CR>
" For NerdCommenter
filetype plugin on
" Mapping to NERDTree
"nnoremap <C-n> :NERDTreeToggle<cr>
map <leader>n :NERDTreeToggle<cr>
" Mini Buf explorer
"let g:miniBufExplMapWindowNavVim = 1
"let g:miniBufExplMapWindowNavArrows = 1
"let g:miniBufExplMapCTabSwitchBufs = 1
"let g:miniBufExplModSelTarget = 1
"map <Leader>n :MBEOpen<cr>
map <Leader>c :MBEClose<cr>
map <Leader>t :MBEToggle<cr>
" vim-gitgutter
" Set the column colour
highlight clear SignColumn
"highlight SignColumn ctermbg=244
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment