various
This commit is contained in:
43
vimrc
43
vimrc
@@ -26,11 +26,12 @@ set undodir=$HOME/.vim/undo
|
|||||||
" italicize comments
|
" italicize comments
|
||||||
highlight Comment cterm=italic gui=italic
|
highlight Comment cterm=italic gui=italic
|
||||||
|
|
||||||
set relativenumber
|
set number relativenumber
|
||||||
" four-space tabs
|
" four-space tabs
|
||||||
filetype indent plugin on
|
filetype indent plugin on
|
||||||
set smartindent
|
set smartindent
|
||||||
set autoindent
|
set autoindent
|
||||||
|
autocmd FileType javascript set shiftwidth=2
|
||||||
|
|
||||||
set title " set the terminal title
|
set title " set the terminal title
|
||||||
set ruler "show status line
|
set ruler "show status line
|
||||||
@@ -38,7 +39,6 @@ set rulerformat=%10(%l,%c%V%)
|
|||||||
set laststatus=2 "always show status line
|
set laststatus=2 "always show status line
|
||||||
set cursorline "highlight current line
|
set cursorline "highlight current line
|
||||||
|
|
||||||
set ignorecase "case-insensitive search
|
|
||||||
set smartcase "unless there's an uppercase letter in the keyword
|
set smartcase "unless there's an uppercase letter in the keyword
|
||||||
|
|
||||||
setlocal shiftwidth=2 softtabstop=2 expandtab
|
setlocal shiftwidth=2 softtabstop=2 expandtab
|
||||||
@@ -47,9 +47,13 @@ au FileType python setl softtabstop=4 shiftwidth=4 tabstop=4
|
|||||||
" toggle paste mode
|
" toggle paste mode
|
||||||
map <Leader>p :set invpaste<CR>
|
map <Leader>p :set invpaste<CR>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
" keep visual selection after indenting
|
" keep visual selection after indenting
|
||||||
vnoremap < <gv
|
vnoremap < <gv
|
||||||
vnoremap > >gv
|
vnoremap > >gv
|
||||||
|
nmap <silent> gd <Plug>(coc-definition)
|
||||||
|
nmap <silent> gr <Plug>(coc-references)
|
||||||
|
|
||||||
" easier completion mode
|
" easier completion mode
|
||||||
imap <c-k> <c-x>
|
imap <c-k> <c-x>
|
||||||
@@ -73,14 +77,8 @@ nnoremap <c-/> gc
|
|||||||
" save all and quit
|
" save all and quit
|
||||||
nnoremap <leader>q :wa<cr>ZQ
|
nnoremap <leader>q :wa<cr>ZQ
|
||||||
|
|
||||||
function! RunBlackIfInPythonFile()
|
|
||||||
if &filetype ==# 'python'
|
|
||||||
:call Black()
|
|
||||||
endif
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
" save
|
" save
|
||||||
nnoremap <c-s> :call RunBlackIfInPythonFile()<cr>:w<cr>
|
nnoremap <c-s> :w<cr>
|
||||||
" save and close buffer
|
" save and close buffer
|
||||||
nnoremap <leader>w :w<cr>:bw<cr>
|
nnoremap <leader>w :w<cr>:bw<cr>
|
||||||
nnoremap <c-h> :bp<cr>
|
nnoremap <c-h> :bp<cr>
|
||||||
@@ -89,13 +87,12 @@ nnoremap <c-l> :bn<cr>
|
|||||||
nnoremap <c-e> :noh<cr>
|
nnoremap <c-e> :noh<cr>
|
||||||
nnoremap <leader>p :PlugInstall<cr>
|
nnoremap <leader>p :PlugInstall<cr>
|
||||||
|
|
||||||
nnoremap <leader>b :call RunBlackIfInPythonFile()<cr>
|
nnoremap <leader>s :source ~/.config/nvim/init.vim<cr>
|
||||||
|
nnoremap <leader>v :e ~/.config/nvim/init.vim<cr>
|
||||||
|
|
||||||
" show number of lines in buffer
|
nnoremap <leader>f :Files<cr>
|
||||||
nnoremap <leader>l :echo line("$")<cr>
|
|
||||||
|
|
||||||
" quickly source vimrc with <space> + s
|
nmap <leader>l :call CocAction('diagnosticNext')<cr>
|
||||||
nnoremap <leader>s :source ~/.vimrc<cr>
|
|
||||||
|
|
||||||
" move selection
|
" move selection
|
||||||
nnoremap <C-j> :m .+1<CR>==
|
nnoremap <C-j> :m .+1<CR>==
|
||||||
@@ -110,11 +107,29 @@ let g:black#settings = {
|
|||||||
\ 'fast': 1,
|
\ 'fast': 1,
|
||||||
\ 'line_length': 100
|
\ 'line_length': 100
|
||||||
\}
|
\}
|
||||||
|
let g:python3_host_prog = $HOME . '/.local/venv/nvim/bin/python'
|
||||||
|
|
||||||
|
|
||||||
call plug#begin('~/.vim/plugged')
|
call plug#begin('~/.vim/plugged')
|
||||||
Plug 'folke/tokyonight.nvim', { 'branch': 'main' }
|
Plug 'folke/tokyonight.nvim', { 'branch': 'main' }
|
||||||
Plug 'averms/black-nvim', {'do': ':UpdateRemotePlugins'}
|
Plug 'averms/black-nvim', {'do': ':UpdateRemotePlugins'}
|
||||||
Plug 'tpope/vim-commentary'
|
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()
|
call plug#end()
|
||||||
|
|
||||||
colorscheme tokyonight
|
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
|
||||||
|
|||||||
Reference in New Issue
Block a user