Skip to content

Instantly share code, notes, and snippets.

@kjkta
Last active March 10, 2020 08:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kjkta/2b84f71961e2b7a209503415dd2f3e61 to your computer and use it in GitHub Desktop.
Save kjkta/2b84f71961e2b7a209503415dd2f3e61 to your computer and use it in GitHub Desktop.
" Plugins will be downloaded under the specified directory.
call plug#begin('~/.vim/plugged')
" General
Plug 'vim-airline/vim-airline'
Plug 'airblade/vim-gitgutter'
Plug 'git@github.com:dracula/vim.git', { 'as': 'dracula' }
Plug 'ctrlpvim/ctrlp.vim'
Plug 'mileszs/ack.vim'
" JS
Plug 'yuezk/vim-js'
Plug 'maxmellon/vim-jsx-pretty'
Plug 'neoclide/coc.nvim', {'branch': 'release'}
Plug 'leafgarland/typescript-vim'
" Reason
Plug 'reasonml-editor/vim-reason-plus'
" List ends here. Plugins become visible to Vim after this call.
call plug#end()
" enable syntax and plugins (for netrw)
syntax on
filetype plugin on
colorscheme dracula
let g:airline_theme='dracula'
let g:jsx_ext_required = 0
let g:vim_jsx_pretty_colorful_config = 1
if (has("termguicolors"))
set termguicolors
endif
" enter the current millenium
set nocompatible
" Search down into subfolders
" Provides tab-completion for all file-related tasks
set path+=**
" Display all matching files when we tab complete
set wildmenu
set wildignore+=**/node_modules/**
set wildignore+=**/env/**
set wildignore+=**/__pycache__/**
filetype plugin indent on
set laststatus=2
set colorcolumn=80
set tabstop=2
set softtabstop=2
set shiftwidth=2
set expandtab
set number relativenumber
set complete=.,w,b,u,U,t,i,d
set showmatch
set autoread
set clipboard=unnamed
set backupcopy=yes
set hlsearch
set cursorline
" Persistent undo
set undofile
set backupdir=~/.vim/backup//
set directory=~/.vim/swap//
set undodir=~/.vim/undo//
" Tweaks for browsing
let g:netrw_liststyle=3 " tree view
let g:netrw_altv=1 " open splits to the right
" Better display for messages
set cmdheight=2
" You will have bad experience for diagnostic messages when it's default 4000.
set updatetime=100
" don't give |ins-completion-menu| messages.
set shortmess+=c
" always show signcolumns
set signcolumn=yes
" turn off autocomplete
let g:coc_snippet_active = 0
" Use tab for trigger completion with characters ahead and navigate.
" Use command ':verbose imap <tab>' to make sure tab is not mapped by other plugin.
inoremap <silent><expr> <TAB>
\ pumvisible() ? "\<C-n>" :
\ <SID>check_back_space() ? "\<TAB>" :
\ coc#refresh()
inoremap <expr><S-TAB> pumvisible() ? "\<C-p>" : "\<C-h>"
function! s:check_back_space() abort
let col = col('.') - 1
return !col || getline('.')[col - 1] =~# '\s'
endfunction
" Use <c-space> to trigger completion.
inoremap <silent><expr> <c-space> coc#refresh()
" Use <cr> to confirm completion, `<C-g>u` means break undo chain at current position.
" Coc only does snippet and additional edit on confirm.
inoremap <expr> <cr> pumvisible() ? "\<C-y>" : "\<C-g>u\<CR>"
" Or use `complete_info` if your vim support it, like:
" inoremap <expr> <cr> complete_info()["selected"] != "-1" ? "\<C-y>" : "\<C-g>u\<CR>"
" Use `[g` and `]g` to navigate diagnostics
nmap <silent> [g <Plug>(coc-diagnostic-prev)
nmap <silent> ]g <Plug>(coc-diagnostic-next)
" Remap keys for gotos
nmap <silent> gd <Plug>(coc-definition)
nmap <silent> gy <Plug>(coc-type-definition)
nmap <silent> gi <Plug>(coc-implementation)
nmap <silent> gr <Plug>(coc-references)
" Use K to show documentation in preview window
nnoremap <silent> K :call <SID>show_documentation()<CR>
function! s:show_documentation()
if (index(['vim','help'], &filetype) >= 0)
execute 'h '.expand('<cword>')
else
call CocAction('doHover')
endif
endfunction
" More gitgutter lines
let g:gitgutter_max_signs = 1000
" Show dotfiles
let g:ctrlp_show_hidden = 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment