Skip to content

Instantly share code, notes, and snippets.

@mvaldesdeleon
Created January 7, 2019 19:56
Show Gist options
  • Save mvaldesdeleon/b8304ce09c11f97d0ccb7bbc490b95fb to your computer and use it in GitHub Desktop.
Save mvaldesdeleon/b8304ce09c11f97d0ccb7bbc490b95fb to your computer and use it in GitHub Desktop.
set nocompatible
set noswapfile
set number
set cursorline
set encoding=utf-8
syntax enable
filetype plugin indent on
set tabstop=4
set shiftwidth=4
set expandtab
set autoindent
set list
set listchars=tab:██,trail:█,nbsp:█
set wrap
" Seems to be reset by specific filetypes
set formatoptions-=to
set linebreak
set breakindent
set scrolloff=5
set showmatch
set incsearch
set hlsearch
set ignorecase
set smartcase
set magic
set mouse=a
call plug#begin('~/.config/nvim/plugged')
" Plug 'Shougo/vimproc.vim', {'do' : 'make'}
Plug 'vim-airline/vim-airline'
Plug 'vim-airline/vim-airline-themes'
Plug 'tomasr/molokai'
Plug 'tpope/vim-surround'
Plug 'tpope/vim-commentary'
Plug 'tpope/vim-fugitive'
Plug 'tpope/vim-repeat'
Plug 'tpope/vim-abolish'
Plug 'othree/yajs.vim'
Plug 'othree/javascript-libraries-syntax.vim'
Plug 'HerringtonDarkholme/yats.vim'
" Plug 'Quramy/tsuquyomi'
" Consider mhartington/nvim-typescript also
" or clausreinke/typescript-tools.vim
Plug 'elmcast/elm-vim'
Plug 'tpope/vim-jdaddy'
Plug 'valloric/MatchTagAlways'
Plug 'neovimhaskell/haskell-vim'
Plug 'parsonsmatt/intero-neovim'
Plug 'Twinside/vim-hoogle'
Plug 'scrooloose/nerdtree', { 'on': 'NERDTreeToggle' }
Plug 'dyng/ctrlsf.vim'
Plug 'ctrlpvim/ctrlp.vim'
Plug 'easymotion/vim-easymotion'
Plug 'terryma/vim-multiple-cursors'
Plug 'airblade/vim-gitgutter' " Git gutter, duh
Plug 'kshenoy/vim-signature' " Marks in the gutter and navigation
Plug 'ntpeters/vim-better-whitespace' " Better whitespace, duh
Plug 'nathanaelkane/vim-indent-guides' " Indent guides, duh
Plug 't9md/vim-choosewin' " Navigate between windows/splits
Plug 'matze/vim-move' " Move text up and down
Plug 'moll/vim-bbye' " Preserve layout when closing buffers
Plug 'gregsexton/gitv' " Git stuff, have to red docs
Plug 'haya14busa/incsearch.vim'
" Plug 'haya14busa/is.vim' " Superseedes incsearch.vim
Plug 'haya14busa/incsearch-easymotion.vim'
Plug 'vim-scripts/ReplaceWithRegister'
Plug 'bkad/CamelCaseMotion'
" Plug 'chaoren/vim-wordmotion' " Might replace CamelCaseMotion
Plug 'chiedo/vim-case-convert'
Plug 'kana/vim-textobj-user'
Plug 'michaeljsmith/vim-indent-object'
Plug 'kana/vim-textobj-entire'
Plug 'glts/vim-textobj-comment'
Plug 'haya14busa/vim-textobj-function-syntax'
Plug 'sgur/vim-textobj-parameter'
Plug 'kana/vim-textobj-line'
Plug 'majutsushi/tagbar'
Plug 'vim-scripts/SyntaxComplete'
Plug 'w0rp/ale'
Plug 'ryanoasis/vim-devicons'
call plug#end()
set t_Co=256 " no docs, no idea what this is for
colorscheme molokai
set background=dark
" Copied over AS-IS for now
" Return to last edit position when opening files (You want this!)
autocmd BufReadPost *
\ if line("'\"") > 0 && line("'\"") <= line("$") |
\ exe "normal! g`\"" |
\ endif
let g:ctrlp_extensions = ['tag']
let g:ctrlp_custom_ignore = {
\ 'dir': '\v[\/](node_modules|bower_components|dist)$'
\ }
let g:ctrlp_match_window = 'results:100'
let g:ctrlsf_ignore_dir = ['node_modules', 'bower_components', 'dist']
let g:airline#extensions#tabline#enabled = 1
let g:airline#extensions#ale = 1
let g:airline_powerline_fonts = 1
let g:airline_theme='molokai'
let g:molokai_original = 1
let g:rehash256 = 1
let mapleader="\<SPACE>"
" nnoremap ; :
" nnoremap : ;
" Clear search
nmap <Leader>c :nohlsearch<CR>
" Relative numbering
function! NumberToggle()
if(&relativenumber == 1)
set nornu
else
set rnu
endif
endfunc
nnoremap <Leader>o :CtrlPRoot<CR>
nnoremap <Leader>p :CtrlPCurWD<CR>
nnoremap <Leader>f :CtrlSF<space>
nnoremap <Leader><Leader>f :CtrlSFToggle<CR>
nnoremap <Leader>w :Bdelete<CR>
" nnoremap <Leader>s :w<CR>
" nnoremap <Leader><C-s> :wa<CR>
" nnoremap <Leader>q :q<CR>
" nnoremap <Leader><C-q> :qa<CR>
" Toggle between normal and relative numbering.
nnoremap <silent> <Leader>r :call NumberToggle()<CR>
nnoremap <Leader>t :NERDTreeToggle<CR>
nnoremap <Leader>y :TagbarToggle<CR>
" Smart indent when entering insert mode with i on empty lines
function! IndentWithI()
if len(getline('.')) == 0
return "\"_cc"
else
return "i"
endif
endfunction
nmap <silent> <expr> i IndentWithI()
" let g:move_key_modifier = 'C'
" nmap <Leader>` <Plug>(choosewin)
" let g:choosewin_overlay_enable = 1
" map / <Plug>(incsearch-forward)
" map ? <Plug>(incsearch-backward)
" map g/ <Plug>(incsearch-stay)
" let g:incsearch#auto_nohlsearch = 1
" map n <Plug>(incsearch-nohl-n)
" map N <Plug>(incsearch-nohl-N)
" map * <Plug>(incsearch-nohl-*)
" map # <Plug>(incsearch-nohl-#)
" map g* <Plug>(incsearch-nohl-g*)
" map g# <Plug>(incsearch-nohl-g#)
" You can use other keymappings like <C-l> instead of <CR> if you want to
" use these mappings as default search and somtimes want to move cursor with
" EasyMotion.
" function! s:incsearch_config(...) abort
" return incsearch#util#deepextend(deepcopy({
" \ 'modules': [incsearch#config#easymotion#module({'overwin': 1})],
" \ 'keymap': {
" \ "\<CR>": '<Over>(easymotion)'
" \ },
" \ 'is_expr': 0
" \ }), get(a:, 1, {}))
" endfunction
" noremap <silent><expr> / incsearch#go(<SID>incsearch_config())
" noremap <silent><expr> ? incsearch#go(<SID>incsearch_config({'command': '?'}))
" noremap <silent><expr> g/ incsearch#go(<SID>incsearch_config({'is_stay': 1}))
" Tab navigation in completions
" inoremap <expr><TAB> pumvisible() ? "\<C-n>" : "\<TAB>"
let g:used_javascript_libs = 'tape,ramda,jasmine,chai'
" let g:indent_guides_auto_colors = 0
" let g:indent_guides_guide_size = 1
" let g:indent_guides_start_level = 2
" autocmd VimEnter,Colorscheme * :hi IndentGuidesOdd ctermbg=0
" autocmd VimEnter,Colorscheme * :hi IndentGuidesEven ctermbg=0
let g:mta_filetypes = {
\ 'html' : 1,
\ 'xhtml' : 1,
\ 'xml' : 1,
\ 'jinja' : 1
\}
let g:python2_host_prog = '/usr/local/bin/python'
let g:python3_host_prog = '/usr/local/bin/python3'
let g:elm_setup_keybindings = 0
let g:ale_javascript_prettier_use_local_config = 1
let g:ale_fix_on_save = 1
let g:ale_fixers = {}
let g:ale_fixers['javascript'] = ['prettier']
let g:ale_fixers['typescript'] = ['prettier']
let g:ale_fixers['haskell'] = ['hfmt']
let g:ale_linters = {
\ 'haskell': ['stack-ghc', 'hlint'],
\}
let g:ale_haskell_hlint_executable = 'stack'
let g:ale_haskell_hfmt_executable = 'stack'
let g:haskell_classic_highlighting = 1 " More normal highlighting
let g:haskell_enable_quantification = 1 " to enable highlighting of `forall`
let g:haskell_enable_recursivedo = 1 " to enable highlighting of `mdo` and `rec`
" let g:haskell_enable_arrowsyntax = 1 " to enable highlighting of `proc`
" let g:haskell_enable_pattern_synonyms = 1 " to enable highlighting of `pattern`
" let g:haskell_enable_typeroles = 1 " to enable highlighting of type roles
" let g:haskell_enable_static_pointers = 1 " to enable highlighting of `static`
" let g:haskell_backpack = 1 " to enable highlighting of backpack keywords
" let g:haskell_indent_disable = 1
let g:haskell_indent_if = 4
let g:haskell_indent_case = 4
let g:haskell_indent_let = 4
let g:haskell_indent_before_where = 2
let g:haskell_indent_after_bare_where = 2
let g:haskell_indent_in = 1
let g:haskell_indent_guard = 4
" Maps for intero. Restrict to Haskell buffers so the bindings don't collide.
augroup interoMaps
au!
" InteroRestart, InteroEval, InteroSend, InteroReload, InteroTypeInsert
" InteroUseAllTargets, InteroClearTargetCache (skip)
"
" Background process and window management
au FileType haskell nnoremap <silent> <leader>is :InteroStart<CR>
au FileType haskell nnoremap <silent> <leader>ik :InteroKill<CR>
" Open intero/GHCi split horizontally
au FileType haskell nnoremap <silent> <leader>io :InteroOpen<CR>
" Open intero/GHCi split vertically
au FileType haskell nnoremap <silent> <leader>iov :InteroOpen<CR><C-W>H
au FileType haskell nnoremap <silent> <leader>ih :InteroHide<CR>
" Reloading (pick one)
" Automatically reload on save
" au BufWritePost *.hs InteroReload
" Manually save and reload
au FileType haskell nnoremap <silent> <leader>wr :w \| :InteroReload<CR>
" Load individual modules
au FileType haskell nnoremap <silent> <leader>il :InteroLoadCurrentModule<CR>
au FileType haskell nnoremap <silent> <leader>if :InteroLoadCurrentFile<CR>
" Type-related information
" Heads up! These next two differ from the rest.
au FileType haskell map <silent> <leader>ht <Plug>InteroGenericType
au FileType haskell map <silent> <leader>hT <Plug>InteroType
au FileType haskell nnoremap <silent> <leader>it :InteroTypeInsert<CR>
" Navigation
au FileType haskell nnoremap <silent> <leader>jd :InteroGoToDef<CR>
" Managing targets
" Prompts you to enter targets (no silent):
au FileType haskell nnoremap <leader>ist :InteroSetTargets<SPACE>
augroup END
" let g:intero_start_immediately = 0 " Intero starts automatically. Set this if you'd like to prevent that.
" let g:intero_type_on_hover = 1 " Enable type information on hover (when holding cursor at point for ~1 second).
let g:intero_window_size = 15 " Change the intero window size; default is 10.
" let g:intero_vertical_split = 1 " Sets the intero window to split vertically; default is horizontal
" set updatetime=1000 " Make the update time shorter, so the type info will trigger faster.
let g:hoogle_search_bin = 'stack hoogle -- '
autocmd FileType lhaskell setlocal formatoptions+=ro
nmap <silent> <Leader>< <Plug>(ale_previous_wrap)
nmap <silent> <Leader>> <Plug>(ale_next_wrap)
nmap <silent> <Leader>? <Plug>(ale_detail)
if has("autocmd") && exists("+omnifunc")
autocmd Filetype *
\ if &omnifunc == "" |
\ setlocal omnifunc=syntaxcomplete#Complete |
\ endif
endif
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment