Skip to content

Instantly share code, notes, and snippets.

@denniss
Created January 10, 2021 03:22
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 denniss/36f566d18f8d38aec1062b1ee56d0b2a to your computer and use it in GitHub Desktop.
Save denniss/36f566d18f8d38aec1062b1ee56d0b2a to your computer and use it in GitHub Desktop.
dotfiles
inoremap jk <ESC>
"Map leader to space
nnoremap <SPACE> <Nop>
let mapleader = " "
noremap <Up> <Nop>
noremap <Down> <Nop>
noremap <Left> <Nop>
noremap <Right> <Nop>
" Save with C-s
nmap <c-s> :w<CR>
imap <c-s> <Esc><c-s>
syntax on
set number
set autoindent
"Plugins section
call plug#begin()
Plug 'junegunn/fzf', { 'do': { -> fzf#install() } }
Plug 'junegunn/fzf.vim'
Plug 'easymotion/vim-easymotion'
Plug 'neoclide/coc.nvim', {'branch': 'release'}
Plug 'chriskempson/base16-vim'
Plug 'fatih/vim-go', { 'do': ':GoUpdateBinaries' }
Plug 'ayu-theme/ayu-vim'
Plug 'preservim/nerdtree'
Plug 'morhetz/gruvbox'
Plug 'vim-airline/vim-airline'
Plug 'scalameta/coc-metals'
Plug 'joshdick/onedark.vim'
call plug#end()
set termguicolors
"vim-go
let g:go_fmt_command = "goimports"
let g:go_auto_type_info = 1
"gruvbox
"colorscheme gruvbox
"let g:gruvbox_contrast_dark = "hard"
"let g:gruvbox_italicize_comments = "1"
"onedark
colorscheme onedark
let g:airline_theme='onedark'
autocmd FileType go nmap <Leader>i <Plug>(go-info)
autocmd FileType go nmap <Leader>l :GoDecls<CR>
"Next and pervious errors
let g:go_list_type = 'locationlist'
" turn to next or previous errors, after open location list
nmap <leader>j :lnext<CR>
nmap <leader>k :lprevious<CR>
" Open buffers selection window
map <leader>n :Buffers<CR>
map <leader>1 :NERDTreeToggle<CR>
"Copy to clipboard
map <C-S-c> "*y
"EasyMotion
" s{char}{char} to move to {char}{char}
nmap s <Plug>(easymotion-overwin-f2)
" <Leader>f{char} to move to {char}
map <Leader>f <Plug>(easymotion-bd-f)
nmap <Leader>f <Plug>(easymotion-overwin-f)
" Move to line
map <Leader>L <Plug>(easymotion-bd-jk)
nmap <Leader>L <Plug>(easymotion-overwin-line)
" Move to word
map <Leader>w <Plug>(easymotion-bd-w)
nmap <Leader>w <Plug>(easymotion-overwin-w)
" Gif config
map / <Plug>(easymotion-sn)
omap / <Plug>(easymotion-tn)
" These `n` & `N` mappings are options. You do not have to map `n` & `N` to EasyMotion.
" Without these mappings, `n` & `N` works fine. (These mappings just provide
" different highlight method and have some other features )
map n <Plug>(easymotion-next)
map N <Plug>(easymotion-prev)
"Navigation
map <C-j> :bprevious<CR>
map <C-k> :bnext<CR>
"FZF
let g:fzf_layout = { 'down': '40%' }
map <C-g> :Ag<CR>
map <C-p> :Files<CR>
"Set tab to 4 spaces
set tabstop=8 softtabstop=0 expandtab shiftwidth=4 smarttab
""""""" COC
" Formatting selected code.
xmap <leader>f <Plug>(coc-format-selected)
nmap <leader>f <Plug>(coc-format-selected)
" GoTo code navigation.
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 <Tab> and <S-Tab> to navigate completion list
inoremap <expr> <Tab> pumvisible() ? "\<C-n>" : "\<Tab>"
inoremap <expr> <S-Tab> pumvisible() ? "\<C-p>" : "\<S-Tab>"
" Use <c-space> to trigger completion.
if has('nvim')
inoremap <silent><expr> <c-space> coc#refresh()
else
inoremap <silent><expr> <c-@> coc#refresh()
endif
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment