tweak: start adding bash and tmux configurations.

This commit is contained in:
NunoSempere 2023-11-14 15:35:10 +00:00
parent 04115e8f8b
commit d8ab048b10
5 changed files with 89 additions and 27 deletions

View File

@ -42,33 +42,6 @@ chmod +x bootstrap.sh
bash bootstrap.sh
```
## Preparatory steps
### 1. Give sudo permissions to your user
Give sudo permissions to your user:
```
```
### 2. Install git and download the rest of this distribution
```
sudo apt install git
git config --global user.email "nuno.semperelh@protonmail.com" # to do: add part of a script that asks you for this, or lets you configure it
git config --global user.name "NunoSempere"
git config --global credential.helper 'store --file ~/.git-credentials'
git config --global init.defaultBranch master
cd ~/Documents
git clone https://git.nunosempere.com/open.source/nunOS.git
```
N.B.: Could also just provide a bash script to fetch with wget. The script could then fetch other scripts? Yeah, that's probably the way to go in the end. But for now I'll be writting the individual scripts that that future script will orchestrate.
### Install a few essentials.
```
sudo apt install neovim
git config --global core.editor "vim"

17
config/bash/shadows.sh Normal file
View File

@ -0,0 +1,17 @@
function tmux(){
/usr/bin/tmux -f ~/.config/tmux/tmux.conf
}
function lf() {
tmp="$(mktemp)"
lf0 -last-dir-path="$tmp" "$@" --command "set hidden"
if [ -f "$tmp" ]; then
dir="$(cat "$tmp")"
rm -f "$tmp"
if [ -d "$dir" ]; then
if [ "$dir" != "$(pwd)" ]; then
cd "$dir"
fi
fi
fi
}

70
config/tmux/.tmux.conf Normal file
View File

@ -0,0 +1,70 @@
# Shortcuts
## See: https://www.hamvocke.com/blog/a-guide-to-customizing-your-tmux-conf/
# remap prefix from 'C-b' to 'C-a'
unbind C-b
set-option -g prefix C-a
bind-key C-a send-prefix
# No delay for escape key press
set -sg escape-time 0
## vim mode
setw -g mode-keys vi
# selection
## https://www.rockyourcode.com/copy-and-paste-in-tmux/
set-option -g mouse on
set-option -s set-clipboard off
bind P paste-buffer
bind-key -T copy-mode-vi v send-keys -X begin-selection
unbind -T copy-mode-vi Enter
bind-key -T copy-mode-vi Enter send-keys -X copy-pipe-and-cancel 'xclip -se c -i'
bind-key -T copy-mode-vi 'y' send-keys -X copy-pipe-and-cancel 'xclip -se c -i'
bind-key -T copy-mode-vi MouseDragEnd1Pane send-keys -X copy-pipe-and-cancel 'xclip -se c -i'
## a long, long history
set-option -g history-limit 5000
# don't rename windows automatically
set-option -g allow-rename off
setw -g automatic-rename off
# split panes using / and -, into the same directory
bind / split-window -h -c "#{pane_current_path}"
bind - split-window -v -c "#{pane_current_path}"
unbind '"'
unbind %
# open new window into Documents directory with Ctrl+A+c
bind c new-window -c "~/Documents" # "bash -i -c 'lf && exec bash'"
# switch panes using Alt-arrow without prefix
bind -n M-Left select-pane -L
bind -n M-Right select-pane -R
bind -n M-Up select-pane -U
bind -n M-Down select-pane -D
# Use Alt-vim keys without prefix key to switch panes
bind -n M-h select-pane -L
bind -n M-j select-pane -D
bind -n M-k select-pane -U
bind -n M-l select-pane -R
# Shift arrow to switch windows
bind -n S-Left previous-window
bind -n S-Right next-window
## Get HOME and END keys to work in nvim.
## <https://github.com/neovim/neovim/issues/6134>
bind-key -n Home send Escape "OH"
bind-key -n End send Escape "OF"
# Reload config
bind r source-file ~/config/.tmux.conf
## Disable status bar
bind-key b set -g status off
# Terminal config
set -g default-terminal "xterm-256color"

1
packages/core/1-bash.sh Normal file
View File

@ -0,0 +1 @@
echo "source ~/.config/bash/.bashrc" >> "~/.bashrc"

1
packages/core/2-tmux.sh Normal file
View File

@ -0,0 +1 @@
sudo apt install tmux