diff --git a/nvim/m-housh/lua/user/settings.lua b/nvim/m-housh/lua/user/settings.lua index 4c77848..e58a1b6 100644 --- a/nvim/m-housh/lua/user/settings.lua +++ b/nvim/m-housh/lua/user/settings.lua @@ -4,8 +4,8 @@ local fn = vim.fn vim.cmd.set('inccommand=split') o.updatetime = 300 -- faster completion -o.timeoutlen = 500 -- time to wait for a mapped sequence to complete (in milliseconds) -o.ttimeoutlen = 50 -- Time in milliseconds to wait for a key code sequence to complete +--o.timeoutlen = 500 -- time to wait for a mapped sequence to complete (in milliseconds) +--o.ttimeoutlen = 50 -- Time in milliseconds to wait for a key code sequence to complete o.backup = false -- creates a backup file o.swapfile = false -- enable/disable swap file creation o.dir = fn.stdpath("data") .. "/swp" -- swap file directory @@ -35,7 +35,7 @@ o.termguicolors = true -- set term gui colors (most terminals support this) o.cursorline = true -- highlight the current line o.scrolloff = 8 -- Minimal number of screen lines to keep above and below the cursor o.sidescrolloff = 5 -- The minimal number of columns to scroll horizontally -o.hlsearch = true -- highlight all matches on previous search pattern +o.hlsearch = false -- highlight all matches on previous search pattern o.ignorecase = true -- ignore case in search patterns o.foldenable = false -- disable folding; enable with zi o.foldmethod = "expr" diff --git a/scripts/scripts/tmux-sessionator b/scripts/scripts/tmux-sessionator new file mode 100755 index 0000000..8c74e73 --- /dev/null +++ b/scripts/scripts/tmux-sessionator @@ -0,0 +1,27 @@ +#!/usr/bin/env zsh + +# Adapted from: https://github.com/ThePrimeagen/.dotfiles/blob/master/bin/.local/scripts/tmux-sessionizer + +if [[ $# -eq 1 ]]; then + selected=$1 +else + selected=$(find ~/LocalProjects ~/ -mindepth 1 -maxdepth 1 -type d | fzf) +fi + +if [[ -z $selected ]]; then + exit 0 +fi + +selected_name=$(basename "$selected" | tr . _) +tmux_running=$(pgrep tmux) + +if [[ -z $TMUX ]] && [[ -z $tmux_running ]]; then + tmux new-session -s $selected_name -c $selected + exit 0 +fi + +if ! tmux has-session -t $selected_name 2> /dev/null; then + tmux new-session -ds $selected_name -c $selected_name +fi + +tmux switch-client -t $selected_name diff --git a/tmux/tmux.conf b/tmux/tmux.conf index 1df933f..de114e0 100644 --- a/tmux/tmux.conf +++ b/tmux/tmux.conf @@ -33,6 +33,10 @@ set -g prefix C-a unbind C-b bind C-a send-prefix +set-window-option -g mode-keys vi +bind -T copy-mode-vi v send-keys -X begin-selection +bind -T copy-mode-vi y send-keys -X copy-pipe-and-cancel 'xclip -in -selection clipboard' + # Turn the mouse on, but without copy mode dragging set -g mouse on unbind -n MouseDrag1Pane @@ -64,8 +68,11 @@ bind -T prefix l select-pane -R bind -n S-Left previous-window bind -n S-Right next-window +bind-key -r f run-shell "tmux neww ~/.local/scripts/tmux-sessionator" +bind-key -r C run-shell "tmux neww ~/.local/scripts/tmux-sessionator ~/.dotfiles" + # reload new changes -bind-key R source-file ~/.config/tmux/tmux.conf\; \display-message "source-file done" +bind-key r source-file ~/.config/tmux/tmux.conf\; \display-message "source-file done" ######################################## Plugins ######################################## set -g @plugin 'tmux-plugins/tpm' @@ -86,4 +93,5 @@ set -g @plugin 'erikw/tmux-powerline' #neww -d #neww -d neww -d +# Needs to stay at the bottom. run '~/.config/tmux/plugins/tpm/tpm'