From e91c2fd4a556bc806d082b15c297b964f46e45ba Mon Sep 17 00:00:00 2001 From: Martin Bauer Date: Mon, 6 Jun 2022 19:29:39 +0200 Subject: [PATCH] added tmux, butter fish config --- .gitignore | 1 + buildenv.sh | 101 ++++++++++++++---- config_in/activate.sh | 4 +- .../fish/functions/fish_mode_prompt.fish | 48 +++++++++ config_in/nvim/init.vim | 15 +-- config_in/tmux/tmux.conf | 63 +++++++++++ 6 files changed, 203 insertions(+), 29 deletions(-) create mode 100644 config_in/fish/functions/fish_mode_prompt.fish create mode 100644 config_in/tmux/tmux.conf diff --git a/.gitignore b/.gitignore index 7d0b1c8..128ba03 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ /.mbenv /mbenv.tar.xz +/tmp_install \ No newline at end of file diff --git a/buildenv.sh b/buildenv.sh index f16e5be..ad152f0 100755 --- a/buildenv.sh +++ b/buildenv.sh @@ -9,6 +9,32 @@ export INSTALL_TMP_DIR=$(pwd)/tmp_install export XDG_CONFIG_HOME=${MB_ENV_BASE}/config export XDG_DATA_HOME=${MB_ENV_BASE}/local/share + +# Reset +Color_Off='\033[0m' # Text Reset + +# Regular Colors +Black='\033[0;30m' # Black +Red='\033[0;31m' # Red +Green='\033[0;32m' # Green +Yellow='\033[0;33m' # Yellow +Blue='\033[0;34m' # Blue +Purple='\033[0;35m' # Purple +Cyan='\033[0;36m' # Cyan +White='\033[0;37m' # White + +# Bold +BBlack='\033[1;30m' # Black +BRed='\033[1;31m' # Red +BGreen='\033[1;32m' # Green +BYellow='\033[1;33m' # Yellow +BBlue='\033[1;34m' # Blue +BPurple='\033[1;35m' # Purple +BCyan='\033[1;36m' # Cyan +BWhite='\033[1;37m' # White + +export PATH=${MB_ENV_BASE}/bin:$PATH + # create folders mkdir $MB_ENV_BASE mkdir $INSTALL_TMP_DIR @@ -16,14 +42,22 @@ mkdir $XDG_CONFIG_HOME mkdir -p $XDG_DATA_HOME +printf "${BBlue}Downloading and installing packages${Color_Off}\n" # ------------------------------------------- fish shell ----------------------------------------------------------- # portable fish: https://github.com/xxh/fish-portable + +printf "${Blue}--> fish shell${Color_Off}\n" cd $MB_ENV_BASE +printf "${White} Downloading...${Color_Off}\n" PORTABLE_FISH=https://github.com/xxh/fish-portable/releases/download/3.4.1/fish-portable-musl-alpine-Linux-x86_64.tar.gz -curl -L $PORTABLE_FISH | tar xz +curl -sL $PORTABLE_FISH | tar xz +printf "${White} Configuring...${Color_Off}\n" cp -r ${CONFIG_IN}/fish ${XDG_CONFIG_HOME} +curl -sfLo "${XDG_CONFIG_HOME}"/fish/completions/tmux.fish \ + https://raw.githubusercontent.com/fish-shell/fish-shell/master/share/completions/tmux.fish + # ------------------------------------------- oh my fish ----------------------------------------------------------- export OMF_CHANNEL=stable @@ -33,47 +67,71 @@ FISH_EXE=${MB_ENV_BASE}/bin/fish cp -r ${CONFIG_IN}/omf ${XDG_CONFIG_HOME} cd $INSTALL_TMP_DIR -curl https://raw.githubusercontent.com/oh-my-fish/oh-my-fish/master/bin/install > install_omf -${FISH_EXE} install_omf --noninteractive -${FISH_EXE} -c "omf install" +printf "${White} Installing Oh-My-Fish...${Color_Off}\n" +curl -sL https://raw.githubusercontent.com/oh-my-fish/oh-my-fish/master/bin/install > install_omf +${FISH_EXE} install_omf --noninteractive &> /dev/null +${FISH_EXE} -c "omf install" &> /dev/null # ------------------------------------------- bat ----------------------------------------------------------- +printf "${Blue}--> bat${Color_Off}\n" cd ${INSTALL_TMP_DIR} -curl -L https://github.com/sharkdp/bat/releases/download/v0.21.0/bat-v0.21.0-x86_64-unknown-linux-musl.tar.gz | tar xz +curl -sL https://github.com/sharkdp/bat/releases/download/v0.21.0/bat-v0.21.0-x86_64-unknown-linux-musl.tar.gz | tar xz cd bat* cp bat ${MB_ENV_BASE}/bin mkdir $XDG_CONFIG_HOME/fish/completions cp autocomplete/bat.fish $XDG_CONFIG_HOME/fish/completions/bat.fish -# -------------------------------------------- vim --------------------------------------------------------------- - -#curl -L https://github.com/dtschan/vim-static/releases/download/v8.1.1045/vim > $MB_ENV_BASE/bin/vim -#chmod u+x $MB_ENV_BASE/bin/vim -#mkdir $XDG_CONFIG_HOME/vim -#cp ${CONFIG_IN}/.vimrc $XDG_CONFIG_HOME/vim/vimrc -#curl -fLo $XDG_CONFIG_HOME/vim/autoload/plug.vim --create-dirs \ -# https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim - +# -------------------------------------------- neovim ------------------------------------------------------------ +printf "${Blue}--> neovim${Color_Off}\n" cd ${INSTALL_TMP_DIR} -curl -L https://github.com/neovim/neovim/releases/download/v0.7.0/nvim.appimage > nvim.appimage +printf "${White} Downloading...${Color_Off}\n" +curl -sL https://github.com/neovim/neovim/releases/download/v0.7.0/nvim.appimage > nvim.appimage chmod u+x nvim.appimage -./nvim.appimage --appimage-extract +printf "${White} Extracting AppImage...${Color_Off}\n" +./nvim.appimage --appimage-extract &> /dev/null cd squashfs-root/usr cp ./bin/* ${MB_ENV_BASE}/bin/ +mkdir ${MB_ENV_BASE}/lib cp -r ./lib/* ${MB_ENV_BASE}/lib/ cp -r ./share/nvim ${MB_ENV_BASE}/share/ cp -r ${CONFIG_IN}/nvim ${XDG_CONFIG_HOME} -curl -fLo "${XDG_DATA_HOME}"/nvim/site/autoload/plug.vim --create-dirs \ +printf "${White} Downloading and installing vim-plug${Color_Off}\n" +curl -sfLo "${XDG_DATA_HOME}"/nvim/site/autoload/plug.vim --create-dirs \ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim -cd ${MB_ENV_BASE} +cd ${MB_ENV_BASE}/bin ln -s nvim vi ln -s nvim vim +${MB_ENV_BASE}/bin/nvim +PlugInstall +qall +# -------------------------------------------- tmux ------------------------------------------------------------ + +printf "${Blue}--> tmux${Color_Off}\n" +cd ${INSTALL_TMP_DIR} +rm -rf ${INSTALL_TMP_DIR}/* +curl -sL https://github.com/nelsonenzo/tmux-appimage/releases/download/3.2a/tmux.appimage > tmux.appimage +chmod u+x tmux.appimage +printf "${White} Extracting AppImage...${Color_Off}\n" +./tmux.appimage --appimage-extract &> /dev/null + +cd squashfs-root/usr +cp ./bin/* ${MB_ENV_BASE}/bin/ +cp -r ./lib/* ${MB_ENV_BASE}/lib/ +cp -r ./share/terminfo ${MB_ENV_BASE}/share/ + +cp -r ${CONFIG_IN}/tmux ${XDG_CONFIG_HOME} + +export TERMINFO=${MB_ENV_BASE}/share/terminfo + +printf "${White} Installing tpm package manager...${Color_Off}\n" +cd $XDG_DATA_HOME +mkdir -p tmux/plugins +git clone https://github.com/tmux-plugins/tpm tmux/plugins/tpm &> /dev/null +./tmux/plugins/tpm/bin/install_plugins &> /dev/null # ------------------------------------------- configs ----------------------------------------------------------- @@ -82,7 +140,10 @@ cp ${CONFIG_IN}/activate.sh $MB_ENV_BASE # activation script # ------------------------------------------- pack and cleanup ---------------------------------------------------- +printf "${Blue}Packing archive${Color_Off}\n" cd $BASE tar -cJf mbenv.tar.xz .mbenv -rm -rf ${MB_ENV_BASE} -rm -rf ${INSTALL_TMP_DIR} \ No newline at end of file +#rm -rf ${MB_ENV_BASE} +rm -rf ${INSTALL_TMP_DIR} + +printf "${Green}Done${Color_Off}\n" \ No newline at end of file diff --git a/config_in/activate.sh b/config_in/activate.sh index e8782f9..3376b9b 100755 --- a/config_in/activate.sh +++ b/config_in/activate.sh @@ -6,8 +6,8 @@ export XDG_CONFIG_HOME=${MB_ENV_BASE}/config export XDG_DATA_HOME=${MB_ENV_BASE}/local/share export PATH=${MB_ENV_BASE}/bin:${PATH} export TERM=xterm-256color - - +export TERMINFO=${MB_ENV_BASE}/share/terminfo +export SHELL=${MB_ENV_BASE}/bin/fish ${MB_ENV_BASE}/bin/fish.sh diff --git a/config_in/fish/functions/fish_mode_prompt.fish b/config_in/fish/functions/fish_mode_prompt.fish new file mode 100644 index 0000000..94fc099 --- /dev/null +++ b/config_in/fish/functions/fish_mode_prompt.fish @@ -0,0 +1,48 @@ +# Display the current binding mode... if it's vi or vi-like. +# +# To always show the binding mode (regardless of current bindings): +# set -g theme_display_vi yes +# +# To never show: +# set -g theme_display_vi no + + +# invisible space is inserted into prompt to play nice with tmux jumping +# https://unix.stackexchange.com/questions/226731/jump-to-last-prompt-in-terminal-or-tmux +set -g invisible_space " " + +function fish_mode_prompt -d 'bobthefish-optimized fish mode indicator' + [ "$theme_display_vi" != 'no' ] + or return + + [ "$fish_key_bindings" = 'fish_vi_key_bindings' \ + -o "$fish_key_bindings" = 'hybrid_bindings' \ + -o "$fish_key_bindings" = 'fish_hybrid_key_bindings' \ + -o "$theme_display_vi" = 'yes' ] + or return + + __bobthefish_colors $theme_color_scheme + + type -q bobthefish_colors + and bobthefish_colors + + set_color normal # clear out anything bold or underline... + + switch $fish_bind_mode + case default + set_color -b $color_vi_mode_default + echo -n " N$invisible_space" + case insert + set_color -b $color_vi_mode_insert + echo -n " I$invisible_space" + case replace_one replace-one + set_color -b $color_vi_mode_insert + echo -n " R$invisible_space" + case visual + set_color -b $color_vi_mode_visual + echo -n " V$invisible_space" + end + + set_color normal +end + diff --git a/config_in/nvim/init.vim b/config_in/nvim/init.vim index 253fe70..a6fd299 100644 --- a/config_in/nvim/init.vim +++ b/config_in/nvim/init.vim @@ -1,14 +1,15 @@ -" goto normal mode with jk -inoremap jk -" remove search highlighting when pressing esc -map :noh +" ----------------------------- Own config --------------------------- + +inoremap jk " goto normal mode with jk +map :noh " remove search highlighting when pressing esc +set number " turn on line numbers +" ----------------------------- Plugins ------------------------------ -" --------- Plugins ---------- call plug#begin() - Plug 'justinmk/vim-sneak' - +Plug 'easymotion/vim-easymotion' +Plug 'sheerun/vim-polyglot' call plug#end() \ No newline at end of file diff --git a/config_in/tmux/tmux.conf b/config_in/tmux/tmux.conf new file mode 100644 index 0000000..0abf31e --- /dev/null +++ b/config_in/tmux/tmux.conf @@ -0,0 +1,63 @@ + +# history +set -g history-limit 100000 + +# use vi mode +setw -g mode-keys vi +set -g status-keys vi + + +# easy-to-remember split pane commands +bind | split-window -h +bind - split-window -v +unbind '"' +unbind % + + +# moving between panes with vim movement keys +bind h select-pane -L +bind j select-pane -D +bind k select-pane -U +bind l select-pane -R + +# resize the pane +bind-key -r J resize-pane -D 3 +bind-key -r K resize-pane -U 3 +bind-key -r H resize-pane -L 3 +bind-key -r L resize-pane -R 3 + + +set-option -g status-position top + + +# fast search - not necessary to go to copy first (will switch to copy mode automatically) +bind-key -T copy-mode-vi / command-prompt -i -p "(search down)" "send -X search-forward-incremental \"%%%\"" +bind-key -T copy-mode-vi ? command-prompt -i -p "(search up)" "send -X search-backward-incremental \"%%%\"" + +bind / copy-mode \; command-prompt -i -p "(search up)" "send -X search-forward-incremental \"%%%\"" +bind ? copy-mode \; command-prompt -i -p "(search down)" "send -X search-backward-incremental \"%%%\"" + + +bind -T copy-mode-vi \} { + send-keys -X end-of-line + send-keys -X search-forward " " + send-keys -X end-of-line + send-keys -X search-backward " " + send-keys -X cursor-right +} + +bind -T copy-mode-vi \{ { + send-keys -X start-of-line + send-keys -X search-backward " " + send-keys -X end-of-line + send-keys -X search-backward " " + send-keys -X cursor-right +} + + +# Package manager +set -g @plugin 'tmux-plugins/tpm' +set -g @plugin 'tmux-plugins/tmux-prefix-highlight' +set -g @plugin "arcticicestudio/nord-tmux" + +run "$XDG_DATA_HOME/tmux/plugins/tpm/tpm'