Created
May 19, 2021 23:48
-
-
Save fdidron/2ac79cf085be16a5693ef12cfe1d3884 to your computer and use it in GitHub Desktop.
Nvim
This file contains hidden or 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
" Space as leader key | |
let mapleader = " " | |
" Sensible defaults | |
set nocompatible | |
set autoread | |
" Swap directory | |
set directory=$HOME/.vim/swp/ | |
" Undo directory | |
set undodir=$HOME/.vim/undo/ | |
" No arrows | |
noremap <Up> <NOP> | |
noremap <Down> <NOP> | |
noremap <Left> <NOP> | |
noremap <Right> <NOP> | |
" Window management | |
nnoremap <silent> <Leader>- :sp<CR> | |
nnoremap <silent> <Leader>\ :vsp<CR> | |
nnoremap <Leader>j <C-W><C-J> | |
nnoremap <Leader>k <C-W><C-K> | |
nnoremap <Leader>l <C-W><C-L> | |
nnoremap <Leader>h <C-W><C-H> | |
nnoremap <silent> <Leader>d :Vifm<CR> | |
nnoremap <silent> <Leader>a :Startify<CR> | |
nnoremap <Leader>f :Files<CR> | |
nnoremap <Leader>b :Buffers<CR> | |
nmap <Leader>i <Plug>(Prettier) | |
map <Leader><Leader> <Plug>(easymotion-prefix) | |
nnoremap <Leader>v "+p | |
" Alt Tab | |
nnoremap <Leader><Tab> <C-^> | |
" Blank chars rendering | |
set list listchars=tab:\ \ ,trail:· | |
" Indentation | |
filetype plugin indent on | |
set expandtab | |
set tabstop=2 | |
set shiftwidth=2 | |
" Line numbers | |
set number | |
" Hidden buffers | |
set hidden | |
"--- VimPlug | |
call plug#begin() | |
" UI / Styles | |
"Plug 'danilamihailov/beacon.nvim' | |
Plug 'chrisbra/Colorizer' | |
"Plug 'psliwka/vim-smoothie' | |
Plug 'chuling/ci_dark' | |
Plug 'chriskempson/base16-vim' | |
Plug 'vim-airline/vim-airline' | |
Plug 'luochen1990/rainbow' | |
Plug 'pineapplegiant/spaceduck', { 'branch': 'main' } | |
" File Navigation | |
Plug 'junegunn/fzf', { 'do': { -> fzf#install() } } | |
Plug 'junegunn/fzf.vim' | |
Plug 'airblade/vim-rooter' | |
Plug 'mhinz/vim-startify' | |
Plug 'ryanoasis/vim-devicons' | |
Plug 'vifm/vifm.vim' | |
" Task runners | |
Plug 'w0rp/ale' | |
Plug 'prettier/vim-prettier', { 'do': 'yarn install', 'for': ['javascript', 'typescript', 'typescriptreact', 'javascriptreact'] } | |
Plug 'neomake/neomake' | |
Plug 'coddingtonbear/neomake-platformio' | |
" Search | |
Plug 'easymotion/vim-easymotion' | |
" Git | |
Plug 'tpope/vim-fugitive' | |
" Languages | |
Plug 'sheerun/vim-polyglot' | |
Plug 'fatih/vim-go', { 'do': ':GoUpdateBinaries' } | |
" Autocomplete | |
Plug 'neoclide/coc.nvim', {'branch': 'release'} | |
Plug 'mattn/emmet-vim' | |
call plug#end() | |
" Autocomplete | |
" Give more space for displaying messages. | |
set cmdheight=2 | |
" Having longer updatetime (default is 4000 ms = 4 s) leads to noticeable | |
" delays and poor user experience. | |
set updatetime=300 | |
" Don't pass messages to |ins-completion-menu|. | |
set shortmess+=c | |
" Always show the signcolumn, otherwise it would shift the text each time | |
" diagnostics appear/become resolved. | |
set signcolumn=yes | |
" Use tab for trigger completion with characters ahead and navigate. | |
" NOTE: Use command ':verbose imap <tab>' to make sure tab is not mapped by | |
" other plugin before putting this into your config. | |
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. | |
" <cr> could be remapped by other vim plugin, try `:verbose imap <CR>`. | |
if exists('*complete_info') | |
inoremap <expr> <cr> complete_info()["selected"] != "-1" ? "\<C-y>" : "\<C-g>u\<CR>" | |
else | |
inoremap <expr> <cr> pumvisible() ? "\<C-y>" : "\<C-g>u\<CR>" | |
endif | |
" Use `[g` and `]g` to navigate diagnostics | |
nmap <silent> [g <Plug>(coc-diagnostic-prev) | |
nmap <silent> ]g <Plug>(coc-diagnostic-next) | |
" 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 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 | |
" UI / Color scheme | |
if exists('+termguicolors') | |
let &t_8f = "\<Esc>[38;2;%lu;%lu;%lum" | |
let &t_8b = "\<Esc>[48;2;%lu;%lu;%lum" | |
set termguicolors | |
endif | |
colorscheme spaceduck | |
syntax enable | |
set wildmenu | |
set mouse=a | |
set cursorline | |
let g:airline_theme = 'spaceduck' | |
" Prettier | |
let g:prettier#autoformat_require_pragma = 0 | |
let g:prettier#config#parser = "typescript" | |
" Autocommands | |
if has("autocmd") | |
" Automatically clean trailing whitespace | |
autocmd BufWritePre * :%s/\s\+$//e | |
autocmd FileType go setlocal shiftwidth=4 tabstop=4 | |
augroup autoindent | |
au! | |
autocmd BufWritePre *.rb,*.go :normal migg=G`i | |
augroup End | |
endif | |
let g:localvimrc_sandbox = 0 | |
" Update session automatically as you exit vim | |
let g:startify_session_persistence = 1 | |
let g:startify_bookmarks = [ | |
\ '~/dev/zsa/oryx-frontend', | |
\ '~/dev/zsa/oryx-frontend-old', | |
\ '~/dev/zsa/oryx-backend', | |
\ '~/dev/zsa/qmk_zsa', | |
\ '~/dev/zsa/yardstick', | |
\ '~/dev/zsa/zsa_io_store', | |
\ '~/dev/memdev', | |
\ '~/dev/prosaic', | |
\ '~/dev/noveox', | |
\ '~/dev/lumiweb', | |
\ '~/dev/go/src/github.com/zsa/wally', | |
\ '~/.config/nvim/init.vim', | |
\ ] | |
set guifont=FuraCode\ Nerd\ Font:h20 | |
let g:neovide_cursor_vfx_mode = "railgun" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment