Skip to content

Instantly share code, notes, and snippets.

@mauriciofierrom
Last active December 21, 2017 16:10
Show Gist options
  • Save mauriciofierrom/ef91286a45bda0bd01e1 to your computer and use it in GitHub Desktop.
Save mauriciofierrom/ef91286a45bda0bd01e1 to your computer and use it in GitHub Desktop.
Vim Config
" All system-wide defaults are set in $VIMRUNTIME/debian.vim and sourced by
" the call to :runtime you can find below. If you wish to change any of those
" settings, you should do it in this file (/etc/vim/vimrc), since debian.vim
" will be overwritten everytime an upgrade of the vim packages is performed.
" It is recommended to make changes after sourcing debian.vim since it alters
" the value of the 'compatible' option.
" This line should not be removed as it ensures that various options are
" properly set to work with the Vim-related packages available in Debian.
runtime! debian.vim
" Uncomment the next line to make Vim more Vi-compatible
" NOTE: debian.vim sets 'nocompatible'. Setting 'compatible' changes numerous
" options, so any other options should be set AFTER setting 'compatible'.
"set compatible
" Vim5 and later versions support syntax highlighting. Uncommenting the next
" line enables syntax highlighting by default.
syntax on
" If using a dark background within the editing area and syntax highlighting
" turn on this option as well
set background=dark
" Uncomment the following to have Vim jump to the last position when
" reopening a file
"if has("autocmd")
" au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif
"endif
" Uncomment the following to have Vim load indentation rules and plugins
" according to the detected filetype.
if has("autocmd")
filetype plugin indent on
endif
" The following are commented out as they cause vim to behave a lot
" differently from regular Vi. They are highly recommended though.
"set showcmd " Show (partial) command in status line.
"set showmatch " Show matching brackets.
"set ignorecase " Do case insensitive matching
"set smartcase " Do smart case matching
set incsearch " Incremental search
"set autowrite " Automatically save before commands like :next and :make
set autoindent
set bufhidden=delete
"set hidden " Hide buffers when they are abandoned
"set mouse=a " Enable mouse usage (all modes)
set nu
set showmode
set tw=80
set shiftwidth=2
set tabstop=2
set expandtab
set wildignore+=*\\tmp\\*,*.swp,*.swo,*.zip,.git,.cabal-sandbox
set wildmode=longest,list,full
set wildmenu
set completeopt+=longest
set t_Co=256
set cmdheight=2
set noshowmatch
set splitbelow
set splitright
" THis setting below makes space the vsplit character, but the space feels odd,
" so I removed it
" set fillchars+=vert:\
"set number relativenumber
" Source a global configuration file if available
"if filereadable("/etc/vim/vimrc.local")
" source /etc/vim/vimrc.local
"endif
" if (has("termguicolors"))
" set termguicolors
" endif
" set background=dark
" colorscheme spacemacs-theme
colorscheme molokai
let g:airline_powerline_fonts = 1
let g:airline#extensions#tabline#enabled = 1
let g:nerdtree_tabs_open_on_console_startup=1
set laststatus=2
nnoremap <silent> <F8> :NERDTreeToggle<CR>
let g:NERDTreeWinSize = 31
" Terminal mappings
"nnoremap <C-t> :vsplit term://zsh<CR><a>
"nnoremap <C-s> :sp term://zsh<CR><CR><a>
" Power fonts - needed for airline to render properly
set guifont=Roboto\ Mono\ for\ Powerline\ 9
" Autocomplete with Ctrl + Space
inoremap <expr> <C-Space> pumvisible() \|\| &omnifunc == '' ?
\ "\<lt>C-n>" :
\ "\<lt>C-x>\<lt>C-o><c-r>=pumvisible() ?" .
\ "\"\\<lt>c-n>\\<lt>c-p>\\<lt>c-n>\" :" .
\ "\" \\<lt>bs>\\<lt>C-n>\"\<CR>"
imap <C-@> <C-Space>
" Move to split buffers, even on terminal mode
nnoremap <C-J> <C-W><C-J>
nnoremap <C-K> <C-W><C-K>
nnoremap <C-L> <C-W><C-L>
nnoremap <C-H> <C-W><C-H>
tnoremap <Esc> <C-\><C-n>
tnoremap <A-h> <C-\><C-n><C-w>h
tnoremap <A-j> <C-\><C-n><C-w>j
tnoremap <A-k> <C-\><C-n><C-w>k
tnoremap <A-l> <C-\><C-n><C-w>l
nnoremap <A-h> <C-w>h
nnoremap <A-j> <C-w>j
nnoremap <A-k> <C-w>k
nnoremap <A-l> <C-w>l
" Syntastic stuff
map <Leader>s :SyntasticToggleMode<CR>
set statusline+=%#warningmsg#
set statusline+=%{SyntasticStatuslineFlag()}
set statusline+=%*
let g:syntastic_always_populate_loc_list = 1
let g:syntastic_auto_loc_list = 0
let g:syntastic_check_on_open = 1
let g:syntastic_check_on_wq = 0
" ghc-mod stuff
map <silent> tw :GhcModTypeInsert<CR>
map <silent> ts :GhcModSplitFunCase<CR>
map <silent> tq :GhcModType<CR>
map <silent> te :GhcModTypeClear<CR>
" Jump to definition
map <C-\> :tab split<CR>:exec("tag ".expand("<cword>"))<CR>
map <A-]> :vsp <CR>:exec("tag ".expand("<cword>"))<CR>
" Markdown stuff
let g:vim_markdown_no_extensions_in_markdown = 1
" Markdown Preview
let vim_markdown_preview_hotkey='<C-m>'
let vim_markdown_preview_github=1
" Silver searcher ag
let g:ackprg = 'ag --vimgrep --ignore tags'
" Hardtime vim enabled on all buffers
"let g:hardtime_default_on = 1
" Camel Case Motions with default mappings
map <silent> w <Plug>CamelCaseMotion_w
map <silent> b <Plug>CamelCaseMotion_b
map <silent> e <Plug>CamelCaseMotion_e
sunmap w
sunmap b
sunmap e
" Vimux settings
map <C-t> :VimuxPromptCommand<CR>
map <C-s> :VimuxRunLastCommand<CR>
map zz :VimuxZoomRunner<CR>
let g:VimuxOrientation = "h"
execute pathogen#infect()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment