Skip to content

Instantly share code, notes, and snippets.

@fridim fridim/.vimrc

Created Mar 12, 2014
Embed
What would you like to do?
let g:netrw_preview=1
set relativenumber
set history=1000
set encoding=utf8
set laststatus=2
set shiftwidth=2
"au BufRead,BufNewFile *.rb,*.rhtml set shiftwidth=2
set softtabstop=2
set ts=2
"set guifont=Monospace\ 9
set guifont=Terminus\ 8
"set guifont=Dina\ 10
set backspace=indent,eol,start
"" set cursorcolumn " highlight the current column
"" set cursorline " highlight current line
set incsearch
set expandtab
set smarttab
set ignorecase
set smartcase
set ai
set si
set nocompatible
set paste
" Set 7 lines to the cursor - when moving vertically using j/k
set so=7
set magic " regex
" Show matching brackets when text indicator is over them
set showmatch
" How many tenths of a second to blink when matching brackets
set mat=2
" => Files, backups and undo
" Turn backup off, since most stuff is in SVN, git et.c anyway...
set nobackup
set nowb
set noswapfile
" a buffer becomes hidden when it's abandonned
set hid " so you can switch even if it's not saved
" Remember info about open buffers on close
set viminfo^=%
" => Turn persistent undo on
" means that you can undo even when you close a buffer/VIM
try
silent !mkdir -p ~/.vim/backups >/dev/null 2>&1
set undodir=~/.vim/backups
set undofile
catch
endtry
" switch buffer
map <down> <ESC>:bn<RETURN>
map <up> <ESC>:bp<RETURN>
map <del> <ESC>:bdelete<RETURN>
map <tab> <ESC>:Unite buffer<RETURN>
set wildchar=<Tab>
set wildmenu
set wildmode=list,full
"set wildmode=longest:full,full
" Smart way to move between windows
map <C-j> <C-W>j
map <C-k> <C-W>k
map <C-h> <C-W>h
map <C-l> <C-W>l
" Remap VIM 0 to first non-blank character
map 0 ^
" Move a line of text using ALT+[jk]
nmap <M-j> mz:m+<cr>`z
nmap <M-k> mz:m-2<cr>`z
vmap <M-j> :m'>+<cr>`<my`>mzgv`yo`z
vmap <M-k> :m'<-2<cr>`>my`<mzgv`yo`z
if has("gui_running")
set guioptions-=m "remove menu bar
set guioptions-=T "remove toolbar
set guioptions-=r "remove right-hand scroll bar
set lines=62
set columns=135
set clipboard=unnamed
else
let g:solarized_termcolors=256
end
syntax on
set background=dark
" http://ethanschoonover.com/solarized
"colorscheme solarized
"colorscheme ir_black
colorscheme molokai
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" lightline
if has("gui_running")
let g:lightline = {
\ 'colorscheme': 'wombat',
\ 'mode_map': { 'c': 'NORMAL' },
\ 'active': {
\ 'left': [ [ 'mode', 'paste' ], [ 'fugitive', 'filename' ] ]
\ },
\ 'component_function': {
\ 'modified': 'MyModified',
\ 'readonly': 'MyReadonly',
\ 'fugitive': 'MyFugitive',
\ 'filename': 'MyFilename',
\ 'fileformat': 'MyFileformat',
\ 'filetype': 'MyFiletype',
\ 'fileencoding': 'MyFileencoding',
\ 'mode': 'MyMode',
\ },
\ 'separator': { 'left': '', 'right': '' },
\ 'subseparator': { 'left': '', 'right': '' }
\ }
else
let g:lightline = {
\ 'colorscheme': 'wombat',
\ 'mode_map': { 'c': 'NORMAL' },
\ 'active': {
\ 'left': [ [ 'mode', 'paste' ], [ 'fugitive', 'filename' ] ]
\ },
\ 'component_function': {
\ 'modified': 'MyModified',
\ 'readonly': 'MyReadonly',
\ 'fugitive': 'MyFugitive',
\ 'filename': 'MyFilename',
\ 'fileformat': 'MyFileformat',
\ 'filetype': 'MyFiletype',
\ 'fileencoding': 'MyFileencoding',
\ 'mode': 'MyMode',
\ },
\ 'separator': { 'left': '', 'right': '' },
\ 'subseparator': { 'left': '>', 'right': '<' }
\ }
end
function! MyModified()
return &ft =~ 'help\|vimfiler\|gundo' ? '' : &modified ? '+' : &modifiable ? '' : '-'
endfunction
function! MyReadonly()
return &ft !~? 'help\|vimfiler\|gundo' && &ro ? '' : ''
endfunction
function! MyFilename()
return ('' != MyReadonly() ? MyReadonly() . ' ' : '') .
\ (&ft == 'vimfiler' ? vimfiler#get_status_string() :
\ &ft == 'unite' ? unite#get_status_string() :
\ &ft == 'vimshell' ? substitute(b:vimshell.current_dir,expand('~'),'~','') :
\ '' != expand('%t') ? expand('%t') : '[No Name]') .
\ ('' != MyModified() ? ' ' . MyModified() : '')
endfunction
function! MyFugitive()
return &ft !~? 'vimfiler\|gundo' && exists('*fugitive#head') && strlen(fugitive#head()) ? ''.fugitive#head() : ''
endfunction
function! MyFileformat()
return winwidth('.') > 70 ? &fileformat : ''
endfunction
function! MyFiletype()
return winwidth('.') > 70 ? (strlen(&filetype) ? &filetype : 'no ft') : ''
endfunction
function! MyFileencoding()
return winwidth('.') > 70 ? (strlen(&fenc) ? &fenc : &enc) : ''
endfunction
function! MyMode()
return winwidth('.') > 60 ? lightline#mode() : ''
endfunction
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" :W sudo saves the file
" (useful for handling the permission-denied error)
command W w !sudo tee % > /dev/null
let g:c_80_detect = 0
function! Change80Detect()
if g:c_80_detect == 1
match
let g:c_80_detect = 0
else
match ErrorMsg '\%>80v.\+'
let g:c_80_detect = 1
endif
endfunction
map <F12> <Esc>:call Change80Detect()<CR>
if has("autocmd")
" Enable filetype detection
" Racket :
au BufReadPost *.rkt,*.rktl set filetype=racket
au filetype racket set lisp
au filetype racket set autoindent
filetype plugin indent on
" Restore cursor position
autocmd BufReadPost *
\ if line("'\"") > 1 && line("'\"") <= line("$") |
\ exe "normal! g`\"" |
\ endif
endif
set rtp+=~/.vim/bundle/vundle/
call vundle#rc()
" Snips trigger
let g:UltiSnipsUsePythonVersion = 2
let g:UltiSnipsExpandTrigger="<tab>"
let g:UltiSnipsJumpForwardTrigger="<tab>"
let g:UltiSnipsJumpBackwardTrigger="<s-tab>"
" syntastic
let g:syntastic_check_on_open = 1
let g:syntastic_puppet_puppetlint_args = "--no-autoloader_layout-check --fail-on-warnings --no-80chars-check --no-class_inherits_from_params_class-check"
" Mutt
au BufRead /tmp/mutt-* set tw=72
autocmd BufRead,BufNewFile *mutt-* set filetype=mail
" Gist
let g:gist_clip_command = 'xsel -i'
" let Vundle manage Vundle
" required!
Bundle 'gmarik/vundle'
Bundle 'tpope/vim-fugitive'
Bundle 'wlangstroth/vim-racket'
Bundle 'gnupg.vim'
Bundle 'itchyny/lightline.vim'
Bundle 'rodjek/vim-puppet'
Bundle 'godlygeek/tabular'
Bundle 'mattn/webapi-vim'
Bundle 'vim-scripts/Gist.vim'
Bundle 'Shougo/unite.vim'
Bundle 'scrooloose/syntastic'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.