Last active
March 17, 2019 13:31
-
-
Save alphashuro/e6a637e4003367192bb24b8d8fc668fd to your computer and use it in GitHub Desktop.
My vim config
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" kill vi compatibility | |
syntax enable | |
set fileformat=unix | |
set hidden | |
set number " always show line numbers | |
filetype plugin indent on | |
set tabstop=2 " 2 spaces per tab | |
set shiftwidth=2 " when indenting with > use 2 spaces | |
set expandtab " on pressing tab, insert 2 spaces | |
" show invisibles | |
set list | |
set listchars=tab:>-,trail:…,extends:>,precedes:< | |
" some symbols to use Ω≈ç√∫˜µ≤≥÷«æ¬˚∆˙©ƒ∂ßåœ∑´®†\¨ˆøπ““‘≠≠–ºª•¶§∞¢£™¡ | |
set autoread " automatically reload open files if they have not been edited | |
" Triger `autoread` when files changes on disk | |
" https://unix.stackexchange.com/questions/149209/refresh-changed-content-of-file-opened-in-vim/383044#383044 | |
" https://vi.stackexchange.com/questions/13692/prevent-focusgained-autocmd-running-in-command-line-editing-mode | |
autocmd FocusGained,BufEnter,CursorHold,CursorHoldI * if mode() != 'c' | checktime | endif | |
" Notification after file change | |
" https://vi.stackexchange.com/questions/13091/autocmd-event-for-autoread autocmd FileChangedShellPost * | |
\ echohl WarningMsg | echo "File changed on disk. Buffer reloaded." | echohl None | |
" why isn't space the default leader key?? | |
map <SPACE> <leader> | |
" plugin setup | |
if empty(glob('~/.vim/autoload/plug.vim')) | |
silent !curl -fLo ~/.vim/autoload/plug.vim --create-dirs | |
\ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim | |
autocmd VimEnter * PlugInstall --sync | source $MYVIMRC | |
endif | |
call plug#begin('~/.vim/plugged') | |
Plug 'junegunn/vim-easy-align' " easily align text nicely, see mappings below | |
Plug 'scrooloose/nerdtree', { 'on': 'NERDTreeToggle' } " file manager | |
Plug 'fatih/vim-go' " go syntax | |
Plug 'nsf/gocode' " go autocompletion | |
Plug 'pangloss/vim-javascript' " javascript syntax | |
Plug 'godlygeek/tabular' | |
Plug 'mattn/emmet-vim' | |
Plug 'vim-airline/vim-airline' " status bar | |
Plug 'vim-airline/vim-airline-themes' | |
Plug 'scrooloose/nerdcommenter' " nice commenting support | |
Plug 'majutsushi/tagbar' | |
Plug 'airblade/vim-gitgutter' | |
Plug 'lifepillar/vim-solarized8' " nice color theme yay | |
Plug 'ctrlpvim/ctrlp.vim' | |
Plug 'tpope/vim-surround' | |
Plug 'tpope/vim-fugitive' " git support :D | |
Plug 'rust-lang/rust.vim' | |
Plug 'Xuyuanp/nerdtree-git-plugin' | |
Plug 'prettier/vim-prettier', { 'do': 'npm install' } | |
Plug 'editorconfig/editorconfig-vim' | |
Plug 'wesQ3/vim-windowswap' | |
Plug 'w0rp/ale' | |
Plug 'mxw/vim-jsx' | |
Plug 'skywind3000/asyncrun.vim' | |
Plug 'vim-latex/vim-latex' | |
Plug 'leafgarland/typescript-vim' " typescript: syntax highlighting | |
Plug 'reasonml-editor/vim-reason-plus' | |
Plug 'autozimu/LanguageClient-neovim', { | |
\ 'branch': 'next', | |
\ 'do': 'bash install.sh' | |
\ } | |
Plug 'junegunn/fzf' " fuzzy file finder | |
Plug 'Shougo/deoplete.nvim' | |
Plug 'roxma/nvim-yarp' | |
Plug 'roxma/vim-hug-neovim-rpc' | |
Plug 'lokaltog/vim-easymotion' " highlight words with <leader>w for swift movement across a document | |
Plug 'Olical/vim-enmasse' " apply quick linting fixes easily with :EnMasse | |
Plug 'mileszs/ack.vim' " pattern search with :Ack [options] {pattern} [{directories}] | |
Plug 'morhetz/gruvbox' " nice theme apparently | |
" the path to python3 is obtained through executing `:echo exepath('python3')` in vim | |
let g:python3_host_prog = "/absolute/path/to/python3" | |
" Initialize plugin system | |
call plug#end() | |
" 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 g:tex_flavor = 'latex' | |
let g:javascript_plugin_jsdoc = 1 | |
let g:javascript_plugin_flow = 1 | |
let g:javascript_conceal_function = "ƒ" | |
let g:javascript_conceal_null = "ø" | |
let g:javascript_conceal_this = "@" | |
let g:javascript_conceal_return = "⇚" | |
let g:javascript_conceal_undefined = "¿" | |
let g:javascript_conceal_NaN = "ℕ" | |
let g:javascript_conceal_prototype = "¶" | |
let g:javascript_conceal_static = "•" | |
let g:javascript_conceal_super = "Ω" | |
let g:javascript_conceal_arrow_function = "⇒" | |
let g:javascript_conceal_noarg_arrow_function = "_" | |
" let g:javascript_conceal_underscore_arrow_function = "" | |
set conceallevel=1 | |
nmap <F8> :TagbarToggle<CR> | |
set statusline+=%#warningmsg# | |
set statusline+=%* | |
let g:rustfmt_autosave = 1 | |
" :ALEFix will try and fix your JS code with ESLint. | |
"\ 'javascript': ['eslint'], | |
"\ 'javascript': ['standard', 'prettier'] | |
" | |
let g:ale_fixers = { | |
\ 'typescript': ['prettier', 'tslint'], | |
\} | |
let g:ale_linters = { | |
\ 'typescript': ['tslint', 'tsserver', 'typecheck'], | |
\ 'javascript': ['semistandard'] | |
\} | |
" let g:ale_javascript_prettier_options = '' | |
let g:ale_fix_on_save = 1 | |
let g:ale_completion_enabled = 1 | |
let g:user_emmet_leader_key = '<Tab>' | |
let g:user_emmet_settings = { | |
\ 'javascript.jsx': { | |
\ 'extends': 'jsx', | |
\ }, | |
\} | |
" shortcuts for NERDTree | |
map <C-n> :NERDTreeToggle<CR> | |
map <C-f> <Esc>:NERDTreeFind<CR> "Find the current file in the file browser | |
" ignore folders in nerdtree | |
let g:NERDTreeIgnore=['node_modules', '.git', 'build'] | |
let g:NERDTreeNodeDelimiter = "\u00a0" | |
" normal mode shortcut, #noescapekey #thanksapple | |
imap jj <Esc> | |
" ctrl+p config | |
let g:ctrlp_show_hidden = 1 | |
set wildignore+=*/.git/*,*/.hg/*,*/.svn/*,*/node_modules/*,*/mysql/*,*/.wercker/* | |
let g:ctrlp_custom_ignore = 'node_modules\|DS_Store\|git|mysql\|.wercker\|katalon\|dist' | |
" fuzzy file finder config? | |
set rtp+=/usr/local/opt/fzf | |
let g:Tex_ViewRule_dvi='' | |
" Language completion setup | |
let g:LanguageClient_serverCommands = { | |
\ 'rust': ['~/.cargo/bin/rustup', 'run', 'stable', 'rls'], | |
\ 'javascript': ['/usr/local/bin/javascript-typescript-stdio'], | |
\ 'javascript.jsx': ['tcp://127.0.0.1:2089'], | |
\ 'python': ['/usr/local/bin/pyls'], | |
\ 'reason': ['~/bin/reason-language-server.exe'] | |
\ } | |
"let g:deoplete#enable_at_startup = 1 | |
set exrc | |
" Configure omni-completion's popup menu | |
" http://vim.wikia.com/wiki/Make_Vim_completion_popup_menu_work_just_like_in_an_IDE | |
set completeopt=longest,menuone | |
inoremap <expr> <CR> pumvisible() ? "\<C-y>" : "\<C-g>u\<CR>" | |
inoremap <expr> <C-n> pumvisible() ? '<C-n>' : | |
\ '<C-n><C-r>=pumvisible() ? "\<lt>Down>" : ""<CR>' | |
inoremap <expr> <M-,> pumvisible() ? '<C-n>' : | |
\ '<C-x><C-o><C-n><C-p><C-r>=pumvisible() ? "\<lt>Down>" : ""<CR>' | |
" open omni completion menu closing previous if open and opening new menu without changing the text | |
"inoremap <expr> <C-Space> (pumvisible() ? (col('.') > 1 ? '<Esc>i<Right>' : '<Esc>i') : '') . | |
"\ '<C-x><C-o><C-r>=pumvisible() ? "\<lt>C-n>\<lt>C-p>\<lt>Down>" : ""<CR>' | |
" open user completion menu closing previous if open and opening new menu without changing the text | |
"inoremap <expr> <S-Space> (pumvisible() ? (col('.') > 1 ? '<Esc>i<Right>' : '<Esc>i') : '') . | |
"\ '<C-x><C-u><C-r>=pumvisible() ? "\<lt>C-n>\<lt>C-p>\<lt>Down>" : ""<CR>' | |
" allows vim-gitgutter to show diff sooner | |
set updatetime=100 | |
" open auto-complete with ctrl space | |
"inoremap <C-Space> <C-x><C-o> | |
"imap <C-@> <C-Space> | |
" map ale intellisense functions to some hot keys | |
nnoremap <leader>h :ALEHover<CR> | |
nnoremap <leader>d :ALEGoToDefinition<CR> | |
nnoremap <leader>r :ALEFindReferences<CR> | |
" some solarised color fixes for tmux | |
let &t_8f = "\<Esc>[38;2;%lu;%lu;%lum" | |
let &t_8b = "\<Esc>[48;2;%lu;%lu;%lum" | |
set background=light | |
" colorscheme solarized8_flat |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment