Merge remote-tracking branch 'refs/remotes/origin/main'
This commit is contained in:
commit
0a982c0e94
4 changed files with 89 additions and 9 deletions
11
.zshrc
11
.zshrc
|
|
@ -1,7 +1,12 @@
|
|||
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 "$@"
|
||||
|
|
|
|||
1
README.md
Normal file
1
README.md
Normal file
|
|
@ -0,0 +1 @@
|
|||
# dotfiles
|
||||
72
init.lua
72
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', '<leader>hs', gitsigns.stage_hunk)
|
||||
map('n', '<leader>hr', gitsigns.reset_hunk)
|
||||
map('v', '<leader>hs',
|
||||
function() gitsigns.stage_hunk { vim.fn.line('.'), vim.fn.line('v') } end)
|
||||
map('v', '<leader>hr',
|
||||
function() gitsigns.reset_hunk { vim.fn.line('.'), vim.fn.line('v') } end)
|
||||
map('n', '<leader>hS', gitsigns.stage_buffer)
|
||||
map('n', '<leader>hu', gitsigns.undo_stage_hunk)
|
||||
map('n', '<leader>hR', gitsigns.reset_buffer)
|
||||
map('n', '<leader>hp', gitsigns.preview_hunk)
|
||||
map('n', '<leader>hb', function() gitsigns.blame_line { full = true } end)
|
||||
map('n', '<leader>tb', gitsigns.toggle_current_line_blame)
|
||||
map('n', '<leader>hd', gitsigns.diffthis)
|
||||
map('n', '<leader>hD', function() gitsigns.diffthis('~') end)
|
||||
map('n', '<leader>td', gitsigns.toggle_deleted)
|
||||
|
||||
-- Text object
|
||||
map({ 'o', 'x' }, 'ih', ':<C-U>Gitsigns select_hunk<CR>')
|
||||
end
|
||||
|
||||
|
||||
|
||||
}
|
||||
},
|
||||
{
|
||||
"folke/neodev.nvim",
|
||||
|
|
@ -171,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 = {
|
||||
{ "<leader>lg", "<cmd>LazyGit<cr>", desc = "LazyGit" }
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
require 'nvim-treesitter.configs'.setup({
|
||||
|
|
|
|||
14
nvim_remote
14
nvim_remote
|
|
@ -4,17 +4,21 @@ 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"
|
||||
elif [ -n "$repo_relative_file_path" ]; then
|
||||
if [ -f "$relative_file_path" ]; then
|
||||
nvr -s --servername $servername $line "$relative_file_path"
|
||||
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
|
||||
|
|
|
|||
Loading…
Reference in a new issue