Skip to content

Instantly share code, notes, and snippets.

@heygema
Last active April 9, 2019 12:44
Show Gist options
  • Save heygema/7d4fd31d2bb2da06e088aa7d0412255c to your computer and use it in GitHub Desktop.
Save heygema/7d4fd31d2bb2da06e088aa7d0412255c to your computer and use it in GitHub Desktop.
Gema Anggada's vim setup
" =========
" Gema Anggada's VIM SETUP
" =========
" Tue Apr 9 18:07:55 2019
set nocompatible " be iMproved, required
filetype off " required
" =========
" PLUGINS
" =========
call plug#begin('~/.vim/bundle')
" appearances
Plug 'vim-airline/vim-airline'
Plug 'vim-airline/vim-airline-themes'
Plug 'ryanoasis/vim-devicons'
Plug 'morhetz/gruvbox'
"syntaxes
Plug 'mxw/vim-jsx'
Plug 'HerringtonDarkholme/yats.vim'
Plug 'jparise/vim-graphql'
Plug 'Quramy/tsuquyomi'
Plug 'neovimhaskell/haskell-vim'
Plug 'rust-lang/rust.vim'
Plug 'pangloss/vim-javascript'
Plug 'dag/vim-fish'
" tools
Plug 'Valloric/YouCompleteMe'
Plug 'prettier/vim-prettier', { 'do': 'yarn install' }
Plug 'tpope/vim-fugitive'
Plug 'scrooloose/nerdtree'
Plug 'kien/ctrlp.vim'
Plug 'w0rp/ale'
Plug 'jiangmiao/auto-pairs'
Plug 'tpope/vim-surround'
Plug 'prabirshrestha/async.vim'
" NOTE: this plugin is terribly slow
" Plug 'airblade/vim-gitgutter'
" ReasonML
Plug 'reasonml-editor/vim-reason-plus'
Plug 'autozimu/LanguageClient-neovim', {
\ 'branch': 'next',
\ 'do': 'bash install.sh',
\ }
" Plug 'Shougo/deoplete.nvim'
" Plug 'roxma/nvim-yarp'
" Plug 'roxma/vim-hug-neovim-rpc'
call plug#end()
filetype plugin indent on " required
" =========
" GENERAL SETTINGS
" =========
" THEMES
syntax enable
set cursorline
set hlsearch
set background=dark " Setting dark mode
let g:gruvbox_contrast_dark="medium"
let g:gruvbox_italic=1
colorscheme gruvbox
set encoding=UTF-8
set autoindent
set number
set smartindent
set guifont=Hack\ Regular\ Nerd\ Font\ Complete\ 11
set mouse=c
set foldenable
set backspace=2
" show existing tab with 4 spaces width
set tabstop=4
" when indenting with '>', use 4 spaces width
set shiftwidth=4
" On pressing tab, insert 4 spaces
set expandtab
let g:gitgutter_terminal_reports_focus=0
let g:ctrlp_custom_ignore = 'node_modules\|DS_Store\|git'
" =========
" STARTUP
" =========
function! StartUp()
if 0 == argc()
NERDTree
end
endfunction
autocmd VimEnter * call StartUp()
" =========
" EXPORTED FROM WINCENT
" ========
set scrolloff=3 " start scrolling 3 lines before edge of viewport
set shortmess+=A " ignore annoying swapfile messages
set shortmess+=I " no splash screen
set shortmess+=O " file-read message overwrites previous
set shortmess+=T " truncate non-file messages in middle
set shortmess+=W " don't echo "[w]"/"[written]" when writing
set shortmess+=a " use abbreviations in messages eg. `[RO]` instead of `[readonly]`
set shortmess+=o " overwrite file-written messages
set shortmess+=t " truncate file messages at start
" regarding swap files
if exists('$SUDO_USER')
set noswapfile " don't create root-owned files
else
set directory=~/local/.vim/tmp/swap//
set directory+=~/.vim/tmp/swap// " keep swap files out of the way
set directory=$HOME/.vim/tmp//
endif
" folding
if has('folding')
if has('windows')
let &fillchars='vert: ' " less cluttered vertical window separators
endif
set foldmethod=indent " not as cool as syntax, but faster
set foldlevelstart=99 " start unfolded
endif
" never trust vim with syntax enable
if !exists("g:syntax_on")
syntax enable
endif
" If you have vim >=8.0 or Neovim >= 0.1.5
if (has("termguicolors"))
set termguicolors
endif
" For Neovim 0.1.3 and 0.1.4
let $NVIM_TUI_ENABLE_TRUE_COLOR=1
" =========
" NERDTREE
" =========
let NERDTreeShowLineNumbers=1
let NERDTreeIgnore = ['\.git', '__pycache__', '\.pyc$', '\.o$', '\.so$', '\.a$', '\.swp', '*\.swp', '\.swo', '\.swn', '\.swh', '\.swm', '\.swl', '\.swk', '\.sw*$', '[a-zA-Z]*egg[a-zA-Z]*', '.DS_Store']
let NERDTreeShowHidden=1
let g:NERDTreeWinPos="left"
let g:NERDTreeDirArrows=0
map tt :NERDTreeToggle<CR>
" =========
" Asynchronous Lint Engine (ALE)
" =========
let g:ale_completion_enabled = 1
let g:ale_linters = {'javascript': ['flow', 'eslint']}
let g:ale_sign_error = 'X' " could use emoji
let g:ale_sign_warning = '!' " could use emoji
let g:ale_statusline_format = ['X %d', '! %d', '']
let g:ale_echo_msg_format = '[ALE] %linter% says %s'
nnoremap <leader>an :ALENextWrap<cr>
nnoremap <leader>ap :ALEPreviousWrap<cr>
" =========
" YouCompleteMe
" =========
if !exists("g:ycm_semantic_triggers")
let g:ycm_semantic_triggers = {}
endif
let g:ycm_semantic_triggers['typescript'] = ['.']
let g:ycm_filter_diagnostics = {
\ "javascript": {
\ "regex": [ "ts file" ],
\ }
\ }
let g:ycm_filter_diagnostics = { 'javascript': { 'regex': [ '.*' ] }, 'typescript': {'regex': [ '.*' ]} }
let g:ycm_show_diagnostics_ui = 0
" =======
" RUST.VIM
" =======
" let g:rustfmt_autosave = 1
" =========
" Haskell Vim
" =========
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
" =========
" Vim JS
" =========
let g:javascript_plugin_flow = 1
let g:jsx_ext_required = 0
" =========
" Tsuquyomi
" =========
autocmd FileType typescript nmap <buffer> <Leader>t : <C-u>echo tsuquyomi#hint()<CR>
" =========
" Prettier
" =========
autocmd BufWritePre *.ts,*.js,*.tsx,*.jsx :PrettierAsync<cr>
" =========
" Language CLient Neovim
" =========
let g:LanguageClient_serverCommands = {
\ 'reason': ['~/LanguageServer/reasonml/reason-language-server.exe'],
\ 'typescript': ['javascript-typescript-stdio'],
\ }
let g:LanguageClient_diagnosticsEnable = 0
nnoremap <silent> gd :call LanguageClient_textDocument_definition()<cr>
nnoremap <silent> gf :call LanguageClient_textDocument_formatting()<cr>
nnoremap <silent> <cr> :call LanguageClient_textDocument_hover()<cr>
" autocmd BufWritePre *.ml,*.re call LanguageClient_textDocument_formatting()
" =========
" Deoplete
" =========
" the path to python3 is obtained through executing `:echo exepath('python3')` in vim
let g:python3_host_prog = "/usr/local/bin/python3"
let g:python_host_prog = "/usr/local/bin/python"
" let g:deoplete#enable_at_startup = 1
" let g:deoplete#file#enable_buffer_path = 1
" deoplete-options-auto_complete*
" call deoplete#custom#option({
" \ 'auto_complete': v:false,
" \ 'smart_case': v:true,
" \ })
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment