Skip to content

--patch not working on specific diff #473

Open
@iloveitaly

Description

@iloveitaly

--patch is not working on a specific diff:

image

It works with most diffs I've run into, but this one seems to cause it issues:

:100644 100644 ec47e8d 0000000 M	.tmux.conf

diff --git i/.tmux.conf w/.tmux.conf
index ec47e8d..399aad8 100644
--- i/.tmux.conf
+++ w/.tmux.conf
@@ -15,8 +15,7 @@ set -g @plugin 'wfxr/tmux-fzf-url'
 # TODO need status bar for this to be useful
 # set -g @plugin 'tmux-plugins/tmux-prefix-highlight'
 # prefix-y to copy, prefix-shift-y to copy and paste
-# set -g @plugin 'tmux-plugins/tmux-yank'
-set -g @plugin 'iloveitaly/tmux-yank#put-with-bracketed-paste'
+set -g @plugin 'tmux-plugins/tmux-yank'
 # prefix-/ and prefix-f for pre-built file search
 # set -g @plugin 'tmux-plugins/tmux-copycat'
 # TODO https://github.com/jabirali/tmux-tilish
@@ -82,6 +81,15 @@ set -g @yank_with_mouse off
 # I don't like the status bar taking up screen real estate
 set -g status off
 
+# TODO will this fix my nano problems?
+# set -s escape-time 0
+
+# TODO not sure exactly how this works yet
+set -s focus-events on
+
+# TODO https://github.com/abhinav/tmux-fastcopy/issues/160
+# set -g destroy-unattached on
+
 # makes scrolling seem more macos-like
 set -g @scroll-speed-num-lines-per-scroll 3
 # allows less and other pagers to use the scroll wheel!
@@ -98,14 +106,23 @@ set-option -ga terminal-overrides ",xterm-256color:Tc"
 
 # Enable CSI u, this makes iterm play better with tmux
 # https://github.com/tmux/tmux/wiki/Modifier-Keys#extended-keys
-set -g extended-keys on
-set -sag terminal-features 'xterm*:extkeys'
+set -s extended-keys on
+set -as terminal-features 'xterm*:extkeys'
 
+# TODO https://github.com/abhinav/tmux-fastcopy/issues/155 jump to selection instead of copying
 # modify file regex to include line and column numbers
 set-option -g @fastcopy-regex-path "(?:[\\w\\-\\.]+|~)?(?:/[\\w\\-\\.@]+){2,}(?:\\:\\d+)?(?:\\:\\d+)?\\b"
-set-option -g @fastcopy-shift-action '/Users/mike/.open-file-path.sh {}'
+set-option -g @fastcopy-regex-stacktrace-path "(?:[\\w\\-\\.@/]+){2,}(?:\\:\\d+)(?:\\:\\d+)?\\b"
 
-set-option -g @open '/Users/mike/.open-file-path.sh'
+# open file in editor on shift-{letter}
+# default action is copy to clipboard
+set-option -g @fastcopy-shift-action '/Users/mike/.open-file-path.sh {}'
+set-option -g @open-editor '/Users/mike/.open-file-path.sh'
+
+###########################
+# Copy Mode Navigation
+# helpful shortcuts for jumping to content in the buffer very quickly
+###########################
 
 # easily jump to prompt starts
 # https://unix.stackexchange.com/questions/226731/jump-to-last-prompt-in-terminal-or-tmux
@@ -114,6 +131,34 @@ bind-key -T copy-mode-vi b {
   send-keys -X search-backward "❯"
 }
 
+# easily jump to jest errors, j for jest
+bind-key -T copy-mode-vi j {
+  send-keys -X start-of-line
+  send-keys -X search-backward " ● "
+}
+
+# copy to EOL and trim trailing newline, and trailing/leading whitespace
+bind-key -T copy-mode-vi C-D {
+  send-keys -X copy-pipe-end-of-line-and-cancel "tr -d '\\n' | sed 's/^[[:space:]]*//;s/[[:space:]]*$//' | tmux paste-buffer -p"
+}
+
+# TODO add copy entire line shortcut, regardless of current cursor
+
+###########################
+# Fast Searching
+# similar to copycat, but using the native search so it's fast (https://github.com/tmux-plugins/tmux-copycat/tree/master)
+###########################
+
+# `/` for quick, interactive searches
+bind-key / command-prompt -i -I "#{pane_search_string}" -T search -p "search" { copy-mode -e; send-keys -X search-backward-incremental "%%" }
+
+# TODO file search https://github.com/tmux-plugins/tmux-copycat/issues/148
+# bind-key f {
+#   send-keys -X search-backward '[a-zA-Z0-9_./-@]+$'
+# }
+
+# TODO add url, file, git sha, etc searches; pull from copycat
+
 ###########################
 # iTerm rebindings
 # In iterm when CSI U mode (extended key mode) is enabled tmux sees M-Left & M-Right arrow keys directly, unlike xterm.js
@@ -153,9 +198,34 @@ bind-key -T copy-mode-vi M-f send-keys -X next-word
 bind-key -T copy-mode-vi M-b send-keys -X previous-word
 
 ###########################
+# Keyboard Based Copy Mode Navigation
 # allow Shift-{Arrows} to be used to start selection AND mutate selection, like macos
 ###########################
 
+bind-key -n S-M-Right {
+  select-pane
+  copy-mode -M
+
+  if-shell -F '#{selection_present}' {
+    send-keys -X next-word
+  } {
+    send-keys -X begin-selection
+    send-keys -X next-word
+  }
+}
+
+bind-key -n S-M-Left {
+  select-pane
+  copy-mode -M
+
+  if-shell -F '#{selection_present}' {
+    send-keys -X previous-word
+  } {
+    send-keys -X begin-selection
+    send-keys -X previous-word
+  }
+}
+
 bind-key -T copy-mode-vi 'S-Down' {
   if-shell -F '#{selection_present}' {
     send-keys -X cursor-down
@@ -258,4 +328,4 @@ unbind -T copy-mode TripleClick1Pane
 # this is at the bottom because it messes with syntax highlighting
 # align word separators with a more standard terminal
 # https://github.com/tmux/tmux/issues/3528
-set-option -g word-separators " ()[]{}',:;\""
+set-option -g word-separators " ()[]{}',:;\""
\ No newline at end of file

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions