diff --git a/README.md b/README.md index 1f57f29..5ce9f55 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,21 @@ # dotfiles + mar does dotfiles -## Sources +# post install + +Set iTerm2 to use the preferences file, if applicable. + +## tmux + +```fish +tmux attach || tmux new -s main +sudo ln -s ~/.tmux/plugins/tmux-open-nvim/scripts/ton /usr/local/bin/ton +``` +`` to install plugins. + +## sources + [oh-my-zsh git](https://kapeli.com/cheat_sheets/Oh-My-Zsh_Git.docset/Contents/Resources/Documents/index) [git-prevision](https://gist.github.com/TheCodeArtist/a90978ebca0ff6743036) [iTerm2 keymaps for tmux](https://web.archive.org/web/20230921160724/https://tangledhelix.com/blog/2012/04/28/iterm2-keymaps-for-tmux/) diff --git a/git/install.fish b/git/install.fish deleted file mode 100755 index b52c8e9..0000000 --- a/git/install.fish +++ /dev/null @@ -1,6 +0,0 @@ -#!/usr/bin/env sh - -. "$DOT/homebrew/brew_utils.sh" - -brew_install "Github CLI" "gh" -brew_install "Gitmoji" "gitmoji" diff --git a/homebrew/brew_utils b/homebrew/brew_utils new file mode 100644 index 0000000..21e7cd0 --- /dev/null +++ b/homebrew/brew_utils @@ -0,0 +1,59 @@ +#!/user/bin/env fish + +source "$DOT/script/utils" + +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +function brew_prefix + set -f path (brew --prefix 2>/dev/null) + + if [ -n $path ] + printf '%s' "$path" + return 0 + else + print_error "Homebrew (get prefix)" + return 1 + end +end + +function brew_tap + brew tap "$argv[1]" &>/dev/null +end + +function brew_update + execute "brew update" "Homebrew (update)" +end + +function brew_upgrade + execute "brew upgrade" "Homebrew (upgrade)" +end + +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +function brew_install + set -f formula_readable_name $argv[1] + set -f formula $argv[2] + set -f arguments $argv[3] + set -f tap_value $argv[4] + + # Check that Homebrew is installed + if ! cmd_exists "brew" + print_error "$formula_readable_name ('Homebrew' is not installed)" + end + + # If 'brew tap' needs to be executed, check if it executed correctly. + if [ -n "$tap_value"] + if ! brew_tap "$tap_value" + print_error "$formula_readable_name ('brew tap $tap_value' failed)" + return 1 + end + end + + # Install the formula. + if brew list "$formula" &>/dev/null + print_success "$formula_readable_name" + else + execute "brew install $formula $arguments" \ + "$formula_readable_name" + end +end diff --git a/homebrew/os/pref.sh b/homebrew/os/pref.sh new file mode 100755 index 0000000..e69de29 diff --git a/script/dot b/script/dot index 84bcd6a..322d033 100755 --- a/script/dot +++ b/script/dot @@ -81,7 +81,12 @@ function link_file mkdir -p (string replace -r '\/[^\/]+$' '' "$dst") end - ln -s "$src" "$dst" &> /dev/null + if string match -e '.hardlink' "$src" &> /dev/null + ln "$src" "$dst" &> /dev/null + else + ls -s "$src" "$dst" &> /dev/null + end + print_success "Linked $src to $dst" end end diff --git a/tmux/.tmux.conf.copy b/tmux/.tmux.conf.hardlink similarity index 70% rename from tmux/.tmux.conf.copy rename to tmux/.tmux.conf.hardlink index 89bb2e0..b6090e7 100644 --- a/tmux/.tmux.conf.copy +++ b/tmux/.tmux.conf.hardlink @@ -2,6 +2,10 @@ set -g @plugin 'tmux-plugins/tpm' set -g @plugin 'tmux-plugins/tmux-sensible' set -g @plugin 'tmux-plugins/tmux-resurrect' set -g @plugin 'catppuccin/tmux' +set -g @plugin 'Morantron/tmux-fingers' + +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + # catppuccin set -g @catppuccin_flavour 'mocha' @@ -27,18 +31,31 @@ set -g @catppuccin_directory_text "#{pane_current_path}" # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# Remap prefix. +unbind C-b +set-option -g prefix C-a +bind-key C-a send-prefix + +# Vi copy mode. set-window-option -g mode-keys vi bind-key -T copy-mode-vi 'v' send -X begin-selection bind-key -T copy-mode-vi 'y' send -X copy-selection-and-cancel -bind | split-window -h -c "#{pane_current_path}" -bind - split-window -v -c "#{pane_current_path}" +# Better split commands. +bind | split-window -h -c "#{pane_current_path}" # cmd-| in iTerm2 +bind - split-window -v -c "#{pane_current_path}" # cmd-- in iTerm2 +unbind '"' +unbind % -bind-key J resize-pane -D -bind-key K resize-pane -U -bind-key H resize-pane -L -bind-key L resize-pane -R +# Vi-like resizing. +bind-key j resize-pane -D # cmd-j in iTerm2 +bind-key k resize-pane -U # cmd-k in iTerm2 +bind-key h resize-pane -L # cmd-h in iTerm2 +bind-key l resize-pane -R # cmd-l in iTerm2 + +# Easy reload config. +bind r source-file ~/.tmux.conf # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -