Skip to content

Instantly share code, notes, and snippets.

@Daivasmara
Last active Feb 21, 2021
Embed
What would you like to do?
NVIM v0.4.4
call plug#begin('~/.vim/plugged')
Plug 'challenger-deep-theme/vim', { 'as': 'challenger-deep' }
Plug 'morhetz/gruvbox'
Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' }
Plug 'junegunn/fzf.vim'
Plug 'stsewd/fzf-checkout.vim'
Plug 'sheerun/vim-polyglot'
Plug 'vim-airline/vim-airline'
Plug 'neoclide/coc.nvim', {'branch': 'release'}
Plug 'vimwiki/vimwiki'
Plug 'voldikss/vim-floaterm'
Plug 'preservim/nerdtree'
Plug 'preservim/nerdcommenter'
Plug 'ryanoasis/vim-devicons'
Plug 'airblade/vim-gitgutter'
Plug 'tpope/vim-fugitive'
Plug 'alvan/vim-closetag'
Plug 'tpope/vim-surround'
Plug 'jiangmiao/auto-pairs'
Plug 'szw/vim-maximizer'
Plug 'dense-analysis/ale'
Plug 'davidhalter/jedi-vim'
Plug 'numirias/semshi', {'do': ':UpdateRemotePlugins'}
Plug 'tpope/vim-rails'
call plug#end()
let mapleader = ","
syntax on
set clipboard+=unnamedplus
set nowrap
set encoding=UTF-8
set tabstop=8 softtabstop=0 expandtab shiftwidth=2 smarttab
set number relativenumber
set laststatus=2
set noshowmode
set updatetime=250
set nocompatible
filetype plugin on
nnoremap gb <C-O><C-S>
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>
nnoremap <C-E> <C-W><C-V>
nnoremap <C-O> <C-W><C-S>
autocmd FileType json syntax match Comment +\/\/.\+$+
autocmd BufRead,BufNewFile tsconfig.json set filetype=jsonc
let g:floaterm_keymap_toggle = '<Leader>`'
let g:closetag_filenames = '*.html,*.xhtml,*.phtml,*js,*jsx'
let g:gitgutter_realtime = 1
let g:rustfmt_autosave = 1
let g:vim_markdown_folding_disabled = 1
let g:typescript_indent_disable = 1
let g:typescript_compiler_binary = 'npx tsc'
autocmd BufWritePre *.go :call CocAction('runCommand', 'editor.action.organizeImport')
au BufNewFile,BufRead *.go setlocal noet ts=4 sw=4 sts=4
" FUNCTIONS
" J -> join lines without spaces
fun! s:join_spaceless()
execute 'normal! gJ'
" Remove character under the cursor if it's whitespace.
if matchstr(getline('.'), '\%' . col('.') . 'c.') =~ '\s'
execute 'normal! dw'
endif
endfun
nnoremap J :call <SID>join_spaceless()<CR>
" FZF RG
nnoremap <silent> <C-p> :GFiles<CR>
nnoremap <silent> <C-\> :Rg<CR>
function! RipgrepFzf(query, fullscreen)
let command_fmt = 'rg --column --line-number --no-heading --color=always --smart-case %s || true'
let initial_command = printf(command_fmt, shellescape(a:query))
let reload_command = printf(command_fmt, '{q}')
let spec = {'options': ['--phony', '--query', a:query, '--bind', 'change:reload:'.reload_command]}
call fzf#vim#grep(initial_command, 1, fzf#vim#with_preview(spec), a:fullscreen)
endfunction
command! -nargs=* -bang Rg call RipgrepFzf(<q-args>, <bang>0)
" FZF Checkout
nmap <leader>gc :GBranches<CR>
" Challenger Deep
let g:challenger_deep_termcolors = 16
if has('nvim') || has('termguicolors')
set termguicolors
endif
colorscheme challenger_deep
" Gruvbox
" let g:gruvbox_italic=1
" if has('nvim') || has('termguicolors')
" set termguicolors
" endif
" colorscheme gruvbox
" CoC
set hidden
set nobackup
set nowritebackup
set cmdheight=2
set shortmess+=c
set signcolumn=yes
set statusline^=%{coc#status()}%{get(b:,'coc_current_function','')}
let g:coc_user_config = 1
let g:coc_global_extensions = 1
nmap <silent> [g <Plug>(coc-diagnostic-prev)
nmap <silent> ]g <Plug>(coc-diagnostic-next)
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)
nmap <leader>rn <Plug>(coc-ename)
nnoremap <silent> <space>a :<C-u>CocList diagnostics<cr>
nnoremap <silent> <space>e :<C-u>CocList extensions<cr>
nnoremap <silent> <space>c :<C-u>CocList commands<cr>
nnoremap <silent> <space>o :<C-u>CocList outline<cr>
nnoremap <silent> <space>s :<C-u>CocList -I symbols<cr>
nnoremap <silent> <space>j :<C-u>CocNext<CR>
nnoremap <silent> <space>k :<C-u>CocPrev<CR>
nnoremap <silent> <space>p :<C-u>CocListResume<CR>
nnoremap <silent> K :call <SID>show_documentation()<CR>
inoremap <silent><expr> <TAB>
\ pumvisible() ? "\<C-n>" :
\ <SID>check_back_space() ? "\<TAB>" :
\ coc#refresh()
inoremap <expr><S-TAB> pumvisible() ? "\<C-p>" : "\<C-h>"
inoremap <silent><expr> <c-space> coc#refresh()
xmap <leader>a <Plug>(coc-codeaction-selected)
nmap <leader>a <Plug>(coc-codeaction-selected)
nmap <leader>ac <Plug>(coc-codeaction)
nmap <leader>qf <Plug>(coc-fix-current)
xmap if <Plug>(coc-funcobj-i)
xmap af <Plug>(coc-funcobj-a)
omap if <Plug>(coc-funcobj-i)
omap af <Plug>(coc-funcobj-a)
nmap <silent> <TAB> <Plug>(coc-range-select)
xmap <silent> <TAB> <Plug>(coc-range-select)
xmap <leader>f <Plug>(coc-format-selected)
nmap <leader>f <Plug>(coc-format-selected)
command! -nargs=0 Format :call CocAction('format')
command! -nargs=? Fold :call CocAction('fold', <f-args>)
command! -nargs=0 OR :call CocAction('runCommand', 'editor.action.organizeImport')
autocmd CursorHold * silent call CocActionAsync('highlight')
function! s:show_documentation()
if (index(['vim','help'], &filetype) >= 0)
execute 'h '.expand('<cword>')
else
call CocAction('doHover')
endif
endfunction
function! s:check_back_space() abort
let col = col('.') - 1
return !col || getline('.')[col - 1] =~# '\s'
endfunction
if has('patch8.1.1068')
inoremap <expr> <cr> complete_info()["selected"] != "-1" ? "\<C-y>" : "\<C-g>u\<CR>"
else
imap <expr> <cr> pumvisible() ? "\<C-y>" : "\<C-g>u\<CR>"
endif
augroup mygroup
autocmd!
autocmd FileType typescript,json setl formatexpr=CocAction('formatSelected')
autocmd User CocJumpPlaceholder call CocActionAsync('showSignatureHelp')
augroup end
" NERDTree
nnoremap <silent> <C-n> :NERDTreeToggle<CR>
nnoremap <silent> gn :NERDTreeFind<CR>
autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTree") && b:NERDTree.isTabTree()) | q | endif
let g:NERDTreeDirArrowExpandable = ''
let g:NERDTreeDirArrowCollapsible = ''
" NERDCommenter
let g:NERDSpaceDelims = 1
" Jedi
let g:jedi#goto_definitions_command = "gd"
let g:jedi#rename_command = "<leader>rn"
" Vim Fugitive
nmap <leader>gs :G<CR>
nmap <leader>gl :G log<CR>
nmap <leader>gb :G blame<CR>
nmap <leader>gd :G diff<CR>
nmap <leader>g2 :diffget //2<CR>
nmap <leader>g3 :diffget //3<CR>
@Daivasmara

This comment has been minimized.

Copy link
Owner Author

@Daivasmara Daivasmara commented Mar 5, 2020

~/.Xresource

! ~/.Xresource
*.foreground:   #cbe3e7
*.background:   #1e1c31
*.cursorColor:  #fbfcfc

! black
*.color0:       #565575
*.color8:       #100e23

! red
*.color1:       #ff8080
*.color9:       #ff5458

! green
*.color2:       #95ffa4
*.color10:      #62d196

! yellow
*.color3:       #ffe9aa
*.color11:      #ffb378

! blue
*.color4:       #91ddff
*.color12:      #65b2ff

! magenta
*.color5:       #c991e1
*.color13:      #906cff

! cyan
*.color6:       #aaffe4
*.color14:      #63f2f1

! white
*.color7:       #cbe3e7
*.color15:      #a6b3cc
@Daivasmara

This comment has been minimized.

Copy link
Owner Author

@Daivasmara Daivasmara commented Mar 20, 2020

@Daivasmara

This comment has been minimized.

Copy link
Owner Author

@Daivasmara Daivasmara commented Apr 8, 2020

~/.config/nvim/init.vim

set runtimepath^=~/.vim runtimepath+=~/.vim/after
let &packpath = &runtimepath
source ~/.vimrc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment