git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: pudinha <rogi@skylittlesystem.org>
To: git@vger.kernel.org
Cc: pudinha <rogi@skylittlesystem.org>
Subject: [PATCH v2 2/2] Support nvim as merge tool
Date: Sun, 19 Jul 2020 05:23:38 +0100	[thread overview]
Message-ID: <20200719042335.3913-3-rogi@skylittlesystem.org> (raw)
In-Reply-To: <20200718192001.27434-1-rogi@skylittlesystem.org>

---
 contrib/completion/git-completion.bash |  4 ++--
 git-mergetool--lib.sh                  |  7 +++++--
 mergetools/nvimdiff                    |  1 +
 mergetools/vimdiff                     | 15 +++++++++------
 4 files changed, 17 insertions(+), 10 deletions(-)
 create mode 100644 mergetools/nvimdiff

diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
index ee468ea3b0..aed08f8df5 100644
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -1712,8 +1712,8 @@ _git_diff ()
 }
 
 __git_mergetools_common="diffuse diffmerge ecmerge emerge kdiff3 meld opendiff
-			tkdiff vimdiff gvimdiff xxdiff araxis p4merge bc
-			codecompare smerge
+			tkdiff vimdiff nvimdiff gvimdiff xxdiff araxis p4merge
+			bc codecompare smerge
 "
 
 _git_difftool ()
diff --git a/git-mergetool--lib.sh b/git-mergetool--lib.sh
index 29fecc340f..2defef28cd 100644
--- a/git-mergetool--lib.sh
+++ b/git-mergetool--lib.sh
@@ -304,11 +304,14 @@ list_merge_tool_candidates () {
 		tools="$tools smerge"
 	fi
 	case "${VISUAL:-$EDITOR}" in
+	*nvim*)
+		tools="$tools nvimdiff vimdiff emerge"
+		;;
 	*vim*)
-		tools="$tools vimdiff emerge"
+		tools="$tools vimdiff nvimdiff emerge"
 		;;
 	*)
-		tools="$tools emerge vimdiff"
+		tools="$tools emerge vimdiff nvimdiff"
 		;;
 	esac
 }
diff --git a/mergetools/nvimdiff b/mergetools/nvimdiff
new file mode 100644
index 0000000000..04a5bb0ea8
--- /dev/null
+++ b/mergetools/nvimdiff
@@ -0,0 +1 @@
+. "$MERGE_TOOLS_DIR/vimdiff"
diff --git a/mergetools/vimdiff b/mergetools/vimdiff
index 3925e1fc3e..abc8ce4ec4 100644
--- a/mergetools/vimdiff
+++ b/mergetools/vimdiff
@@ -5,7 +5,7 @@ diff_cmd () {
 
 merge_cmd () {
 	case "$1" in
-	gvimdiff|vimdiff)
+	*vimdiff)
 		if $base_present
 		then
 			"$merge_tool_path" -f -d -c '4wincmd w | wincmd J' \
@@ -15,11 +15,11 @@ merge_cmd () {
 				"$LOCAL" "$MERGED" "$REMOTE"
 		fi
 		;;
-	gvimdiff2|vimdiff2)
+	*vimdiff2)
 		"$merge_tool_path" -f -d -c 'wincmd l' \
 			"$LOCAL" "$MERGED" "$REMOTE"
 		;;
-	gvimdiff3|vimdiff3)
+	*vimdiff3)
 		if $base_present
 		then
 			"$merge_tool_path" -f -d -c 'hid | hid | hid' \
@@ -34,10 +34,13 @@ merge_cmd () {
 
 translate_merge_tool_path() {
 	case "$1" in
-	gvimdiff|gvimdiff2|gvimdiff3)
+	nvimdiff*)
+		echo nvim
+		;;
+	gvimdiff*)
 		echo gvim
 		;;
-	vimdiff|vimdiff2|vimdiff3)
+	vimdiff*)
 		echo vim
 		;;
 	esac
@@ -48,7 +51,7 @@ exit_code_trustable () {
 }
 
 list_tool_variants () {
-	for prefix in '' g; do
+	for prefix in '' g n; do
 		for suffix in '' 2 3; do
 			echo "${prefix}vimdiff${suffix}"
 		done
-- 
2.27.0


  parent reply	other threads:[~2020-07-19  4:28 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-18 19:20 [PATCH] Support nvim as mergetool pudinha
2020-07-18 20:30 ` Junio C Hamano
2020-07-19  4:23 ` [PATCH v2 0/2] Support nvim as merge tool pudinha
2020-07-29 21:31   ` [PATCH v3 0/2] mergetools: add support for nvimdiff (neovim) family pudinha
2020-07-29 21:31     ` [PATCH v3 1/2] mergetool--lib: improve support for vimdiff-style tool variants pudinha
2020-07-29 21:31     ` [PATCH v3 2/2] mergetools: add support for nvimdiff (neovim) family pudinha
2020-07-19  4:23 ` [PATCH v2 1/2] Refactor vimdiff and bc merge tool variants pudinha
2020-07-20 18:51   ` Junio C Hamano
2020-07-19  4:23 ` pudinha [this message]
2020-07-20 18:52   ` [PATCH v2 2/2] Support nvim as merge tool Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200719042335.3913-3-rogi@skylittlesystem.org \
    --to=rogi@skylittlesystem.org \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).