Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save RichardBronosky/1431516cdc378484942b6e2ffb8dd073 to your computer and use it in GitHub Desktop.
Save RichardBronosky/1431516cdc378484942b6e2ffb8dd073 to your computer and use it in GitHub Desktop.
Undestroy vim on RPI Raspbian Stretch
# This includes some apparent redundant calls to sudo.
# They are there to make sure that no mater which user executes these commands,
# both root and pi users get files with the right permissions.
# Fix bash
sudo -u pi touch ~pi/.bashrc
( sudo tee -a /home/pi/.bashrc | sudo tee -a /root/.bashrc > /dev/null ) << 'EOF'
set -o vi
export EDITOR=vim
alias ll='ls -la'
ptree(){ ps auxf | awk -v cmd="$1" 'BEGIN{"ps -o ppid= $$" | getline pid} $0 !~ "\_" {p=0} $0 ~ cmd && $2 != pid {p=1} p==1{print}' | less -SEX; }
EOF
# Fix vim
sudo mkdir -p ~root/.vim
sudo -u pi mkdir -p ~pi/.vim
sudo touch ~root/.vim/vimrc
sudo -u pi touch ~pi/.vim/vimrc
( sudo tee -a ~pi/.vim/vimrc | sudo tee -a ~root/.vim/vimrc > /dev/null ) << 'VIMRC'
# use the pretty good defaults
if filereadable("/usr/share/vim/vim80/defaults.vim")
source /usr/share/vim/vim80/defaults.vim
endif
# don't interpret mouse clicks
set mouse=
VIMRC
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment