From f2a0c97a983794e0f431b7b3ddbbb4e56ef3b012 Mon Sep 17 00:00:00 2001 From: Zev Averbach Date: Fri, 11 Feb 2022 15:40:28 +0100 Subject: [PATCH] various --- vimrc | 43 +++++++++++++++++++++++++++++-------------- 1 file changed, 29 insertions(+), 14 deletions(-) diff --git a/vimrc b/vimrc index 611b122..5817fb8 100644 --- a/vimrc +++ b/vimrc @@ -26,11 +26,12 @@ set undodir=$HOME/.vim/undo " italicize comments highlight Comment cterm=italic gui=italic -set relativenumber +set number relativenumber " four-space tabs filetype indent plugin on set smartindent set autoindent +autocmd FileType javascript set shiftwidth=2 set title " set the terminal title set ruler "show status line @@ -38,7 +39,6 @@ set rulerformat=%10(%l,%c%V%) set laststatus=2 "always show status line set cursorline "highlight current line -set ignorecase "case-insensitive search set smartcase "unless there's an uppercase letter in the keyword setlocal shiftwidth=2 softtabstop=2 expandtab @@ -47,9 +47,13 @@ au FileType python setl softtabstop=4 shiftwidth=4 tabstop=4 " toggle paste mode map p :set invpaste + + " keep visual selection after indenting vnoremap < >gv +nmap gd (coc-definition) +nmap gr (coc-references) " easier completion mode imap @@ -73,14 +77,8 @@ nnoremap gc " save all and quit nnoremap q :waZQ -function! RunBlackIfInPythonFile() - if &filetype ==# 'python' - :call Black() - endif -endfunction - " save -nnoremap :call RunBlackIfInPythonFile():w +nnoremap :w " save and close buffer nnoremap w :w:bw nnoremap :bp @@ -89,13 +87,12 @@ nnoremap :bn nnoremap :noh nnoremap p :PlugInstall -nnoremap b :call RunBlackIfInPythonFile() +nnoremap s :source ~/.config/nvim/init.vim +nnoremap v :e ~/.config/nvim/init.vim -" show number of lines in buffer -nnoremap l :echo line("$") +nnoremap f :Files -" quickly source vimrc with + s -nnoremap s :source ~/.vimrc +nmap l :call CocAction('diagnosticNext') " move selection nnoremap :m .+1== @@ -110,11 +107,29 @@ let g:black#settings = { \ 'fast': 1, \ 'line_length': 100 \} +let g:python3_host_prog = $HOME . '/.local/venv/nvim/bin/python' + call plug#begin('~/.vim/plugged') Plug 'folke/tokyonight.nvim', { 'branch': 'main' } Plug 'averms/black-nvim', {'do': ':UpdateRemotePlugins'} Plug 'tpope/vim-commentary' + Plug 'sheerun/vim-polyglot' + Plug 'neoclide/coc.nvim', {'branch': 'release'} + Plug 'tpope/vim-fugitive' + Plug 'junegunn/fzf', { 'do': { -> fzf#install() } } + Plug 'junegunn/fzf.vim' call plug#end() colorscheme tokyonight + + +command! UnMinify call UnMinify() +function! UnMinify() + %s/{\ze[^\r\n]/{\r/g + %s/){/) {/g + %s/};\?\ze[^\r\n]/\0\r/g + %s/;\ze[^\r\n]/;\r/g + %s/[^\s]\zs[=&|]\+\ze[^\s]/ \0 /g + normal ggVG= +endfunction