From 883549eba6716b0ad82cf1515667e17676b09e12 Mon Sep 17 00:00:00 2001 From: Jaroslaw Konik Date: Thu, 30 May 2024 21:16:11 +0200 Subject: [PATCH 1/5] update --- .zshrc | 11 ++++++++--- nvim_remote | 10 +++++++--- 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/.zshrc b/.zshrc index b405c85..7a5eb03 100644 --- a/.zshrc +++ b/.zshrc @@ -22,9 +22,14 @@ compinit # nvr_git () { - local repo_path=$(git rev-parse --show-superproject-working-tree 2>/dev/null) - if [ -n "$repo_path" ]; then - local servername=/tmp/nvr$(echo $repo_path | tr "/" "_") + local main_module_repo_path=$(git rev-parse --show-superproject-working-tree 2>/dev/null) + local repo_path=$(git rev-parse --show-toplevel 2>/dev/null) + if [[ -z "$main_module_repo_path" ]]; then + main_module_repo_path=$repo_path + fi + + if [ -n "$main_module_repo_path" ]; then + local servername=/tmp/nvr$(echo $main_module_repo_path | tr "/" "_") nvr -s --servername $servername "$@" else /usr/bin/nvim "$@" diff --git a/nvim_remote b/nvim_remote index fa22482..6ea2f82 100755 --- a/nvim_remote +++ b/nvim_remote @@ -4,15 +4,19 @@ line=$(cut -d " " -f 1 <<< $@) path=$(cut -d " " -f 2 <<< $@) main_module_repo_path=$(git rev-parse --show-superproject-working-tree 2>/dev/null) +repo_path=$(git rev-parse --show-toplevel 2>/dev/null) +if [[ -z "$main_module_repo_path" ]]; then + main_module_repo_path=$repo_path +fi main_module_relative_file_path=$main_module_repo_path/$path -repo_relative_file_path=$(git rev-parse --show-toplevel 2>/dev/null)/$path +repo_relative_file_path=/$path relative_file_path=$path servername=/tmp/nvr$(echo $main_module_repo_path | tr "/" "_") -if [ -n "$relative_path" ]; then - nvr -s --servername $servername $line "$relative_path" +if [ -n "$relative_file_path" ]; then + nvr -s --servername $servername $line "$relative_file_path" elif [ -n "$repo_relative_file_path" ]; then nvr -s --servername $servername $line "$repo_relative_file_path" elif [ -n "$main_module_relative_file_path" ]; then From 545ffd01f405e0c3929b4d28443aa60886a59d2c Mon Sep 17 00:00:00 2001 From: Jaroslaw Konik Date: Thu, 30 May 2024 21:20:17 +0200 Subject: [PATCH 2/5] update --- nvim_remote | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/nvim_remote b/nvim_remote index 6ea2f82..d213ff6 100755 --- a/nvim_remote +++ b/nvim_remote @@ -15,10 +15,10 @@ relative_file_path=$path servername=/tmp/nvr$(echo $main_module_repo_path | tr "/" "_") -if [ -n "$relative_file_path" ]; then +if [ -f "$relative_file_path" ]; then nvr -s --servername $servername $line "$relative_file_path" -elif [ -n "$repo_relative_file_path" ]; then +elif [ -f "$repo_relative_file_path" ]; then nvr -s --servername $servername $line "$repo_relative_file_path" -elif [ -n "$main_module_relative_file_path" ]; then +elif [ -f "$main_module_relative_file_path" ]; then nvr -s --servername $servername $line "$main_module_relative_file_path" fi From ffd617d48fe52542c937a90959f682c82866a792 Mon Sep 17 00:00:00 2001 From: Jaroslaw Konik Date: Thu, 30 May 2024 22:32:05 +0200 Subject: [PATCH 3/5] update --- init.lua | 53 ++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 52 insertions(+), 1 deletion(-) diff --git a/init.lua b/init.lua index 79179eb..a28ef7d 100644 --- a/init.lua +++ b/init.lua @@ -108,7 +108,58 @@ require("lazy").setup({ dependencies = { 'nvim-lua/plenary.nvim' } }, { - "lewis6991/gitsigns.nvim", opts = {} + "lewis6991/gitsigns.nvim", + opts = { + on_attach = function(bufnr) + local gitsigns = require('gitsigns') + + local function map(mode, l, r, opts) + opts = opts or {} + opts.buffer = bufnr + vim.keymap.set(mode, l, r, opts) + end + + -- Navigation + map('n', ']c', function() + if vim.wo.diff then + vim.cmd.normal({ ']c', bang = true }) + else + gitsigns.nav_hunk('next') + end + end) + + map('n', '[c', function() + if vim.wo.diff then + vim.cmd.normal({ '[c', bang = true }) + else + gitsigns.nav_hunk('prev') + end + end) + + -- Actions + map('n', 'hs', gitsigns.stage_hunk) + map('n', 'hr', gitsigns.reset_hunk) + map('v', 'hs', + function() gitsigns.stage_hunk { vim.fn.line('.'), vim.fn.line('v') } end) + map('v', 'hr', + function() gitsigns.reset_hunk { vim.fn.line('.'), vim.fn.line('v') } end) + map('n', 'hS', gitsigns.stage_buffer) + map('n', 'hu', gitsigns.undo_stage_hunk) + map('n', 'hR', gitsigns.reset_buffer) + map('n', 'hp', gitsigns.preview_hunk) + map('n', 'hb', function() gitsigns.blame_line { full = true } end) + map('n', 'tb', gitsigns.toggle_current_line_blame) + map('n', 'hd', gitsigns.diffthis) + map('n', 'hD', function() gitsigns.diffthis('~') end) + map('n', 'td', gitsigns.toggle_deleted) + + -- Text object + map({ 'o', 'x' }, 'ih', ':Gitsigns select_hunk') + end + + + + } }, { "folke/neodev.nvim", From 4e0756806144dc252623180681104c9b614a604c Mon Sep 17 00:00:00 2001 From: Jaroslaw Konik Date: Thu, 30 May 2024 22:35:51 +0200 Subject: [PATCH 4/5] update --- init.lua | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/init.lua b/init.lua index a28ef7d..285fdfc 100644 --- a/init.lua +++ b/init.lua @@ -222,6 +222,25 @@ require("lazy").setup({ opts = {} }, { "cappyzawa/trim.nvim", opts = {} }, + { + "kdheepak/lazygit.nvim", + cmd = { + "LazyGit", + "LazyGitConfig", + "LazyGitCurrentFile", + "LazyGitFilter", + "LazyGitFilterCurrentFile", + }, + -- optional for floating window border decoration + dependencies = { + "nvim-lua/plenary.nvim", + }, + -- setting the keybinding for LazyGit with 'keys' is recommended in + -- order to load the plugin when the command is run for the first time + keys = { + { "lg", "LazyGit", desc = "LazyGit" } + } + } }) require 'nvim-treesitter.configs'.setup({ From 3b7c02f338ea8c57272bfa219ae603c5e313e213 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jaros=C5=82aw=20Konik?= Date: Fri, 31 May 2024 13:37:34 +0200 Subject: [PATCH 5/5] Create README.md --- README.md | 1 + 1 file changed, 1 insertion(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..96bf7ed --- /dev/null +++ b/README.md @@ -0,0 +1 @@ +# dotfiles