Skip to content

Instantly share code, notes, and snippets.

@cdwills
Created June 9, 2020 22:19
Show Gist options
  • Save cdwills/931a4eb4da19a9669d2e9c30e7ddc997 to your computer and use it in GitHub Desktop.
Save cdwills/931a4eb4da19a9669d2e9c30e7ddc997 to your computer and use it in GitHub Desktop.
" VIM REDUX 2018
set nocompatible
call plug#begin('~/.local/share/nvim/plugged')
" Plug 'hail2u/vim-css3-syntax'
" brew install fzf
Plug '/usr/local/opt/fzf'
Plug 'junegunn/fzf.vim'
Plug 'ervandew/supertab'
Plug 'Shougo/deoplete.nvim', { 'do': ':UpdateRemotePlugins' }
Plug 'carlitux/deoplete-ternjs', { 'do': 'npm install -g tern', 'for': ['javascript', 'javascript.jsx'] }
" == JavaScript syntax highlighting ==
Plug 'othree/yajs.vim', { 'for': ['javascript', 'javascript.jsx'] }
Plug 'othree/es.next.syntax.vim', { 'for': ['javascript', 'javascript.jsx'] }
Plug 'mxw/vim-jsx', { 'for': ['javascript', 'javascript.jsx'] }
Plug 'othree/javascript-libraries-syntax.vim', { 'for': ['javascript', 'javascript.jsx'] }
Plug 'elzr/vim-json', { 'for': 'json' }
Plug 'digitaltoad/vim-pug'
Plug 'elixir-lang/vim-elixir'
Plug 'slashmili/alchemist.vim'
Plug 'kana/vim-operator-user'
Plug 'haya14busa/vim-operator-flashy'
Plug 'tpope/vim-eunuch'
Plug 'rizzatti/dash.vim'
Plug 'w0rp/ale'
let g:ale_linters = {
\ 'javascript': ['eslint'],
\}
let g:ale_fixers = {
\ 'javascript': ['eslint'],
\}
Plug 'mhinz/vim-signify'
" let g:ale_javascript_eslint_executable = '~/.nodenv/shins/node'
" Plug 'fatih/vim-go'
Plug 'junegunn/vim-easy-align'
Plug 'hashivim/vim-terraform'
" themes
" Plug 'w0ng/vim-hybrid'
" Plug 'mhartington/oceanic-next'
" Plug 'trevordmiller/nova-vim'
" Plug 'morhetz/gruvbox'
" Plug 'AlessandroYorba/Sierra'
Plug 'jacoborus/tender.vim'
" Plug 'KeitaNakamura/neodark.vim'
" Plug 'hail2u/vim-css3-syntax'
" Plug 'ajmwagar/vim-dues'
Plug 'patstockwell/vim-monokai-tasty'
Plug 'Yggdroot/indentLine'
Plug 'Raimondi/delimitMate'
"Plug 'valloric/MatchTagAlways'
Plug 'AndrewRadev/switch.vim'
" Plug 'christoomey/vim-tmux-navigator'
Plug 'itchyny/lightline.vim'
Plug 'maximbaz/lightline-ale'
Plug 'itchyny/vim-gitbranch'
Plug 'tpope/vim-surround'
Plug 'tomtom/tcomment_vim'
" Plug 'mattn/emmet-vim'
" Plug 'Chiel92/vim-autoformat'
Plug 'gorodinskiy/vim-coloresque'
Plug 'andreypopp/vim-colors-plain'
Plug 'Lokaltog/vim-monotone'
Plug 'rhysd/github-complete.vim'
" Plug 'tpope/vim-vinegar'
Plug 'justinmk/vim-dirvish'
let dirvish_mode = ':sort | sort ,^.*/,'
" haskell
" Plug 'wlangstroth/vim-haskell'
" Plug 'alx741/vim-stylishask'
" Plug 'digitaltoad/vim-pug'
call plug#end()
let g:signify_vcs_list = [ 'git' ]
" Neovim Settings
" let $NVIM_TUI_ENABLE_CURSOR_SHAPE=1
set termguicolors
let $NEOVIM_JS_DEBUG='~/.nvimjsdebug'
set clipboard+=unnamedplus
imap jj <Esc>
highlight clear SignColumn
set autowrite
set showcmd " Display incomplete commands.
set showmode " Display the mode you're in.
set backspace=indent,eol,start " Intuitive backspacing.
set hidden " Handle multiple buffers better.
set wildmenu " Enhanced command line completion.
set wildmode=list:longest " Complete files like a shell.
set ignorecase " Case-insensitive searching.
set smartcase " But case-sensitive if expression contains a capital letter.
set virtualedit= "
set number " Show line numbers.
set ruler " Show cursor position.
set incsearch " Highlight matches as you type.
set hlsearch " Highlight matches.
set wrap " Turn on line wrapping.
set scrolloff=3 " Show 3 lines of context around the cursor.
set visualbell " No beeping.
set nobackup " Don't make a backup before overwriting a file.
set nowritebackup " And again.
set noswapfile
set tabstop=2 " Global tab width.
set shiftwidth=2 " And again, related.
set expandtab " Use spaces instead of tabs
set laststatus=2 " Show the status line all the time
set lazyredraw " for airline
set ttimeoutlen=10
set noshowmode
set undofile
set undodir="$HOME/.VIM_UNDO_FILES" " Remember cursor position between vim sessions
" Theme
syntax enable
" let g:hybrid_custom_term_colors = 1
" let g:hybrid_reduced_contrast = 1
" let g:sierra_Twilight = 1
"colorscheme plain
" let g:vim_monokai_tasty_italic = 1
let g:monotone_color = [120, 100, 70] " Sets theme color to bright green
let g:monotone_secondary_hue_offset = 200 " Offset secondary colors by 200 degrees
let g:monotone_emphasize_comments = 1 " Emphasize comments
set background=dark
colorscheme tender
" highlightt the current line number
hi CursorLineNR guifg=#ffffff
" no need to fold things in markdown all the time
" enable deoplete
" let g:deoplete#enable_at_startup = 1
" let g:deoplete#enable_smart_case=1
let g:lightline = {
\ 'colorscheme': 'tender',
\ }
let g:lightline.component_expand = {
\ 'linter_checking': 'lightline#ale#checking',
\ 'linter_warnings': 'lightline#ale#warnings',
\ 'linter_errors': 'lightline#ale#errors',
\ 'linter_ok': 'lightline#ale#ok',
\ }
let g:lightline.component_type = {
\ 'linter_checking': 'left',
\ 'linter_warnings': 'warning',
\ 'linter_errors': 'error',
\ 'linter_ok': 'left',
\ }
let g:lightline.active = {
\ 'left': [ [ 'mode', 'paste' ],
\ [ 'readonly', 'filename', 'modified' ] ],
\ 'right': [ [ 'lineinfo' ],
\ [ 'linter_checking', 'linter_errors', 'linter_warnings', 'linter_ok' ],
\ [ 'percent' ],
\ [ 'fileformat', 'fileencoding', 'filetype' ] ] }
let g:lightline.inactive = {
\ 'left': [ [ 'filename' ] ],
\ 'right': [ [ 'lineinfo' ],
\ [ 'percent' ] ] }
let g:lightline.tabline = {
\ 'left': [ [ 'tabs' ] ],
\ 'right': [ [ 'close' ] ] }
highlight clear SignColumn
" let g:airline_theme = "tender"
" let g:airline#extensions#tmuxline#enabled = 0
" let g:airline#extensions#tabline#enabled = 1
" let g:airline_left_sep = '' " Remove arrow symbols.
" let g:airline_left_alt_sep = '' " Remove arrow symbols.
" let g:airline_right_sep = '' " Remove arrow symbols.
" let g:airline_right_alt_sep = '' " Remove arrow symbols.
hi clear SpellBad
hi SpellBad term=underline cterm=underline guifg=red
hi clear ALEErrorSign
hi ALEErrorSign term=underline cterm=underline guifg=red
hi SignifySignAdd gui=bold guifg=darkgreen
hi SignifySignDelete gui=bold guifg=darkred
hi SignifySignChange gui=bold guifg=yellow
hi Visual guifg=black guibg=white
" Get off my lawn
nnoremap <Left> :echoe "Use h"<CR>
nnoremap <Right> :echoe "Use l"<CR>
nnoremap <Up> :echoe "Use k"<CR>
nnoremap <Down> :echoe "Use j"<CR>
nnoremap Q <nop> " disable ex mode
map q <Nop> " turn off recording macros
" exit insert, dd line, enter insert
"inoremap <c-d> <esc>ddi
noremap H ^
noremap L g_
noremap J 5j
noremap K 5k
" this is the best, let me tell you why
" how annoying is that everytime you want to do something in vim
" you have to do shift-; to get :, can't we just do ;?
" Plus what does ; do anyways??
" if you do have a plugin that needs ;, you can just wap the mapping
" nnoremap : ;
" give it a try and you will like it
nnoremap ; :
inoremap <c-f> <c-x><c-f>
" Copy to osx clipboard
vnoremap <C-c> "*y<CR>
vnoremap y "*y<CR>
nnoremap Y "*Y<CR>
let g:multi_cursor_next_key='<C-n>'
let g:multi_cursor_prev_key='<C-p>'
let g:multi_cursor_skip_key='<C-x>'
let g:multi_cursor_quit_key='<Esc>'
" Align blocks of text and keep them selected
vmap < <gv
vmap > >gv
nnoremap <leader>d "_d
vnoremap <leader>d "_d
vnoremap <c-/> :TComment<cr>
map <esc> :noh<cr>
" Start interactive EasyAlign in visual mode (e.g. vipga)
xmap ga <Plug>(EasyAlign)
" Start interactive EasyAlign for a motion/text object (e.g. gaip)
nmap ga <Plug>(EasyAlign)
let mapleader=","
map <leader>tt :tabnew<cr>
nnoremap <Leader>w :w<CR>
nnoremap <Leader>q :q!<CR>
map y <Plug>(operator-flashy)
nmap Y <Plug>(operator-flashy)$
" ale stuff
let g:ale_sign_column_always = 1
let g:ale_sign_error = '>>'
let g:ale_sign_warning = '--'
" let g:ale_javascript_eslint_use_global = 1
nmap <silent> <C-u> <Plug>(ale_previous_wrap)
nmap <silent> <C-i> <Plug>(ale_next_wrap)
" split nav, now it is ctrl-j instead of ctrl-w j
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>
set splitbelow
set splitright
" let g:neomake_javascript_enabled_makers = ['jshint']
" autocmd! BufWritePost * Neomake
" let g:neomake_javascript_jshint_maker = {
" \ 'args': ['--verbose'],
" \ 'errorformat': '%A%f: line %l\, col %v\, %m \(%t%*\d\)',
" \ }
"let g:fzf_layout = { 'up': '12' } " Position the default fzf window layout.
let g:fzf_command_prefix = 'Fzf' " Prefix fzf commands e.g. :FzfFiles.
let $FZF_DEFAULT_COMMAND = 'ag --hidden --ignore .git -g ""'
nnoremap <Leader>f :FzfFiles<CR>
nnoremap <Leader>b :FzfBuffers<CR>
nnoremap <Leader>ag :FzfAg<CR>
" Plugin key-mappings.
imap <C-k> <Plug>(neosnippet_expand_or_jump)
smap <C-k> <Plug>(neosnippet_expand_or_jump)
xmap <C-k> <Plug>(neosnippet_expand_target)
" custom whitespace haskell
autocmd FileType haskell set tabstop=8
autocmd FileType haskell set softtabstop=4
autocmd FileType haskell set shiftwidth=4
autocmd FileType haskell set shiftround
" SuperTab like snippets behavior.
"imap <expr><TAB>
" \ pumvisible() ? "\<C-n>" :
" \ neosnippet#expandable_or_jumpable() ?
" \ "\<Plug>(neosnippet_expand_or_jump)" : "\<TAB>"
smap <expr><TAB> neosnippet#expandable_or_jumpable() ?
\ "\<Plug>(neosnippet_expand_or_jump)" : "\<TAB>"
" For conceal markers.
if has('conceal')
set conceallevel=2 concealcursor=niv
endif
" nuke whitespace
autocmd BufWritePre * %s/\s\+$//e
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment