Skip to content

Instantly share code, notes, and snippets.

@TrySound
Last active May 31, 2020 14:31
Show Gist options
  • Save TrySound/869e20838936f1d6cd12ddf2c4e7fe4e to your computer and use it in GitHub Desktop.
Save TrySound/869e20838936f1d6cd12ddf2c4e7fe4e to your computer and use it in GitHub Desktop.
my dotfiles
call plug#begin('~/.vim/plugged')
" syntax
Plug 'yuezk/vim-js'
Plug 'maxmellon/vim-jsx-pretty'
Plug 'leafgarland/typescript-vim'
Plug 'reasonml-editor/vim-reason-legacy'
" theme
Plug 'matthewtodd/vim-twilight'
Plug 'andreypopp/vim-colors-plain'
" fs
Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' }
Plug 'andreypopp/fzf.vim'
" Editing
Plug 'matze/vim-move'
Plug 'w0rp/ale'
Plug 'lifepillar/vim-mucomplete'
Plug 'prabirshrestha/async.vim'
Plug 'prabirshrestha/vim-lsp'
call plug#end()
syntax on
filetype plugin on
set clipboard+=unnamedplus
set list
set listchars=space:.
set ignorecase
set smartcase
set autoread
set laststatus=2
set rnu
set nu
set splitright
set splitbelow
let g:mapleader=','
let g:maplocalleader='\\'
let g:loaded_netrwPlugin = 1
" indentation
set tabstop=2
set shiftwidth=2
set softtabstop=2
set expandtab
" plugins config
colorscheme twilight
" set background=dark
" colorscheme plain
au BufRead,BufNewFile *.js.flow setlocal ft=javascript
let g:vim_jsx_pretty_highlight_close_tag = 1
" mucomplete
" set completeopt+=menuone
set completeopt+=noselect
let g:mucomplete#enable_auto_at_startup = 1
let g:mucomplete#buffer_relative_paths = 1
" disable default sql
let g:loaded_sql_completion = 0
let g:omni_sql_no_default_maps = 1
let g:ftplugin_sql_omni_key = '<Plug>DisableSqlOmni'
au BufRead,BufNewFile *.sql set completeopt-=menuone
au BufRead,BufNewFile *.sql set completeopt-=noselect
language en_US.UTF-8
" move config
let g:move_key_modifier = 'C'
" ale
let g:ale_linters = {
\ 'typescript': ['tsserver'],
\ 'javascript': ['flow-language-server'],
\ 'html': [],
\ 'sql': [],
\}
let g:ale_fixers = {
\ 'typescript': ['prettier'],
\ 'javascript': ['prettier'],
\ 'json': ['prettier'],
\ 'css': ['prettier'],
\ 'html': ['prettier'],
\ 'xml': ['prettier'],
\ 'markdown': ['prettier'],
\ 'reason': ['refmt'],
\}
let g:ale_javascript_prettier_use_local_config = 1
nmap <silent> <C-n> <Plug>(ale_next_wrap)
nmap <Leader>p <Plug>(ale_fix)
" configure nice looking errors highlight
:hi SpellBad ctermbg=NONE ctermfg=1
set omnifunc=ale#completion#OmniFunc
let g:ale_completion_enabled = 1
let g:ale_lint_delay = 500
let g:ale_lint_on_text_changed = 'normal'
let g:ale_lint_on_insert_leave = 1
let g:ale_lint_on_save = 1
let g:ale_lint_on_enter = 1
let g:ale_sign_column_always = 1
if has('statusline')
function! ALEWarnings() abort
let l:counts = ale#statusline#Count(bufnr(''))
let l:all_errors = l:counts.error + l:counts.style_error
let l:all_non_errors = l:counts.total - l:all_errors
return l:counts.total == 0 ? '' : printf('WARN:%d', all_non_errors)
endfunction
function! ALEErrors() abort
let l:counts = ale#statusline#Count(bufnr(''))
let l:all_errors = l:counts.error + l:counts.style_error
let l:all_non_errors = l:counts.total - l:all_errors
return l:counts.total == 0 ? '' : printf('ERR:%d', all_errors)
endfunction
function! ALEStatus() abort
let l:counts = ale#statusline#Count(bufnr(''))
let l:all_errors = l:counts.error + l:counts.style_error
let l:all_non_errors = l:counts.total - l:all_errors
return l:counts.total == 0 ? 'OK' : ''
endfunction
set laststatus=2
set statusline=%<%f
set statusline+=%w%h%m%r
set statusline+=\ %y
set statusline+=%=%-14.(%l,%c%V%)\ %p%%\
set statusline+=\%#StatusLineOk#%{ALEStatus()}
set statusline+=\%#StatusLineError#%{ALEErrors()}
set statusline+=\%#StatusLineWarning#%{ALEWarnings()}
endif
" aliases
au BufRead,BufNewFile *.js nnoremap <C-t> :ALEHover<CR>
au BufRead,BufNewFile *.ml nnoremap <C-t> :MerlinTypeOf<CR>
nmap <C-p> :Files<CR>
nmap <C-x> :Ag<CR>
let $FZF_DEFAULT_COMMAND = 'ag -l
\ --nocolor
\ --hidden
\ --ignore .git
\ --ignore .DS_Store
\ --ignore coverage
\ --ignore node_modules
\ -g ""'
set undodir=~/.config/nvim/undodir
set nofsync
cnoreabbrev rc e ~/.config/nvim/init.vim
cnoreabbrev notes e ~/host/notes.txt
hi Pmenu ctermbg=252
" lock arrows
inoremap <Up> <nop>
inoremap <Down> <nop>
inoremap <Left> <nop>
inoremap <Right> <nop>
noremap <Up> <nop>
noremap <Down> <nop>
noremap <Left> <nop>
noremap <Right> <nop>
font_size 12.0
map ctrl+shift+enter new_window_with_cwd
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment