Skip to content

Commit

Permalink
Merge pull request #4 from richban/rb/update-flake
Browse files Browse the repository at this point in the history
Update system
  • Loading branch information
richban authored Dec 24, 2023
2 parents 2ad825e + 715ea3d commit 6f3438d
Show file tree
Hide file tree
Showing 14 changed files with 318 additions and 369 deletions.
2 changes: 1 addition & 1 deletion .envrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
use flake
use flake . --impure
17 changes: 17 additions & 0 deletions dotfiles/config/nvim/lua/rb/autocmd.lua
Original file line number Diff line number Diff line change
Expand Up @@ -82,3 +82,20 @@ vim.api.nvim_create_autocmd("FileType", {
vim.keymap.set("n", "q", "<cmd>close<cr>", { buffer = event.buf, silent = true })
end,
})

local group = vim.api.nvim_create_augroup("MyCustomNeogitEvents", { clear = true })
vim.api.nvim_create_autocmd("User", {
pattern = "NeogitPushComplete",
group = group,
callback = function()
require("neogit").close()
end,
})

vim.api.nvim_create_autocmd("User", {
pattern = "BufWritePost,BufEnter,FocusGained,ShellCmdPost,VimResume",
group = augroup("DefaultRefreshEvents"),
callback = function()
require("neogit").refresh_manually()
end,
})
73 changes: 56 additions & 17 deletions dotfiles/config/nvim/lua/rb/gitsigns.lua
Original file line number Diff line number Diff line change
Expand Up @@ -10,23 +10,6 @@ require("gitsigns").setup({
numhl = false, -- Toggle with `:Gitsigns toggle_numhl`
linehl = false, -- Toggle with `:Gitsigns toggle_linehl`
word_diff = false, -- Toggle with `:Gitsigns toggle_word_diff`
keymaps = {
-- Default keymap options
noremap = true,
buffer = true,

["n ]h"] = { expr = true, "&diff ? ']c' : '<cmd>lua require\"gitsigns\".next_hunk()<CR>'" },
["n [h"] = { expr = true, "&diff ? '[c' : '<cmd>lua require\"gitsigns\".prev_hunk()<CR>'" },

["n <leader>hs"] = '<cmd>lua require"gitsigns".stage_hunk()<CR>',
["n <leader>hu"] = '<cmd>lua require"gitsigns".undo_stage_hunk()<CR>',
["n <leader>hr"] = '<cmd>lua require"gitsigns".reset_hunk()<CR>',
["n <leader>hp"] = '<cmd>lua require"gitsigns".preview_hunk()<CR>',

["n <leader>hb"] = '<cmd>lua require"gitsigns".blame_line()<CR>',
["n <leader>hS"] = '<cmd>lua require"gitsigns".stage_buffer()<CR>',
},

watch_gitdir = { interval = 1000, follow_files = true },

attach_to_untracked = true,
Expand All @@ -52,4 +35,60 @@ require("gitsigns").setup({
col = 1,
},
yadm = { enable = false },
on_attach = function(bufnr)
local gs = package.loaded.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", "]h", function()
if vim.wo.diff then
return "]h"
end
vim.schedule(function()
gs.next_hunk()
end)
return "<Ignore>"
end, { expr = true })

map("n", "[h", function()
if vim.wo.diff then
return "[h"
end
vim.schedule(function()
gs.prev_hunk()
end)
return "<Ignore>"
end, { expr = true })

-- Actions
map("n", "<leader>hs", gs.stage_hunk)
map("n", "<leader>hr", gs.reset_hunk)
map("v", "<leader>hs", function()
gs.stage_hunk({ vim.fn.line("."), vim.fn.line("v") })
end)
map("v", "<leader>hr", function()
gs.reset_hunk({ vim.fn.line("."), vim.fn.line("v") })
end)
map("n", "<leader>hS", gs.stage_buffer)
map("n", "<leader>hu", gs.undo_stage_hunk)
map("n", "<leader>hR", gs.reset_buffer)
map("n", "<leader>hp", gs.preview_hunk)
map("n", "<leader>hb", function()
gs.blame_line({ full = true })
end)
map("n", "<leader>tb", gs.toggle_current_line_blame)
map("n", "<leader>hd", gs.diffthis)
map("n", "<leader>hD", function()
gs.diffthis("~")
end)
map("n", "<leader>td", gs.toggle_deleted)

-- Text object
map({ "o", "x" }, "ih", ":<C-U>Gitsigns select_hunk<CR>")
end,
})
4 changes: 2 additions & 2 deletions dotfiles/config/nvim/lua/rb/lsp/settings.lua
Original file line number Diff line number Diff line change
Expand Up @@ -90,10 +90,10 @@ local function custom_attach(client, bufnr)
-- to view the hiding contents
max_width = 120, -- max_width of signature floating_window, line will be wrapped if exceed max_width
handler_opts = {
border = "single", -- double, single, shadow, none
border = "rounded", -- double, single, shadow, none
},
extra_trigger_chars = {}, -- Array of extra characters that will trigger signature completion, e.g., {"(", ","}
})
}, bufnr)

vim.bo.omnifunc = "v:lua.vim.lsp.omnifunc"

Expand Down
5 changes: 4 additions & 1 deletion dotfiles/config/nvim/lua/rb/nvim-cmp.lua
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ lspkind.init({
EnumMember = "",
Constant = "",
Struct = "",
Copilot = "",
},
})

Expand Down Expand Up @@ -96,11 +97,13 @@ cmp.setup({
}),
},
sources = {
-- Copilot Source
{ name = "copilot", group_index = 2 },
-- order of the sources sets priority in the completion menu
{ name = "nvim_lsp_signature_help" },
{ name = "nvim_lsp" },
{ name = "vsnip" },
{ name = "codeium", group_index = 1 },
-- { name = "codeium", group_index = 1 },
{ name = "treesitter" },
{ name = "path" },
{ name = "buffer" },
Expand Down
Loading

0 comments on commit 6f3438d

Please sign in to comment.