mirror of
https://github.com/HerrCraziDev/dotfiles.git
synced 2026-04-20 06:24:22 +02:00
update, wsl serial console init, basic vimrc
This commit is contained in:
4
.aliases
4
.aliases
@@ -26,7 +26,7 @@ alias tmr='tmux attach'
|
|||||||
alias ll='ls -lah --color=auto'
|
alias ll='ls -lah --color=auto'
|
||||||
alias reload='source ~/.termrc'
|
alias reload='source ~/.termrc'
|
||||||
|
|
||||||
alias ssj="ssh -J pi@bst1.chenco.dev"
|
alias ssj="ssh -J herrcrazi@lan1.chenco.dev"
|
||||||
|
|
||||||
#alias mc-install-plugin='echo "Installing $2"; echo "Done !"'
|
#alias mc-install-plugin='echo "Installing $2"; echo "Done !"'
|
||||||
alias cls='lxc ls -c ns4DSP'
|
alias cls='lxc ls -c ns4DSP'
|
||||||
@@ -38,6 +38,6 @@ alias zfs='sudo zfs'
|
|||||||
alias zls='sudo zfs list'
|
alias zls='sudo zfs list'
|
||||||
|
|
||||||
sm() {
|
sm() {
|
||||||
tmux new-window -n serial:$(basename ${@:-1}) sudo picocom --baud 921600 --parity n --databits 8 --stopbits 1 --flow n --escape z $@
|
tmux new-window -n serial:$(basename ${@:-1}) sudo picocom --logfile $SERIAL_LOGS/serial-$(basename ${@:-1})-$(ls $SERIAL_LOGS/serial-*.log 2> /dev/null | wc -l).log --baud 921600 --parity n --databits 8 --stopbits 1 --flow n --escape z $@
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
56
.termrc
56
.termrc
@@ -7,6 +7,12 @@ if [ -e $HOME/.tmux/.tmux-aliases ] ; then
|
|||||||
source $HOME/.tmux/.tmux-aliases
|
source $HOME/.tmux/.tmux-aliases
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [ -n "$WSLENV" ] ; then
|
||||||
|
HRNX_TMUX_SESSIONNAME="wsl"
|
||||||
|
else
|
||||||
|
HRNX_TMUX_SESSIONNAME="main"
|
||||||
|
fi
|
||||||
|
|
||||||
# Fix linker errors with gtk3 -- removed since I nuked gtk-nocsd
|
# Fix linker errors with gtk3 -- removed since I nuked gtk-nocsd
|
||||||
#export LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libgtk3-nocsd.so.0
|
#export LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libgtk3-nocsd.so.0
|
||||||
|
|
||||||
@@ -15,6 +21,11 @@ echo -e '\e[34m [termrc] Config reloaded\e[0m'
|
|||||||
# Add Rust crates to path
|
# Add Rust crates to path
|
||||||
#export PATH=$PATH:$HOME/.cargo/bin
|
#export PATH=$PATH:$HOME/.cargo/bin
|
||||||
|
|
||||||
|
# Add node global modules to PATH
|
||||||
|
if nodepath=$(npm root -g); then
|
||||||
|
export PATH=$PATH:$nodepath
|
||||||
|
fi
|
||||||
|
|
||||||
# Usual env vars
|
# Usual env vars
|
||||||
export EDITOR=/usr/bin/vim
|
export EDITOR=/usr/bin/vim
|
||||||
export LANG="en_US.UTF-8"
|
export LANG="en_US.UTF-8"
|
||||||
@@ -37,15 +48,48 @@ if [ -n "$WSLENV" ] ; then
|
|||||||
# Connect serial console port if found
|
# Connect serial console port if found
|
||||||
if [ -z "$_SERIAL_INIT" ] ; then
|
if [ -z "$_SERIAL_INIT" ] ; then
|
||||||
source "$HOME/.usbipd"
|
source "$HOME/.usbipd"
|
||||||
|
|
||||||
|
# Connect serial console ports
|
||||||
echo "Connecting serial port... (device $USB_SERIAL_HWID)"
|
echo "Connecting serial port... (device $USB_SERIAL_HWID)"
|
||||||
usbipd.exe wsl attach --hardware-id $USB_SERIAL_HWID
|
|
||||||
if [ $? -eq 0 ]; then
|
bus_ids=$( usbipd.exe wsl list 2> /dev/null | grep "0403:6001" )
|
||||||
echo "Serial port connected"
|
|
||||||
usbipd.exe wsl list
|
if [ -n "$bus_ids" ] ; then
|
||||||
export _SERIAL_INIT=1
|
echo $bus_ids
|
||||||
|
IFS=$' \t\n'
|
||||||
|
bus_ids=$( tr -s ' ' <<< $bus_ids | cut -d ' ' -f1 | tr '\n' ' ' )
|
||||||
|
|
||||||
|
for bus_id in $=bus_ids ; do
|
||||||
|
usbipd.exe wsl attach --busid $bus_id 2> /dev/null
|
||||||
|
if [ $? -eq 0 ]; then
|
||||||
|
echo "Serial port $bus_id connected"
|
||||||
|
export _SERIAL_INIT=$(($_SERIAL_INIT+1))
|
||||||
|
else
|
||||||
|
echo "Unable to connect serial port (device $USB_SERIAL_HWID, bus $bus_id)"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
usbipd.exe wsl list 2> /dev/null
|
||||||
else
|
else
|
||||||
echo "Unable to connect serial port (device $USB_SERIAL_HWID)"
|
echo "No serial port found matching device type $USB_SERIAL_HWID"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Configure serial logs
|
||||||
|
if [ ! -d $SERIAL_LOGS ] ; then
|
||||||
|
if mkdir -p $SERIAL_LOGS; then echo "Serial logpath created at $SERIAL_LOGS"
|
||||||
|
else echo "Unable to create $SERIAL_LOGS"; fi
|
||||||
|
else
|
||||||
|
echo "Serial logs will be written to $SERIAL_LOGS"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Automatically creates and attach a 'main' tmux session. If already created,
|
||||||
|
# attach in a new window instead. If running from tmux, does nothing.
|
||||||
|
if [ -z "$TMUX" ] ; then
|
||||||
|
#if [ tmux ls -F "#S" | grep $HRNX_TMUX_SESSIONNAME ] ; then
|
||||||
|
|
||||||
|
tmux new-session -A -s $HRNX_TMUX_SESSIONNAME
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
55
.vimrc
Normal file
55
.vimrc
Normal file
@@ -0,0 +1,55 @@
|
|||||||
|
set history=500
|
||||||
|
|
||||||
|
" Filetype plugins
|
||||||
|
filetype plugin on
|
||||||
|
filetype indent on
|
||||||
|
|
||||||
|
" Auto read externally modified files
|
||||||
|
set autoread
|
||||||
|
au FocusGained,BufEnter * silent! checktime
|
||||||
|
|
||||||
|
" :W sudo saves the file
|
||||||
|
" (useful for handling the permission-denied error)
|
||||||
|
command! W execute 'w !sudo tee % > /dev/null' <bar> edit!
|
||||||
|
|
||||||
|
" Regexes, search
|
||||||
|
set magic
|
||||||
|
set incsearch
|
||||||
|
set showmatch
|
||||||
|
set smartcase
|
||||||
|
set ignorecase
|
||||||
|
set hlsearch
|
||||||
|
|
||||||
|
" Line numbers
|
||||||
|
set number
|
||||||
|
|
||||||
|
" Ruler
|
||||||
|
set ruler
|
||||||
|
|
||||||
|
" Colors
|
||||||
|
syntax enable
|
||||||
|
set t_Co=256
|
||||||
|
|
||||||
|
" Default filetypes
|
||||||
|
set ffs=unix,dos,mac
|
||||||
|
|
||||||
|
|
||||||
|
" Tabs and indentation
|
||||||
|
""""""""""""""""""""""
|
||||||
|
|
||||||
|
" Be smart when using tabs ;)
|
||||||
|
set smarttab
|
||||||
|
|
||||||
|
" 1 tab == 4 spaces
|
||||||
|
set shiftwidth=4
|
||||||
|
set tabstop=4
|
||||||
|
|
||||||
|
" Linebreak on 500 characters
|
||||||
|
set lbr
|
||||||
|
set tw=500
|
||||||
|
|
||||||
|
set ai "Auto indent
|
||||||
|
set si "Smart indent
|
||||||
|
set wrap "Wrap lines
|
||||||
|
|
||||||
|
|
||||||
4
.zshrc
4
.zshrc
@@ -65,3 +65,7 @@ SAVEHIST=100000
|
|||||||
setopt autocd beep notify
|
setopt autocd beep notify
|
||||||
bindkey -e
|
bindkey -e
|
||||||
# End of lines configured by zsh-newuser-install
|
# End of lines configured by zsh-newuser-install
|
||||||
|
|
||||||
|
# Disable zsh globbing error messages, leave it to the called program
|
||||||
|
setopt +o nomatch
|
||||||
|
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ bind Enter copy-mode
|
|||||||
bind Escape copy-mode
|
bind Escape copy-mode
|
||||||
|
|
||||||
# Copy mode
|
# Copy mode
|
||||||
|
set -g mode-keys vi # set vim keys
|
||||||
bind C-v paste-buffer
|
bind C-v paste-buffer
|
||||||
bind -T copy-mode-vi Enter send -X copy-selection-no-clear \; send -X copy-pipe-and-cancel "xclip -i -sel c" \; display " [tmux] copied!"
|
bind -T copy-mode-vi Enter send -X copy-selection-no-clear \; send -X copy-pipe-and-cancel "xclip -i -sel c" \; display " [tmux] copied!"
|
||||||
bind -T copy-mode-vi C-c send -X copy-selection-no-clear \; send -X copy-pipe-and-cancel "xclip -i -sel c" \; display " [tmux] copied!"
|
bind -T copy-mode-vi C-c send -X copy-selection-no-clear \; send -X copy-pipe-and-cancel "xclip -i -sel c" \; display " [tmux] copied!"
|
||||||
@@ -36,7 +37,7 @@ bind -T copy-mode-vi Escape send -X cancel
|
|||||||
|
|
||||||
# Window actions
|
# Window actions
|
||||||
# bind y rename-window
|
# bind y rename-window
|
||||||
bind r source-file ~/.tmux.conf; display " [tmux] ♦ Configuration reloaded from .tmux.conf"
|
bind r source-file ~/.tmux.conf #; display " [tmux] ♦ Configuration reloaded from .tmux.conf"
|
||||||
|
|
||||||
# Colors
|
# Colors
|
||||||
set -g display-panes-active-colour colour71
|
set -g display-panes-active-colour colour71
|
||||||
|
|||||||
Reference in New Issue
Block a user