Last active
January 13, 2023 22:37
-
-
Save PCJohn/ccbac70608f44f8c8d18cc4c89f3ab90 to your computer and use it in GitHub Desktop.
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
wget https://gist.githubusercontent.com/PCJohn/ccbac70608f44f8c8d18cc4c89f3ab90/raw/8853e386321c61d4b0b6ac58db1bc4ac457574e0/vimrc | |
mv vimrc ~/.vimrc | |
bash | |
# Following: https://askubuntu.com/questions/284957/vi-getting-multiple-sorry-the-command-is-not-available-in-this-version-af | |
sudo apt-get install vim-gui-common | |
sudo apt-get install vim-runtime | |
# Use the Vundle vim plugin manager | |
# See: https://pseudoscripter.wordpress.com/2020/04/26/install-black-on-vim/ | |
git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim | |
vim +PlugInstall +qall | |
# Sometime I get "Black: ModuleNotFoundError" after Linux upgrades. | |
# If that happens, try this | |
# vi test.py | |
# :PluginInstall | |
# :BlackUpgrade |
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
set nocp | |
set backspace=indent,eol,start | |
set smartindent | |
set tabstop=2 | |
set shiftwidth=2 | |
set expandtab | |
set nu | |
:se mouse+=a | |
"Saving | |
map <c-o> :w<CR> | |
imap <c-o> <Esc>:w<CR> | |
"Exiting | |
map <c-x> :q<CR> | |
imap <c-x> <Esc>:q<CR> | |
"Select all | |
map <c-a> Gvgg | |
imap <c-a> <Esc>Gvgg | |
"New file | |
map <c-n> <c-s>:enew | |
imap <c-n> <c-s><Esc>:enew | |
"Yank | |
map <c-c> y | |
imap <c-c> <Esc>y | |
"Shortcut to yank a line | |
map <c-k> dd | |
imap <c-k> <Esc>dd | |
"Paste | |
map <c-v> p | |
imap <c-v> <Esc>p<Esc>i | |
"Find | |
map <c-f> / | |
imap <c-f> <Esc>/ | |
"Undo | |
map <c-z> u | |
imap <c-z> <Esc>u<Esc>i | |
"Create new tab | |
map <c-t> <Esc>:tabnew .<Esc> | |
imap <c-t> <Esc>:tabnew .<Esc> | |
"Switch tabs | |
map <c-w> <Esc>:tabn<CR> | |
imap <c-w> <Esc>:tabn<CR> | |
" shift+arrow selection | |
nmap <S-Up> v<Up> | |
nmap <S-Down> v<Down> | |
nmap <S-Left> v<Left> | |
nmap <S-Right> v<Right> | |
vmap <S-Up> <Up> | |
vmap <S-Down> <Down> | |
vmap <S-Left> <Left> | |
vmap <S-Right> <Right> | |
imap <S-Up> <Esc>v<Up> | |
imap <S-Down> <Esc>v<Down> | |
imap <S-Left> <Esc>v<Left> | |
imap <S-Right> <Esc>v<Right> | |
:syntax on | |
:fixdel | |
" set the runtime path to include Vundle and initialize | |
set rtp+=~/.vim/bundle/Vundle.vim | |
call vundle#begin() | |
" let Vundle manage Vundle, required | |
Plugin 'VundleVim/Vundle.vim' | |
Plugin 'psf/black' | |
" All of your Plugins must be added before the following line | |
call vundle#end() " required | |
filetype plugin indent on " required | |
" Specify the virtual environment path for black | |
let g:black_virtualenv='~/.vim/black' | |
" Run black on save | |
autocmd BufWritePre *.py execute ':Black' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment