From efcf41e9867affb0cfeedf8fa577fff9bb231cc5 Mon Sep 17 00:00:00 2001 From: Zev Averbach Date: Thu, 23 Mar 2023 21:30:42 +0100 Subject: [PATCH] first --- init.vim | 113 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 113 insertions(+) create mode 100644 init.vim diff --git a/init.vim b/init.vim new file mode 100644 index 0000000..779555e --- /dev/null +++ b/init.vim @@ -0,0 +1,113 @@ +set number relativenumber +set signcolumn=yes + + +" Return to last edit position when opening files (You want this!) +autocmd BufReadPost * if @% !~# '\.git[\/\\]COMMIT_EDITMSG$' && line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g`\"" | endif + +set hidden +set undofile +" set a directory to store the undo history +" TODO: when setting up a new environment, create this dir +set undodir=/home/zev/.vimundo/ + +let mapleader=" " +noremap :w +nnoremap v :e ~/.config/nvim/init.vim +nnoremap w :bw +nnoremap q :bw:q +nnoremap i :PlugInstall +nnoremap r :so ~/.config/nvim/init.vim +nnoremap :bp +nnoremap :bn +nnoremap f :Telescope find_files +nnoremap g :Telescope live_grep +nnoremap b :Telescope buffers +nnoremap :noh +nnoremap de dg$ +nnoremap dd +nnoremap yy +noremap v0yOpjly$kgp`[j +noremap v V +noremap V v + +" Helix-style bindings, I missed 'em! +nnoremap gs 0 +nnoremap gl $ +nnoremap ge G +nnoremap 0 +nnoremap G +nnoremap $ +nnoremap U +nnoremap +" /Helix bindings +" +" COC bindings +" +" Having longer updatetime (default is 4000 ms = 4s) leads to noticeable +" delays and poor user experience +set updatetime=200 + +" Always show the signcolumn, otherwise it would shift the text each time +" diagnostics appear/become resolved +set signcolumn=yes + +" Use to trigger completion +if has('nvim') + inoremap coc#refresh() +else + inoremap coc#refresh() +endif + +nmap [d (coc-diagnostic-prev) +nmap ]d (coc-diagnostic-next) +nmap gd (coc-definition) +nmap gr (coc-references) + +nnoremap k :call ShowDocumentation() + +augroup mygroup + autocmd! + autocmd User CocJumpPlaceholder call CocActionAsync('showSignatureHelp') +augroup end + +xmap a (coc-codeaction-selected) +nmap a (coc-codeaction-selected) +" Remap keys for applying code actions at the cursor position +nmap ac (coc-codeaction-cursor) +" Remap keys for apply code actions affect whole buffer +nmap as (coc-codeaction-source) +" Apply the most preferred quickfix action to fix diagnostic on the current line +nmap qf (coc-fix-current) + +" Remap keys for applying refactor code actions +nmap re (coc-codeaction-refactor) +xmap r (coc-codeaction-refactor-selected) +nmap r (coc-codeaction-refactor-selected) + +function! ShowDocumentation() + if CocAction('hasProvider', 'hover') + call CocActionAsync('doHover') + else + call feedkeys('K', 'in') + endif +endfunction + +" Symbol renaming +nnoremap rn (coc-rename) + + +call plug#begin() + Plug 'Exafunction/codeium.vim' + Plug 'nvim-lua/plenary.nvim' + Plug 'nvim-telescope/telescope.nvim', { 'tag': '0.1.1' } + Plug 'folke/tokyonight.nvim', { 'branch': 'main' } + Plug 'meain/vim-printer' + Plug 'tpope/vim-commentary' + Plug 'neoclide/coc.nvim', {'branch': 'release'} + Plug 'nvim-treesitter/nvim-treesitter', {'do': ':TSUpdate'} +call plug#end() + +let g:python3_host_prog="/usr/bin/python3" + +colorscheme tokyonight-storm