Set configs for different envrionments

+ Check if we're in docker or running xorg
+ Adjust tmux / vim settings
This commit is contained in:
Shaun Reed 2022-08-28 17:25:44 -04:00
parent e0ff2faeba
commit 8ec0ec3cef
8 changed files with 118 additions and 49 deletions

View File

@ -1,14 +1,23 @@
# For Rust stuff, uncomment this line
#. "$HOME/.cargo/env"
# Clear kscreen cached settings
alias kapp-kscreen='rm -rf ~/.local/share/kscreen/*'
# Restart plasmashell
alias kapp-plasmashell='sudo pkill plasmashell && plasmashell --replace &> /dev/null &'
# Clear swap
alias kapp-swap='sudo swapoff -a && sudo swapon -a'
alias kapp-git='git config --global user.name "Shaun Reed" && git config --global user.email "shaunrd0@gmail.com"'
alias kapp-update='sudo apt update -y && sudo apt upgrade -y && sudo apt upgrade --fix-broken --fix-missing --auto-remove'
if [ -f /.dockerenv ]; then
export DOT_PACKAGES='git stow vim tmux ranger clang wget curl'
alias kapp-update='apt update -y && apt upgrade -y && apt upgrade --fix-broken --fix-missing --auto-remove'
alias kapp-init='apt update -y && apt install $DOT_PACKAGES -y'
alias kapp-swap='swapoff -a && swapon -a'
else
export DOT_PACKAGES='git stow vim xsel xclip tmux ranger clang yakuake wget curl'
alias kapp-update='sudo apt update -y && sudo apt upgrade -y && sudo apt upgrade --fix-broken --fix-missing --auto-remove'
alias kapp-init='sudo apt update -y && sudo apt install $DOT_PACKAGES'
# Clear kscreen cached settings
alias kapp-kscreen='rm -rf ~/.local/share/kscreen/*'
# Restart plasmashell
alias kapp-plasmashell='sudo pkill plasmashell && plasmashell --replace &> /dev/null &'
alias kapp-swap='sudo swapoff -a && sudo swapon -a'
alias kapp-vbox='ps aux www |grep 'VBoxClient --draganddrop' | awk '{print $2}' | xargs kill'
fi
# Alias / export customizations
@ -85,3 +94,12 @@ export LESS='--mouse --wheel-lines 2'
# + -#2 to shift 2 columns horizontally when right / left arrow is pressed
export LESS="$LESS -R -w -#2"
if ! [ command -v conda &>/dev/null ] && [ -e ~/Code/Clones/mambaforge/bin/conda ] && ! grep -e conda ~/.bashrc &>/dev/null; then
if ! (~/Code/Clones/mambaforge/bin/conda init | awk -F "==>" '{print $1}'); then
echo "[dot] ERROR: Failed to initialize Conda."
fi
echo "[dot] WARN: Ran \`conda init\`; Conda was installed but not initialized"
source ~/.bashrc
fi

View File

@ -57,9 +57,6 @@ bind -n M-Right select-pane -R
bind -n M-Up select-pane -U
bind -n M-Down select-pane -D
# Can't use theme plugin without risk of repo update overwriting data?
#source-file "${HOME}/.tmux-themepack/powerline/double/green.tmuxtheme"
set-option -g status-position top
# Status update interval
set -g status-interval 1
@ -69,17 +66,15 @@ set -g status-style fg=colour240,bg=colour233
# Left side of status bar
set -g status-left-style bg=colour233,fg=colour243
set -g status-left-length 40
# Note: Powerline font requires alternate of bold on right side
# + Corrects gap on right of character that reveals BG color
# Note: No bold required, no BG reveal produced by symbol gaps on left side
#+ Font: Powerline Consolas
set -g status-left "#[fg=colour233,bg=colour100,bold] #S #[fg=colour100,bg=colour240,nobold]#[fg=colour233,bg=colour240] #(whoami) #[fg=colour240,bg=colour235]#[fg=colour240,bg=colour235] #(hostname) #[fg=colour235,bg=colour233]#[fg=colour240,bg=colour233]"
# + Font: Sauce Code Pro (NERD patch)
# Right side of status bar
set -g status-right-style bg=colour233,fg=colour243
set -g status-right-length 100
# Note: Powerline font requires alternate of bold on right side
# Corrects gap on right of character that reveals BG color
#+ Font: Powerline Consolas
set -g status-right "#[fg=colour235,bg=colour233,bold]#[fg=colour240,bg=colour235,nobold] %H:%M:%S #[fg=colour240,bg=colour235,bold]#[fg=colour233,bg=colour240,nobold] %d-%b-%y #[fg=colour100,bg=colour240,bold]#[fg=colour233,bg=colour100,bold] #(cd #{pane_current_path}; basename `git rev-parse --show-toplevel`) "
# Set gitmux to appear in center of tmux status bar
run 'bash -c "if command -v $HOME/go/bin/gitmux &>/dev/null; then test -f $HOME/.gitmux.conf || $HOME/go/bin/gitmux -printcfg > $HOME/.gitmux.conf; fi"'
@ -87,6 +82,12 @@ set -g window-status-current-format "#($HOME/go/bin/gitmux -cfg $HOME/.gitmux.co
# Or if you don't want gitmux
#set -g window-status-current-format "#[fg=colour255,bg=colour233]#[fg=colour100,nobold] #(whoami)@#H #[fg=colour255,bg=colour233,nobold]"
run-shell "bash ~/.tmux/tmux-conf.sh"
# Check if we are running xorg
#set -g status-left "#[fg=colour233,bg=colour100,bold] #S #[fg=colour100,bg=colour240,nobold]#[fg=colour233,bg=colour240] #(whoami) #[fg=colour240,bg=colour235]#[fg=colour240,bg=colour235] #(hostname) #[fg=colour235,bg=colour233]#[fg=colour240,bg=colour233]"
#set -g status-right "#[fg=colour235,bg=colour233,bold]#[fg=colour240,bg=colour235,nobold] %H:%M:%S #[fg=colour240,bg=colour235,bold]#[fg=colour233,bg=colour240,nobold] %d-%b-%y #[fg=colour100,bg=colour240,bold]#[fg=colour233,bg=colour100,bold] #(cd #{pane_current_path}; basename `git rev-parse --show-toplevel`) "
# Current window status
set -g window-status-current-style bg=colour233,fg=colour100
# Window with activity status
@ -113,22 +114,3 @@ set -g default-terminal "screen-256color"
# Mode
set -g mode-style bg=colour100,fg=colour235
# List of plugins and their settings
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'nhdaly/tmux-better-mouse-mode'
set -g @scroll-speed-num-lines-per-scroll 2
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-yank'
set -g @yank_action 'copy-pipe-no-clear'
bind -T copy-mode C-c send -X copy-pipe-no-clear "xsel -i --clipboard"
bind -T copy-mode-vi C-c send -X copy-pipe-no-clear "xsel -i --clipboard"
#set -g @plugin 'tmux-plugins/tmux-sensible'
#set -g @plugin 'kristijanhusak/tmux-simple-git-status'
# Other examples:
# set -g @plugin 'github_username/plugin_name'
# set -g @plugin 'git@github.com/user/plugin'
# set -g @plugin 'git@bitbucket.com/user/plugin'
# Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf)
run -b '~/.tmux/plugins/tpm/tpm'

20
.tmux/.tmux-gui.conf Normal file
View File

@ -0,0 +1,20 @@
set -g status-left "#[fg=colour233,bg=colour100,bold] #S #[fg=colour100,bg=colour240,nobold]#[fg=colour233,bg=colour240] #(whoami) #[fg=colour240,bg=colour235]#[fg=colour240,bg=colour235] #(hostname) #[fg=colour235,bg=colour233]#[fg=colour240,bg=colour233]"
set -g status-right "#[fg=colour235,bg=colour233,bold]#[fg=colour240,bg=colour235,nobold] %H:%M:%S #[fg=colour240,bg=colour235,bold]#[fg=colour233,bg=colour240,nobold] %d-%b-%y #[fg=colour100,bg=colour240,bold]#[fg=colour233,bg=colour100,bold] #(cd #{pane_current_path}; basename `git rev-parse --show-toplevel`) "
# List of plugins and their settings
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'nhdaly/tmux-better-mouse-mode'
set -g @scroll-speed-num-lines-per-scroll 2
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-yank'
set -g @yank_action 'copy-pipe-no-clear'
bind -T copy-mode C-c send -X copy-pipe-no-clear "xsel -i --clipboard"
bind -T copy-mode-vi C-c send -X copy-pipe-no-clear "xsel -i --clipboard"
# Other examples:
# set -g @plugin 'github_username/plugin_name'
# set -g @plugin 'git@github.com/user/plugin'
# set -g @plugin 'git@bitbucket.com/user/plugin'
# Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf)
run -b '~/.tmux/plugins/tpm/tpm'

16
.tmux/.tmux-tty.conf Normal file
View File

@ -0,0 +1,16 @@
set -g status-left "#[fg=colour233,bg=colour100,bold] #S #[fg=colour100,bg=colour240,nobold]#[fg=colour233,bg=colour240] #(whoami) #[fg=colour240,bg=colour235]#[fg=colour240,bg=colour235] #(hostname) #[fg=colour235,bg=colour233]#[fg=colour240,bg=colour233]"
set -g status-right "#[fg=colour235,bg=colour233,bold]#[fg=colour240,bg=colour235,nobold] %H:%M:%S #[fg=colour240,bg=colour235,bold]#[fg=colour233,bg=colour240,nobold] %d-%b-%y #[fg=colour100,bg=colour240,bold]#[fg=colour233,bg=colour100,bold] #(cd #{pane_current_path}; basename `git rev-parse --show-toplevel`) "
# List of plugins and their settings
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'nhdaly/tmux-better-mouse-mode'
set -g @scroll-speed-num-lines-per-scroll 2
set -g @plugin 'tmux-plugins/tpm'
# Other examples:
# set -g @plugin 'github_username/plugin_name'
# set -g @plugin 'git@github.com/user/plugin'
# set -g @plugin 'git@bitbucket.com/user/plugin'
# Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf)
run -b '~/.tmux/plugins/tpm/tpm'

7
.tmux/tmux-conf.sh Executable file
View File

@ -0,0 +1,7 @@
#!/bin/bash
if [ -z ${DISPLAY+notset} ]; then
tmux source-file ~/.tmux/.tmux-tty.conf
else
tmux source-file ~/.tmux/.tmux-gui.conf
fi

45
.vimrc
View File

@ -2,6 +2,9 @@
" Double-quotes are commented out code and can be removed or added
" General Vim Settings
let is_docker = filereadable(expand('/.dockerenv'))
let has_sauce = filereadable(expand('~/.local/share/fonts/sauce-code-pro.otf'))
let is_xorg = exists("$DISPLAY")
" Highlight the column cursor is on
" May slow screen redraw time, so off by default
@ -138,15 +141,13 @@ nnoremap <C-c> :ColorToggle<CR>
set termencoding=utf-8
set encoding=utf-8
" air-line
let g:airline_powerline_fonts = 1
if !exists('g:airline_symbols')
let g:airline_symbols = {}
endif
if (exists("$SAUCE"))
" airline symbols
" Set glyphs based on font availability and environment (xorg / docker)
if and(and(has_sauce, is_xorg), !is_docker)
let g:airline_left_sep = ''
let g:airline_left_alt_sep = ''
let g:airline_right_sep = ''
@ -154,20 +155,50 @@ if (exists("$SAUCE"))
let g:airline_symbols.branch = ''
let g:airline_symbols.readonly = ''
let g:airline_symbols.linenr = ''
else
elseif is_xorg
" unicode symbols
let g:airline_left_sep = '»'
let g:airline_left_sep = '▶'
let g:airline_right_sep = '«'
let g:airline_right_sep = '◀'
let g:airline_symbols.linenr = '␊'
let g:airline_symbols.linenr = '␤'
let g:airline_symbols.colnr = ' ㏇:'
let g:airline_symbols.colnr = ' ℅:'
let g:airline_symbols.crypt = '🔒'
let g:airline_symbols.linenr = '☰'
let g:airline_symbols.linenr = ' ␊:'
let g:airline_symbols.linenr = ' ␤:'
let g:airline_symbols.linenr = '¶'
let g:airline_symbols.maxlinenr = ''
let g:airline_symbols.maxlinenr = '㏑'
let g:airline_symbols.branch = '⎇'
let g:airline_symbols.paste = 'ρ'
let g:airline_symbols.paste = 'Þ'
let g:airline_symbols.paste = '∥'
let g:airline_symbols.spell = 'Ꞩ'
let g:airline_symbols.notexists = 'Ɇ'
let g:airline_symbols.whitespace = 'Ξ'
else
" unicode symbols
let g:airline_left_sep = ''
let g:airline_left_sep = ''
let g:airline_right_sep = ''
let g:airline_right_sep = ''
let g:airline_symbols.colnr = ''
let g:airline_symbols.colnr = ''
let g:airline_symbols.crypt = ''
let g:airline_symbols.linenr = ''
let g:airline_symbols.linenr = ''
let g:airline_symbols.linenr = ''
let g:airline_symbols.linenr = ''
let g:airline_symbols.maxlinenr = ''
let g:airline_symbols.maxlinenr = ''
let g:airline_symbols.branch = ''
let g:airline_symbols.paste = ''
let g:airline_symbols.paste = ''
let g:airline_symbols.paste = ''
let g:airline_symbols.spell = ''
let g:airline_symbols.notexists = ''
let g:airline_symbols.whitespace = ''
endif
" Clang completeion settings

View File

@ -11,7 +11,7 @@ Once installed, editing source code in vim supports features displayed in the sc
Easiest installation is to clone repository into home directory -
```bash
sudo apt install vim xsel xclip tmux ranger clang yakuake
sudo apt install git stow vim xsel xclip tmux ranger clang yakuake wget curl
git clone --recursive https://github.com/shaunrd0/dot ~/dot
cd ~/dot/
stow --adopt .
@ -27,7 +27,7 @@ stow --adopt -t ~ .
**Warning:** `--adopt` is used to link conflicting files, but doing so could result in the loss of some configs within your local copy of the repository and on your local system.
After running `stow --adopt .`, be sure to check `git status` is clean.
If a file has been modified, discard the local changes to be up-to-date with `origin/master` and it will be restored on your system as well, since the files are now linked.
If a file has been modified, discard the local changes to be up-to-date with `origin/master` and it will be restored on your system as well, since the files are now linked. **Your conflicting local system configurations will be lost** unless you back them up manually.
We could run the following commands to restore changed files
```bash

View File

@ -1,5 +0,0 @@
# A fix for a common issue found in virtual box
# https://forums.linuxmint.com/viewtopic.php?t=247850
# https://askubuntu.com/questions/1014172/virtualbox-unresponsive-area-on-desktop
#################################################################################
ps aux www |grep 'VBoxClient --draganddrop' | awk '{print $2}' | xargs kill