Skip to content

Instantly share code, notes, and snippets.

@adinapoli
Created February 6, 2013 16:43
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save adinapoli/4723877 to your computer and use it in GitHub Desktop.
Save adinapoli/4723877 to your computer and use it in GitHub Desktop.
" Pathogen
runtime bundle/vim-pathogen/autoload/pathogen.vim
call pathogen#infect()
call pathogen#helptags()
" Disable vi-compatibility
set nocompatible
" Remember more history
set history=1000
" Permanent undo
set undofile
" set a directory to store the undo history
set undodir=~/.vim/undo/
" Always show the statusline
set laststatus=2
" Highlight the current line
set cursorline
" keep more context when scrolling off the end of a buffer
set scrolloff=3
" Show line numbers
set number
set ruler
syntax on
" Set encoding
set encoding=utf-8
" Disable swap files
set noswapfile
" Set the map leader
let mapleader = ","
let maplocalleader = "-"
" Shortcut to rapidly toggle `set list`
nmap <leader>l :set list!<CR>
" Unfuck my screen
nnoremap U :syntax sync fromstart<cr>:redraw!<cr>
" Whitespace stuff
set nowrap
set tabstop=2
set shiftwidth=4
set softtabstop=2
set expandtab
set listchars=tab:▸\ ,eol:¬,trail:·
" Preserve indentation while pasting text from the OS X clipboard
noremap <leader>p :set paste<CR>:put *<CR>:set nopaste<CR>
" Searching
set hlsearch
set incsearch
set ignorecase
set smartcase
" unlight search selection when pressing enter
:nnoremap <CR> :nohlsearch<cr>:call MarkMultipleClean()<cr>
" allow backspacing over everything in insert mode
set backspace=indent,eol,start
" load the plugin and indent settings for the detected filetype
filetype plugin indent on
" Enable syntastic syntax checking
let g:syntastic_enable_signs=1
" Use modeline overrides
set modeline
set modelines=10
" Default color scheme
" Set the 256 color mode for terminal
set t_Co=256
"colorscheme Tomorrow-Night-Bright
colorscheme hybrid
"Font config Linux and Mac
if has("gui_running")
if has("gui_gtk2")
set guifont=Inconsolata-dz\ for\ Powerline\ 8
set guioptions+=m "leave menu bar
set guioptions-=T "remove toolbar
set guioptions-=r "remove right-hand scroll bar
else
set guifont=Inconsolata-dz\ for\ Powerline:h16
endif
endif
" MacVIM shift+arrow-keys behavior (required in .vimrc)
let macvim_hig_shift_movement = 1
" Include user's local vim config
if filereadable(expand("~/.vimrc.local"))
source ~/.vimrc.local
endif
"Right Column margin indicator
:set cc=80
"No beeping and visual bell
set noeb vb t_vb=
"Powerline, the ultimate vim status bar
let g:Powerline_symbols = 'unicode'
"folding settings
set foldmethod=indent "fold based on indent
set foldnestmax=10 "deepest fold is 10 levels
set nofoldenable "dont fold by default
set foldlevel=1
" A dirty trick for preventing me to use arrow keys
inoremap <Up> <NOP>
inoremap <Down> <NOP>
inoremap <Left> <NOP>
inoremap <Right> <NOP>
noremap <Up> <NOP>
noremap <Down> <NOP>
noremap <Left> <NOP>
noremap <Right> <NOP>
" NAVIGATION
" Move around splits with <c-hjkl>
nnoremap <c-j> <c-w>j
nnoremap <c-k> <c-w>k
nnoremap <c-h> <c-w>h
nnoremap <c-l> <c-w>l
" Easier switch among buffers
nnoremap <silent> H :bp<CR>
nnoremap <silent> L :bn<CR>
"Shows cmd pressed in normal mode
set showcmd
" Took from Gary Bernhardt
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" MULTIPURPOSE TAB KEY
" " Indent if we're at the beginning of a line. Else, do completion.
" """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
function! InsertTabWrapper()
let col = col('.') - 1
if !col || getline('.')[col - 1] !~ '\k'
return "\<tab>"
else
return "\<c-p>"
endif
endfunction
inoremap <tab> <c-r>=InsertTabWrapper()<cr>
inoremap <s-tab> <c-n>
" Remapping <Esc> to jj in insert mode
inoremap jj <Esc>
"
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" LANGUAGES-SPECIFIC STUFF
" """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Modula 2, are you serious?
au BufEnter *.md set filetype=markdown
"""""""""""
" HTML
"~~~~~~~~~~
autocmd FileType html setlocal shiftwidth=2 tabstop=2
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" ---> HASKELL
" """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
let g:haskell_conceal_wide = 1
let g:cumino_ghci_args = "-XOverloadedStrings"
let g:cumino_default_terminal = "xterm"
let g:cumino_use_hsenv = 1
au BufEnter *.hs,*.lhs set makeprg=ghc\ %
au FileType haskell :NeoComplCacheEnable
"hdevtools
au FileType haskell nnoremap <buffer> <localleader>t :HdevtoolsType<CR>
au FileType haskell nnoremap <buffer> <silent> <localleader>c :HdevtoolsClear<CR>
let g:hdevtools_options = '-g-isrc -g-Wall'
if isdirectory($HSENV)
let g:hdevtools_options .= ' -g-package-conf$HSENV/.hsenv_$HSENV_NAME/ghc_pkg_db'
endif
nmap <F5> :TagbarToggle<CR>
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" ---> SCALA
" """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
au FileType scala :NeoComplCacheEnable
let g:neocomplcache_disable_auto_complete = 1
let g:neocomplcache_dictionary_filetype_lists = {
\ 'default' : '',
\ 'scala' : $HOME.'/.vim/dict/scala.dict',
\ }
let g:staircase_default_terminal = "xterm"
let g:tagbar_type_scala = {
\ 'ctagstype' : 'Scala',
\ 'kinds' : [
\ 'p:packages:1',
\ 'V:values',
\ 'v:variables',
\ 'T:types',
\ 't:traits',
\ 'o:objects',
\ 'a:aclasses',
\ 'c:classes',
\ 'r:cclasses',
\ 'm:methods'
\ ]
\ }
" Scalariform integration
au BufEnter *.scala setl formatprg=~/bin/scalariform\ --stdin\ --stdout
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" ---> OTHER
" """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
let g:pad_dir="~/notes/"
"Ack.vim, uses Ack, a better grep
let g:ackprg="ack -H --nocolor --nogroup --column"
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" ---> OCAML
" """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"let g:beduino_buffer_location = "/tmp/beduino.buff"
let g:syntastic_ocaml_use_ocamlc = 1
let g:syntastic_ocaml_use_janestreet_core = 1
let g:syntastic_ocaml_janestreet_core_dir = "~/apps/godi/lib/ocaml/site-lib/core"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment