Initial commit
This commit is contained in:
commit
d75b5a0be6
8 changed files with 567 additions and 0 deletions
78
config/default.nix
Normal file
78
config/default.nix
Normal file
|
@ -0,0 +1,78 @@
|
|||
{
|
||||
# Import all your configuration modules here
|
||||
# imports = [./bufferline.nix];
|
||||
imports = [
|
||||
./plugins/gitsigns.nix
|
||||
./plugins/lsp.nix
|
||||
./plugins/rhubarb.nix
|
||||
];
|
||||
|
||||
colorschemes.base16 = {
|
||||
enable = true;
|
||||
colorscheme = "darktooth";
|
||||
};
|
||||
|
||||
opts = {
|
||||
expandtab = true;
|
||||
number = true;
|
||||
relativenumber = true;
|
||||
autoindent = true;
|
||||
termguicolors = true;
|
||||
tabstop = 4;
|
||||
shiftwidth = 4;
|
||||
mouse = "a";
|
||||
};
|
||||
|
||||
globals = {
|
||||
mapleader = "`";
|
||||
};
|
||||
|
||||
keymaps = [
|
||||
{
|
||||
action = "<cmd>Telescope find_files<CR>";
|
||||
key = "<leader>f";
|
||||
}
|
||||
{
|
||||
action = "<cmd>Telescope live_grep<CR>";
|
||||
key = "<leader>g";
|
||||
}
|
||||
{
|
||||
action = "<cmd>:TransparentToggle<CR>";
|
||||
key = "<leader>t";
|
||||
}
|
||||
];
|
||||
|
||||
autoCmd = [
|
||||
{
|
||||
event = ["BufEnter"];
|
||||
pattern = ["*"];
|
||||
command = "setlocal cursorline";
|
||||
}
|
||||
{
|
||||
event = ["BufLeave"];
|
||||
pattern = ["*"];
|
||||
command = "setlocal nocursorline";
|
||||
}
|
||||
];
|
||||
|
||||
plugins = {
|
||||
lualine.enable = true;
|
||||
telescope.enable = true;
|
||||
treesitter.enable = true;
|
||||
tmux-navigator.enable = true;
|
||||
fugitive.enable = true;
|
||||
|
||||
/*
|
||||
:TransparentEnable
|
||||
:TransparentDisable
|
||||
:TransparentToggle
|
||||
*/
|
||||
transparent = {
|
||||
enable = true;
|
||||
settings.exclude_groups = [
|
||||
"CursorLine"
|
||||
"CursorLineNr"
|
||||
];
|
||||
};
|
||||
};
|
||||
}
|
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