Skip to content

Instantly share code, notes, and snippets.

@diogob
Last active March 24, 2024 01:03
Show Gist options
  • Select an option

  • Save diogob/920928 to your computer and use it in GitHub Desktop.

Select an option

Save diogob/920928 to your computer and use it in GitHub Desktop.
My vimrc
set nocompatible " be iMproved
filetype off " required!
call plug#begin('~/.vim/plugged')
" Plugs:
" Utilities
Plug 'tpope/vim-commentary'
Plug 'tpope/vim-fugitive'
Plug 'tpope/vim-surround'
Plug 'msanders/snipmate.vim'
Plug 'kana/vim-textobj-user'
Plug 'edsono/vim-matchit'
Plug 'skammer/vim-css-color'
Plug 'vim-scripts/taglist.vim'
Plug 'majutsushi/tagbar'
Plug 'Shougo/vimproc.vim'
Plug 'bling/vim-airline'
" Language support
Plug 'scrooloose/syntastic'
" Haskell
Plug 'lukerandall/haskellmode-vim'
Plug 'vim-scripts/haskell.vim'
Plug 'eagletmt/neco-ghc'
Plug 'bitc/vim-hdevtools'
Plug 'dag/vim2hs'
" JS
Plug 'kchmck/vim-coffee-script'
Plug 'pangloss/vim-javascript'
Plug 'vim-scripts/Jasmine-snippets-for-snipMate'
" Ruby/Rails
Plug 'slim-template/vim-slim'
Plug 'tpope/vim-rails'
Plug 'vim-ruby/vim-ruby'
Plug 'nelstrom/vim-textobj-rubyblock'
" Other languages
Plug 'digitaltoad/vim-jade'
Plug 'wavded/vim-stylus'
Plug 'kylef/apiblueprint.vim'
Plug 'lambdatoast/elm.vim'
" Color schemes
Plug 'tomasr/molokai'
Plug 'ciaranm/inkpot'
Plug 'airblade/vim-gitgutter'
" All of your Plugins must be added before the following line
call plug#end()
" Enable the list of buffers
" let g:airline#extensions#tabline#enabled = 1
" Show just the filename
"let g:airline#extensions#tabline#fnamemod = ':t'
" jump to the last position when reopening a file
if has("autocmd")
au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif
endif
" Keeps haskell tags up to date
au BufWritePost *.hs silent !init-tags %
au BufWritePost *.hsc silent !init-tags %
" Tags {{{
set tags=tags;/,codex.tags;/
let g:tagbar_type_haskell = {
\ 'ctagsbin' : 'hasktags',
\ 'ctagsargs' : '-x -c -o-',
\ 'kinds' : [
\ 'm:modules:0:1',
\ 'd:data: 0:1',
\ 'd_gadt: data gadt:0:1',
\ 't:type names:0:1',
\ 'nt:new types:0:1',
\ 'c:classes:0:1',
\ 'cons:constructors:1:1',
\ 'c_gadt:constructor gadt:1:1',
\ 'c_a:constructor accessors:1:1',
\ 'ft:function types:1:1',
\ 'fi:function implementations:0:1',
\ 'o:others:0:1'
\ ],
\ 'sro' : '.',
\ 'kind2scope' : {
\ 'm' : 'module',
\ 'c' : 'class',
\ 'd' : 'data',
\ 't' : 'type'
\ },
\ 'scope2kind' : {
\ 'module' : 'm',
\ 'class' : 'c',
\ 'data' : 'd',
\ 'type' : 't'
\ }
\ }
" Generate haskell tags with codex and hscope
map <leader>tg :!codex update --force<CR>:call system("git hscope -X TemplateHaskell")<CR><CR>:call LoadHscope()<CR>
map <leader>tt :TagbarToggle<CR>
set csprg=~/.haskell-vim-now/bin/hscope
set csto=1 " search codex tags first
set cst
set csverb
nnoremap <silent> <C-\> :cs find c <C-R>=expand("<cword>")<CR><CR>
" Automatically make cscope connections
function! LoadHscope()
let db = findfile("hscope.out", ".;")
if (!empty(db))
let path = strpart(db, 0, match(db, "/hscope.out$"))
set nocscopeverbose " suppress 'duplicate connection' error
exe "cs add " . db . " " . path
set cscopeverbose
endif
endfunction
au BufEnter /*.hs call LoadHscope()
" }}}"
setlocal omnifunc=necoghc#omnifunc
let g:necoghc_enable_detailed_browse = 1
nmap <silent> <D-[> :bp<CR>
nmap <silent> <D-]> :bn<CR>
nmap <silent> <c-d> :bdelete<CR>
" Type of expression under cursor
nmap <silent> <c-t> :HdevtoolsType<CR>
nmap <silent> <c-i> :HdevtoolsInfo<CR>
" Change leader key
let mapleader = ","
" load indentation rules and plugins according to the detected filetype.
filetype on " enable filetype detection
filetype plugin indent on
filetype plugin on
let g:Tex_ViewRule_pdf = 'Preview'
"
" User Interface
"
" Syntax highlighting, only if the feature is available and the terminal can
" display colors
" (tabo@20040210) had to fix this because t_Co doesn't work in gvim@win32
if has('syntax') && (&t_Co > 2 || has('win32'))
syntax on " enable syntax highlighting
colorscheme default " load a colorscheme, it's redundant to use
endif
" Haskell mode
let g:syntastic_always_populate_loc_list = 1
let g:haddock_browser = "/usr/bin/open"
au BufEnter *.hs compiler ghc
set number
set guifont=Inconsolata:h18
set background=dark
set shortmess+=filmnrxoOtT " abbrev. of messages (avoids 'hit enter')
set showmode " display the current mode
set showcmd
"
" Statusline
"
set laststatus=2
"
" Editing
"
let g:rubycomplete_rails = 1
let g:python_highlight_all = 1
set backspace=indent,eol,start " backspace for dummys
set showmatch " show matching brackets/parenthesis
set wildmode=list:longest,full " comand <Tab> completion, list matches and
" complete the longest common part, then,
" cycle through the matches
set incsearch
set smartindent
set ignorecase
set smartcase
set cursorline
set nowrap " wrap long lines
set autoindent " indent at the same level of the previous line
set shiftwidth=2 " use indents of 4 spaces
set tabstop=2
set softtabstop=2
set smarttab
set matchpairs+=<:> " match, to be used with %
set expandtab " spaces instead of tabs, CTRL-V<Tab> to insert
" a real space
set pastetoggle=<F12> " pastetoggle (sane indentation on pastes)
" just press F12 when you are going to
" paste several lines of text so they won't
" be indented
" When in paste mode, everything is inserted
" literally.
"
" gvim- (here instead of .gvimrc)
"
if has('gui_running')
set lines=40 " 40 lines of text instead of 24,
colorscheme inkpot
endif
"
" misc, there is _always_ a misc section
"
set nobackup " real men _never_ _ever_ do backups
set directory=~/.vim/tmp
set encoding=utf8
@nicolasiensen

Copy link
Copy Markdown

Many thanks ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment