Initial commit
This commit is contained in:
commit
d75b5a0be6
8 changed files with 567 additions and 0 deletions
55
config/plugins/gitsigns.nix
Normal file
55
config/plugins/gitsigns.nix
Normal file
|
@ -0,0 +1,55 @@
|
|||
{
|
||||
plugins.gitsigns = {
|
||||
enable = true;
|
||||
};
|
||||
|
||||
# This is the recommended config from the repo
|
||||
extraConfigLua = ''
|
||||
require('gitsigns').setup{
|
||||
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
|
||||
}
|
||||
'';
|
||||
}
|
25
config/plugins/lsp.nix
Normal file
25
config/plugins/lsp.nix
Normal file
|
@ -0,0 +1,25 @@
|
|||
{
|
||||
plugins.lsp = {
|
||||
enable = true;
|
||||
servers = {
|
||||
# python
|
||||
ruff.enable = true;
|
||||
|
||||
# lua (nvim config)
|
||||
lua-ls.enable = true;
|
||||
|
||||
# rust
|
||||
rust-analyzer = {
|
||||
enable = true;
|
||||
installCargo = true;
|
||||
installRustc = true;
|
||||
};
|
||||
|
||||
# ocaml
|
||||
ocamllsp.enable = true;
|
||||
|
||||
# nix
|
||||
nixd.enable = true;
|
||||
};
|
||||
};
|
||||
}
|
10
config/plugins/rhubarb.nix
Normal file
10
config/plugins/rhubarb.nix
Normal file
|
@ -0,0 +1,10 @@
|
|||
{pkgs, ...}: {
|
||||
extraPlugins = with pkgs.vimPlugins; [rhubarb];
|
||||
|
||||
keymaps = [
|
||||
{
|
||||
action = "<cmd>GBrowse<CR>";
|
||||
key = "<leader>bro";
|
||||
}
|
||||
];
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue