Merge branch 'main' of github.com:DannyDannyDanny/dotfiles

This commit is contained in:
dth@taiga.ai 2023-02-18 20:27:17 +01:00
commit e0e8b51af6
10 changed files with 287 additions and 19 deletions

View file

@ -158,5 +158,5 @@ schemes:
# colors: *gruvbox_material_medium_light # colors: *gruvbox_material_medium_light
# colors: *gruvbox_material_soft_light # colors: *gruvbox_material_soft_light
# colors: *gruvbox_material_soft_light colors: *gruvbox_material_soft_light
colors: *gruvbox_material_soft_dark # colors: *gruvbox_material_soft_dark

View file

@ -1,5 +1,7 @@
let mapleader ="," let mapleader =","
" set termguicolors
if ! filereadable(system('echo -n "${XDG_CONFIG_HOME:-$HOME/.config}/nvim/autoload/plug.vim"')) if ! filereadable(system('echo -n "${XDG_CONFIG_HOME:-$HOME/.config}/nvim/autoload/plug.vim"'))
echo "Downloading junegunn/vim-plug to manage plugins..." echo "Downloading junegunn/vim-plug to manage plugins..."
silent !mkdir -p ${XDG_CONFIG_HOME:-$HOME/.config}/nvim/autoload/ silent !mkdir -p ${XDG_CONFIG_HOME:-$HOME/.config}/nvim/autoload/
@ -22,11 +24,14 @@ Plug 'tpope/vim-commentary' " comment out word / line with 'gc'
Plug 'ap/vim-css-color' " show css colors Plug 'ap/vim-css-color' " show css colors
Plug 'editorconfig/editorconfig-vim' " editor-config extension for vim Plug 'editorconfig/editorconfig-vim' " editor-config extension for vim
Plug 'scrooloose/syntastic' " syntax checker Plug 'scrooloose/syntastic' " syntax checker
Plug 'airblade/vim-gitgutter' " show git diff insertions / deletions " Plug 'airblade/vim-gitgutter' " show git diff insertions / deletions
Plug 'junegunn/vim-emoji' " emoji autocomplete + emojis in gitgutter " Plug 'junegunn/vim-emoji' " emoji autocomplete + emojis in gitgutter
Plug 'rrethy/vim-illuminate' " highlight other uses of the current word under the cursor Plug 'rrethy/vim-illuminate' " highlight other uses of the current word under the cursor
" Plug 'jupyter-vim/jupyter-vim' " one day we'll start using jupyter in vim " Plug 'jupyter-vim/jupyter-vim' " one day we'll start using jupyter in vim
Plug 'junegunn/fzf', { 'do': { -> fzf#install() } } " fuzzy-finder Plug 'junegunn/fzf', { 'do': { -> fzf#install() } } " fuzzy-finder
Plug 'ibhagwan/fzf-lua', {'branch': 'main'}
" optional for icon support
Plug 'kyazdani42/nvim-web-devicons'
call plug#end() call plug#end()
@ -36,11 +41,11 @@ set list
set listchars=tab:→\ ,nbsp:␣,trail:•,precedes,extends set listchars=tab:→\ ,nbsp:␣,trail:•,precedes,extends
" vim-emoji setup " vim-emoji setup
set completefunc=emoji#complete " set completefunc=emoji#complete
let g:gitgutter_sign_added = emoji#for('small_blue_diamond') " let g:gitgutter_sign_added = emoji#for('small_blue_diamond')
let g:gitgutter_sign_modified = emoji#for('small_orange_diamond') " let g:gitgutter_sign_modified = emoji#for('small_orange_diamond')
let g:gitgutter_sign_removed = emoji#for('small_red_triangle') " let g:gitgutter_sign_removed = emoji#for('small_red_triangle')
let g:gitgutter_sign_modified_removed = emoji#for('collision') " let g:gitgutter_sign_modified_removed = emoji#for('collision')
" syntastic recommended settings " syntastic recommended settings

17
.zshrc
View file

@ -113,7 +113,9 @@ bindkey -v
[ -f ~/.fzf.zsh ] && source ~/.fzf.zsh [ -f ~/.fzf.zsh ] && source ~/.fzf.zsh
# make brew accessible # make brew accessible
if [ -d "$HOME/linuxbrew/.linuxbrew" ] ; then
eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)" eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"
fi
# set PATH so it includes user's private ~/.local/bin if it exists # set PATH so it includes user's private ~/.local/bin if it exists
# lvim is installed to this directory (at least on ubuntu) # lvim is installed to this directory (at least on ubuntu)
@ -123,3 +125,18 @@ fi
alias pbpaste="powershell.exe -noprofile Get-Clipboard" alias pbpaste="powershell.exe -noprofile Get-Clipboard"
alias pbcopy="clip.exe" alias pbcopy="clip.exe"
# on exit from lf this function changes directory to last browser fir in lf
lfcd () {
tmp="$(mktemp)"
lf -last-dir-path="$tmp" "$@"
if [ -f "$tmp" ]; then
dir="$(cat "$tmp")"
rm -f "$tmp"
if [ -d "$dir" ]; then
if [ "$dir" != "$(pwd)" ]; then
cd "$dir"
fi
fi
fi
}

View file

@ -46,8 +46,12 @@ Here's what I've done so far:
* get local admin rights * get local admin rights
* [install powertoys](https://docs.microsoft.com/en-us/windows/powertoys/install#install-with-windows-executable-file-via-github) * [install powertoys](https://docs.microsoft.com/en-us/windows/powertoys/install#install-with-windows-executable-file-via-github)
* remap CAPS LOCK to L-CTRL * remap CAPS LOCK to L-CTRL
* ~~install glasswire network monitor~~ (glasswire sucks)
* install portmaster network monitor
* https://safing.io/blog/2022/10/27/portmaster-reaches-1.0/
* install basic miktex (for LaTeX)
* install [alacritty](https://alacritty.org/) (use the installer, not portable) * install [alacritty](https://alacritty.org/) (use the installer, not portable)
* install [wsl](https://docs.microsoft.com/en-us/windows/wsl/install#install-wsl-command) * install [wsl](https://docs.microsoft.com/en-us/windows/wsl/install#install-wsl-command) + WSL specifics
* fix wsl dns issue via [stackoverflow](https://askubuntu.com/questions/91543/apt-get-update-fails-to-fetch-files-temporary-failure-resolving-error/91595#comment1911934_91595) * fix wsl dns issue via [stackoverflow](https://askubuntu.com/questions/91543/apt-get-update-fails-to-fetch-files-temporary-failure-resolving-error/91595#comment1911934_91595)
* write wsl.conf: * write wsl.conf:
* `sudo touch /etc/wsl.conf` * `sudo touch /etc/wsl.conf`
@ -59,16 +63,20 @@ Here's what I've done so far:
* add content `echo "nameserver 8.8.8.8" | sudo tee /etc/resolv.conf > /dev/null` * add content `echo "nameserver 8.8.8.8" | sudo tee /etc/resolv.conf > /dev/null`
* add alacritty config: `/mnt/c/Users/<winuser>/AppData/Roaming/alacritty/alacritty.yml` * add alacritty config: `/mnt/c/Users/<winuser>/AppData/Roaming/alacritty/alacritty.yml`
* add private folder symlink: `ln -s -f /mnt/c/Users/<winuser>/Private ~/Private` * add private folder symlink: `ln -s -f /mnt/c/Users/<winuser>/Private ~/Private`
* follow Ubuntu guide:
* `apt install neovim` (NVIM v0.4.3) - consider * `apt install neovim` (NVIM v0.4.3) - consider
* `apt install texlive` * `apt install texlive texlive-latex-extra`
* setup [ssh github](ubuntu.md#setup-ssh-key-for-github) * setup [ssh github](ubuntu.md#setup-ssh-key-for-github)
* install [brew](ubuntu#brew)
* install [zsh + omz](ubuntu.md#apt-package) * install [zsh + omz](ubuntu.md#apt-package)
* clone this (dotfiles) repo and `cd dotfiles` * clone this (dotfiles) repo and `cd dotfiles`
* configure git (inspired by `make setup_git`) * configure git (inspired by `make setup_git`)
* TODO: remove email from this file * TODO: remove email from makefile
* install [build-essential](https://askubuntu.com/a/753113/882709) to get `make` * install [build-essential](https://askubuntu.com/a/753113/882709) to get `make`
* run `make setup_locale setup_zshrc setup_tmux_a setup_nvim setup_editorconfig setup_client_mynetwork` * run `make setup_locale setup_zshrc setup_tmux_a setup_nvim setup_editorconfig setup_client_mynetwork`
* TODO: move up: install [brew](ubuntu#brew) (should be done before install zsh / omz) * configure nvim clipboard to use system clipboard - had to setup some windows yank script
* install autohotkey
* add script: shift and space + caps and escape: `sas-cae.ahk`
* Next steps: * Next steps:
* TODO: configure nvim clipboard to use system clipboard * TODO: tmux pasteboard should play with windows pasteboard
* TODO: nvim + tmux pasteboard should play with windows pasteboard * install node 18 and npm

View file

@ -11,3 +11,8 @@ mousewheel.default.delta_multiplier_y: 10
``` ```
> [source](https://www.reddit.com/r/firefox/comments/mq9g52/linux_firefox_performancemacos_like_mouse_wheel/) > [source](https://www.reddit.com/r/firefox/comments/mq9g52/linux_firefox_performancemacos_like_mouse_wheel/)
## other firefox config
* new tabs open next to current tab
* `browser.tabs.insertAfterCurrent = true`

View file

@ -5,7 +5,7 @@ setup_zshrc:
ln -s -f ~/dotfiles/.zshrc ~/.zshrc ln -s -f ~/dotfiles/.zshrc ~/.zshrc
setup_alacritty_wsl: setup_alacritty_wsl:
ln -s -f ~/dotfiles/.config/alacritty/alacritty.yml /mnt/c/Users/dnth/AppData/Roaming/alacritty/alacritty.yml cp ~/dotfiles/.config/alacritty/alacritty.yml /mnt/c/Users/dnth/AppData/Roaming/alacritty/alacritty.yml
setup_alacritty: setup_alacritty:
mkdir -p ~/.config/alacritty mkdir -p ~/.config/alacritty

116
sas-cae.ahk Normal file
View file

@ -0,0 +1,116 @@
; this file contains two mods: shift-and-space and control-and-escape
; shift-and-space script
; source: https://stackoverflow.com/a/39226212
#InputLevel, 10 ;set send level for the following code to 10
$Space::
#InputLevel ;set it back to default value of 0 for any remaining code
now := A_TickCount
while GetKeyState("Space", "P") ; to find out whether space-bar is held
if (A_TickCount-now > 120) ; this time is tested on asker's computer
{
SendInput {Shift Down}
KeyWait, Space
SendInput {Shift Up}
return
}
SendInput {Space} ; if key detected to be tapped, send space as per normal
return
; control-and-escape script
; source: https://gist.github.com/nocaoper/b872f97cda29bd8f0f2617606abd9fe4
LShift & Capslock::
SetCapsLockState, % (State:=!State) ? "on" : "alwaysoff"
Return
g_AbortSendEsc := false
#InstallKeybdHook
SetCapsLockState, alwaysoff
Capslock::
g_DoNotAbortSendEsc := true
Send {LControl Down}
KeyWait, CapsLock
Send {LControl Up}
if ( A_PriorKey = "CapsLock")
{
if(g_DoNotAbortSendEsc){
Send {Esc}
}
}
return
~*^a::
~*^b::
~*^c::
~*^d::
~*^e::
~*^f::
~*^g::
~*^h::
~*^i::
~*^j::
~*^k::
~*^l::
~*^m::
~*^n::
~*^o::
~*^p::
~*^q::
~*^r::
~*^s::
~*^t::
~*^u::
~*^v::
~*^w::
~*^x::
~*^y::
~*^z::
~*^1::
~*^2::
~*^3::
~*^4::
~*^5::
~*^6::
~*^7::
~*^8::
~*^9::
~*^0::
~*^Space::
~*^Backspace::
~*^Delete::
~*^Insert::
~*^Home::
~*^End::
~*^PgUp::
~*^PgDn::
~*^Tab::
~*^Return::
~*^,::
~*^.::
~*^/::
~*^;::
~*^'::
~*^[::
~*^]::
~*^\::
~*^-::
~*^=::
~*^`::
~*^F1::
~*^F2::
~*^F3::
~*^F4::
~*^F5::
~*^F6::
~*^F7::
~*^F8::
~*^F9::
~*^F10::
~*^F11::
~*^F12::
g_DoNotAbortSendEsc := false
return

109
scripts/24-bit-color.sh Normal file
View file

@ -0,0 +1,109 @@
#!/bin/bash
# This file was originally taken (by JohnMorales) from iterm2:
# https://github.com/gnachman/iTerm2/blob/master/tests/24-bit-color.sh
# This file was then taken by (DannyDannyDanny) from JohnMorales:
# https://github.com/JohnMorales/dotfiles/blob/master/colors/24-bit-color.sh
#
# This file echoes a bunch of 24-bit color codes
# to the terminal to demonstrate its functionality.
# The foreground escape sequence is ^[38;2;<r>;<g>;<b>m
# The background escape sequence is ^[48;2;<r>;<g>;<b>m
# <r> <g> <b> range from 0 to 255 inclusive.
# The escape sequence ^[0m returns output to default
#
# The script can be run using if cloned locally
# $ bash <path>/scripts/24-bit-color.sh
#
# Alternatively download the script and pipe it into bash:
# $ curl -s https://raw.githubusercontent.com/DannyDannyDanny/dotfiles/main/scripts/24-bit-color.sh | bash
setBackgroundColor()
{
#printf '\x1bPtmux;\x1b\x1b[48;2;%s;%s;%sm' $1 $2 $3
printf '\x1b[48;2;%s;%s;%sm' $1 $2 $3
}
resetOutput()
{
echo -en "\x1b[0m\n"
}
# Gives a color $1/255 % along HSV
# Who knows what happens when $1 is outside 0-255
# Echoes "$red $green $blue" where
# $red $green and $blue are integers
# ranging between 0 and 255 inclusive
rainbowColor()
{
let h=$1/43
let f=$1-43*$h
let t=$f*255/43
let q=255-t
if [ $h -eq 0 ]
then
echo "255 $t 0"
elif [ $h -eq 1 ]
then
echo "$q 255 0"
elif [ $h -eq 2 ]
then
echo "0 255 $t"
elif [ $h -eq 3 ]
then
echo "0 $q 255"
elif [ $h -eq 4 ]
then
echo "$t 0 255"
elif [ $h -eq 5 ]
then
echo "255 0 $q"
else
# execution should never reach here
echo "0 0 0"
fi
}
for i in `seq 0 127`; do
setBackgroundColor $i 0 0
echo -en " "
done
resetOutput
for i in `seq 255 -1 128`; do
setBackgroundColor $i 0 0
echo -en " "
done
resetOutput
for i in `seq 0 127`; do
setBackgroundColor 0 $i 0
echo -n " "
done
resetOutput
for i in `seq 255 -1 128`; do
setBackgroundColor 0 $i 0
echo -n " "
done
resetOutput
for i in `seq 0 127`; do
setBackgroundColor 0 0 $i
echo -n " "
done
resetOutput
for i in `seq 255 -1 128`; do
setBackgroundColor 0 0 $i
echo -n " "
done
resetOutput
for i in `seq 0 127`; do
setBackgroundColor `rainbowColor $i`
echo -n " "
done
resetOutput
for i in `seq 255 -1 128`; do
setBackgroundColor `rainbowColor $i`
echo -n " "
done
resetOutput

View file

@ -1,7 +1,7 @@
# HOME SERVERS # HOME SERVERS
## Roadmap ## Roadmap
* [ ] read [HN: What'ts on your home server](https://news.ycombinator.com/item?id=34271167)
* [.] auto-setup ssh + ngrok on all machines * [.] auto-setup ssh + ngrok on all machines
* [X] client machines automation * [X] client machines automation
* [X] read ssh commands in [ubuntu](ubuntu.md) * [X] read ssh commands in [ubuntu](ubuntu.md)

View file

@ -72,6 +72,7 @@ copy their public keys to this machine.
* disable password authentication * disable password authentication
## stterm ## stterm
> :bomb: remove stterm - it'll never work on a windows machine
* install requirements * install requirements
* `sudo apt install libfontconfig1-dev` * `sudo apt install libfontconfig1-dev`
* `sudo apt install libx11-dev` * `sudo apt install libx11-dev`
@ -95,13 +96,20 @@ open terminal, run one code snippet at the time and check that no errors occur:
# replace alacritty with stterm # replace alacritty with stterm
sudo apt install git -y # version control sudo apt install git -y # version control
# sudo apt install neovim -y # brew install nvim to get version 0.7
# install neovim: [src](https://vi.stackexchange.com/a/38348)
#sudo apt-get install software-properties-common
sudo add-apt-repository ppa:neovim-ppa/stable
sudo apt-get update
sudo apt-get install neovim -y
# sudo apt install librewolf -y # add librewolf repo first # sudo apt install librewolf -y # add librewolf repo first
sudo apt install qutebrowser -y # minimal vim-binding browser sudo apt install qutebrowser -y # minimal vim-binding browser
sudo apt install gnome-tweaks -y # tool to remap caps to ctrl sudo apt install gnome-tweaks -y # tool to remap caps to ctrl
# sudo apt install alacritty -y # add alacritty repo first # sudo apt install alacritty -y # add alacritty repo first
# replace alacritty with stterm # replace alacritty with stterm
sudo apt install tmux -y # terminal multiplexer sudo apt install tmux -y # terminal multiplexer
sudo apt install jq -y # lightweight and flexible command-line JSON processor
sudo apt install make -y # utility to maintain shell program groups sudo apt install make -y # utility to maintain shell program groups
sudo apt install curl -y # file transfer helper sudo apt install curl -y # file transfer helper
sudo apt install ffmpeg -y # audio/video converter sudo apt install ffmpeg -y # audio/video converter