nixvim refactor

This commit is contained in:
Hadi 2024-07-01 13:07:12 +00:00
parent 88ae1d29a5
commit 55caf123df
32 changed files with 275 additions and 221 deletions

View File

@ -23,6 +23,15 @@ feel free to contribute <3 ([CONTRIBUTING.md](CONTRIBUTING.md))
- [ ] Nixvim - [ ] Nixvim
- [+] Markdown snippets - [+] Markdown snippets
- [+] Markdown fold - [+] Markdown fold
- [ ] Keymaps:
- Toggle todos
- Format tables
- Trouble
- Telescope find file from filename, find file from content
- Neo Tree, Oil
- Dashboard
- Tagbar
- Line wrapping
- [ ] Backup system for some folders ($home/dev, $home/pictures, ...) - [ ] Backup system for some folders ($home/dev, $home/pictures, ...)
- [ ] Exclude file pattern (nodes modules, ...) - [ ] Exclude file pattern (nodes modules, ...)

View File

@ -41,10 +41,10 @@ echo "" >>"$KEYBINDINGS_FILE"
echo "The list of the keybindings working on Hyprland:" >>"$KEYBINDINGS_FILE" echo "The list of the keybindings working on Hyprland:" >>"$KEYBINDINGS_FILE"
echo "" >>"$KEYBINDINGS_FILE" echo "" >>"$KEYBINDINGS_FILE"
echo "| Description | Keybinding | Command |" >>"$KEYBINDINGS_FILE" echo "| Description | Keybinding |" >>"$KEYBINDINGS_FILE"
echo "| -- | -- | -- |" >>"$KEYBINDINGS_FILE" echo "| -- | -- |" >>"$KEYBINDINGS_FILE"
echo "| Switch Workspace | SUPER + {Number} | workspace {Number} |" >>"$KEYBINDINGS_FILE" echo "| Switch Workspace | SUPER + {Number} |" >>"$KEYBINDINGS_FILE"
echo "| Move app to Workspace | SUPER SHIFT + {Number} | movetoworkspace {Number} |" >>"$KEYBINDINGS_FILE" echo "| Move app to Workspace | SHIFT + SUPER + {Number} |" >>"$KEYBINDINGS_FILE"
echo "$keybindings" | while read line; do echo "$keybindings" | while read line; do
comment=$(echo "$line" | cut -d\# -f2) comment=$(echo "$line" | cut -d\# -f2)
line=$(echo "$line" | cut -d\# -f1) line=$(echo "$line" | cut -d\# -f1)
@ -55,9 +55,9 @@ echo "$keybindings" | while read line; do
params=$(echo "$line" | cut -d, -f4) params=$(echo "$line" | cut -d, -f4)
[[ $mod == '$mod' ]] && mod="SUPER + " [[ $mod == '$mod' ]] && mod="SUPER + "
[[ $mod == '$shiftMod' ]] && mod="SUPER SHIFT + " [[ $mod == '$shiftMod' ]] && mod="SHIFT + SUPER + "
echo "| $comment | $mod$key | $dispatcher $params |" >>"$KEYBINDINGS_FILE" echo "| $comment | $mod$key |" >>"$KEYBINDINGS_FILE"
done done
pandoc -t commonmark_x "$KEYBINDINGS_FILE" -o "/tmp/keybindings.md" pandoc -t commonmark_x "$KEYBINDINGS_FILE" -o "/tmp/keybindings.md"

View File

@ -1,32 +1,15 @@
{ inputs, ... }: { { inputs, ... }: {
imports = [ imports = [
inputs.nixvim.homeManagerModules.nixvim inputs.nixvim.homeManagerModules.nixvim
./plugins/auto-pairs.nix
./plugins/bufferline.nix
./plugins/lazygit.nix
./plugins/telescope.nix
./plugins/nvim-tree.nix
./plugins/lightline.nix
./plugins/git.nix
./plugins/cmp.nix ./plugins/cmp.nix
./plugins/none-ls.nix ./plugins/dashboard.nix
./plugins/wilder.nix
./plugins/lsp.nix ./plugins/lsp.nix
./plugins/treesitter.nix ./plugins/markdown.nix
./plugins/toggleterm.nix ./plugins/tree.nix
./plugins/copilot.nix ./plugins/ui.nix
./plugins/whichkey.nix ./plugins/utils.nix
./plugins/alpha.nix
./plugins/comment.nix
./plugins/oil.nix
./plugins/trouble.nix
./plugins/tmux-navigator.nix
./plugins/noice.nix
./plugins/obsidian.nix
./plugins/image.nix
# ./plugins/ltex.nix
./plugins/flash.nix
./plugins/zen-mode.nix ./plugins/zen-mode.nix
./options.nix ./options.nix
./colorscheme.nix ./colorscheme.nix
./keymaps.nix ./keymaps.nix

View File

@ -1,84 +1,14 @@
{ {
programs.nixvim.keymaps = [ programs.nixvim.keymaps = [
{
key = "<leader>E";
action = "<CMD>Neotree toggle<CR>";
options.desc = "Neotree Toggle";
}
{ {
key = "<space>fm"; key = "<space>fm";
action = "<CMD>lua vim.lsp.buf.format()<CR>"; action = "<cmd>lua vim.lsp.buf.format()<cr>";
options.desc = "LSP Format"; options.desc = "LSP Format";
} }
{ {
key = "<leader>ox"; key = "<space>ft";
action = "vip:!pandoc -t commonmark_x<cr>"; action = "vip:!pandoc -t commonmark_x<cr>";
options.desc = "Format Markdown Tables"; options.desc = "Format markdown table";
}
{
key = "<leader>ot";
action = "<cmd>lua require('obsidian').util.toggle_checkbox()<cr>";
options.desc = "Toggle Checkbox";
}
{
key = "<leader>oo";
action = "<cmd>ObsidianQuickSwitch<cr>";
options.desc = "Quick Switch";
}
{
key = "<leader>on";
action = "<cmd>ObsidianNew<cr>";
options.desc = "New";
}
{
key = "<leader>of";
action = "<cmd>ObsidianSearch<cr>";
options.desc = "Search";
}
{
key = "<leader>oi";
action = "<cmd>ObsidianPasteImg<cr>";
options.desc = "Paste Image";
}
{
key = "<leader>e";
action = "<cmd>Oil<cr>";
options.desc = "Oil";
}
{
key = "<leader>t";
action = "<cmd>TroubleToggle<cr>";
options.desc = "Trouble";
}
{
key = "<C-h>";
action = "<cmd>TmuxNavigateLeft<cr>";
}
{
key = "<C-j>";
action = "<cmd>TmuxNavigateDown<cr>";
}
{
key = "<C-k>";
action = "<cmd>TmuxNavigateUp<cr>";
}
{
key = "<C-l>";
action = "<cmd>TmuxNavigateRight<cr>";
}
# Terminal Mappings
{
mode = "t";
key = "<esc>";
action = "<C-\\><C-n>";
} }
]; ];
} }

View File

@ -1 +0,0 @@
{ programs.nixvim.plugins.nvim-autopairs = { enable = true; }; }

View File

@ -1 +0,0 @@
{ programs.nixvim.plugins.bufferline = { enable = true; }; }

View File

@ -1 +0,0 @@
{ programs.nixvim.plugins.comment = { enable = true; }; }

View File

@ -1,5 +0,0 @@
{
programs.nixvim.plugins.copilot-vim = {
enable = true;
};
}

View File

@ -1 +0,0 @@
{ programs.nixvim.plugins.flash = { enable = true; }; }

View File

@ -1,6 +0,0 @@
{
programs.nixvim.plugins.gitsigns = {
enable = true;
settings = { current_line_blame = false; };
};
}

View File

@ -1 +0,0 @@
{ programs.nixvim.plugins.image = { enable = true; }; }

View File

@ -1 +0,0 @@
{ programs.nixvim.plugins.lazygit = { enable = true; }; }

View File

@ -1 +0,0 @@
{ programs.nixvim.plugins.lualine = { enable = true; }; }

View File

@ -28,5 +28,23 @@
"K" = "hover"; "K" = "hover";
}; };
}; };
none-ls = {
enable = true;
sources = {
diagnostics = {
golangci_lint.enable = true;
statix.enable = true;
};
formatting = {
gofmt.enable = true;
goimports.enable = true;
nixfmt.enable = true;
markdownlint.enable = true;
tidy.enable = true;
shellharden.enable = true;
shfmt.enable = true;
};
};
};
}; };
} }

View File

@ -1,10 +0,0 @@
{
programs.nixvim.plugins.ltex-extra = {
enable = true;
settings = {
initCheck = true;
loadLangs = [ "en-US" "fr-FR" ];
logLevel = "non";
};
};
}

View File

@ -0,0 +1,134 @@
{
programs.nixvim.plugins = {
mkdnflow = {
enable = true;
mappings = {
MkdnCreateLink = false;
MkdnCreateLinkFromClipboard = {
key = "<leader>p";
modes = [
"n"
"v"
];
};
MkdnDecreaseHeading = {
key = "-";
modes = "n";
};
MkdnDestroyLink = {
key = "<M-CR>";
modes = "n";
};
MkdnEnter = {
key = "<CR>";
modes = [
"n"
"v"
"i"
];
};
MkdnExtendList = false;
MkdnFoldSection = {
key = "<leader>f";
modes = "n";
};
MkdnFollowLink = false;
MkdnGoBack = {
key = "<BS>";
modes = "n";
};
MkdnGoForward = {
key = "<Del>";
modes = "n";
};
MkdnIncreaseHeading = {
key = "+";
modes = "n";
};
MkdnMoveSource = {
key = "<F2>";
modes = "n";
};
MkdnNewListItem = false;
MkdnNewListItemAboveInsert = {
key = "O";
modes = "n";
};
MkdnNewListItemBelowInsert = {
key = "o";
modes = "n";
};
MkdnNextHeading = {
key = "]]";
modes = "n";
};
MkdnNextLink = {
key = "<Tab>";
modes = "n";
};
MkdnPrevHeading = {
key = "[[";
modes = "n";
};
MkdnPrevLink = {
key = "<S-Tab>";
modes = "n";
};
MkdnSTab = false;
MkdnTab = false;
MkdnTableNewColAfter = {
key = "<leader>ic";
modes = "n";
};
MkdnTableNewColBefore = {
key = "<leader>iC";
modes = "n";
};
MkdnTableNewRowAbove = {
key = "<leader>iR";
modes = "n";
};
MkdnTableNewRowBelow = {
key = "<leader>ir";
modes = "n";
};
MkdnTableNextCell = {
key = "<Tab>";
modes = "i";
};
MkdnTableNextRow = false;
MkdnTablePrevCell = {
key = "<S-Tab>";
modes = "i";
};
MkdnTablePrevRow = {
key = "<M-CR>";
modes = "i";
};
MkdnToggleToDo = {
key = "<C-Space>";
modes = [
"n"
"v"
];
};
MkdnUnfoldSection = {
key = "<leader>F";
modes = "n";
};
MkdnUpdateNumbering = {
key = "<leader>nn";
modes = "n";
};
MkdnYankAnchorLink = {
key = "ya";
modes = "n";
};
MkdnYankFileAnchorLink = {
key = "yfa";
modes = "n";
};
};
};
};
}

View File

@ -1 +0,0 @@
{ programs.nixvim.plugins.noice = { enable = true; }; }

View File

@ -1,20 +0,0 @@
{
programs.nixvim.plugins.none-ls = {
enable = true;
sources = {
diagnostics = {
golangci_lint.enable = true;
statix.enable = true;
};
formatting = {
gofmt.enable = true;
goimports.enable = true;
nixfmt.enable = true;
markdownlint.enable = true;
tidy.enable = true;
shellharden.enable = true;
shfmt.enable = true;
};
};
};
}

View File

@ -1,5 +0,0 @@
{
programs.nixvim.plugins.neo-tree = {
enable = true;
};
}

View File

@ -1,16 +0,0 @@
{ config, ... }: {
programs.nixvim.plugins.obsidian = {
enable = config.var.obsidian;
settings = {
completion = {
min_chars = 2;
nvim_cmp = true;
};
disable_frontmatter = true;
workspaces = [{
name = "note";
path = "~/nextcloud/Notes";
}];
};
};
}

View File

@ -1,6 +0,0 @@
{
programs.nixvim.plugins.oil = {
enable = true;
settings = { default_file_explorer = false; };
};
}

View File

@ -1,13 +0,0 @@
{
programs.nixvim.plugins.telescope = {
enable = true;
keymaps = {
"<leader>fg" = "live_grep";
#"<C-p>" = {
# action = "git_files";
# desc = "Telescope Git Files";
#};
};
extensions.fzf-native = { enable = true; };
};
}

View File

@ -1 +0,0 @@
{ programs.nixvim.plugins.tmux-navigator = { enable = true; }; }

View File

@ -1,9 +0,0 @@
{
programs.nixvim.plugins.toggleterm = {
enable = true;
settings = {
open_mapping = "[[<c-t>]]";
direction = "horizontal";
};
};
}

View File

@ -0,0 +1,31 @@
{
programs.nixvim = {
plugins = {
neo-tree.enable = true;
oil = {
enable = true;
settings = {
default_file_explorer = false;
skip_confirm_for_simple_edits = true;
};
};
};
keymaps = [
{
key = "-";
action = "<cmd>Oil<cr>";
options.desc = "Oil";
}
{
key = "<leader>e";
action = "<cmd>Oil --float<cr>";
options.desc = "Oil";
}
{
key = "<leader>E";
action = "<cmd>Neotree toggle<cr>";
options.desc = "Neotree";
}
];
};
}

View File

@ -1,10 +0,0 @@
{
programs.nixvim.plugins = {
treesitter = {
enable = true;
nixGrammars = true;
indent = true;
};
treesitter-context.enable = true;
};
}

View File

@ -1 +0,0 @@
{ programs.nixvim.plugins.trouble = { enable = true; }; }

View File

@ -0,0 +1,24 @@
{
programs.nixvim= {
plugins = {
lualine.enable = true;
noice.enable = true;
gitsigns = {
enable = true;
settings.current_line_blame = false;
};
bufferline.enable = true;
trouble.enable = true;
which-key.enable=true;
headlines.enable=true;
tagbar.enable =true;
};
keymaps = [
{
key = "<leader>t";
action = "<cmd>TroubleToggle<cr>";
options.desc = "Trouble";
}
];
};
}

View File

@ -0,0 +1,44 @@
{
programs.nixvim = {
plugins = {
copilot-vim.enable = true;
flash.enable = true;
image.enable = true;
tmux-navigator.enable = true;
comment.enable = true;
nvim-autopairs.enable = true;
friendly-snippets.enable = true;
telescope = {
enable = true;
keymaps = {
"<leader>fg" = "live_grep";
};
extensions.fzf-native = { enable = true; };
};
treesitter = {
enable = true;
nixGrammars = true;
indent = true;
};
treesitter-context.enable = true;
};
keymaps = [
{
key = "<C-h>";
action = "<cmd>TmuxNavigateLeft<cr>";
}
{
key = "<C-j>";
action = "<cmd>TmuxNavigateDown<cr>";
}
{
key = "<C-k>";
action = "<cmd>TmuxNavigateUp<cr>";
}
{
key = "<C-l>";
action = "<cmd>TmuxNavigateRight<cr>";
}
];
};
}

View File

@ -1,3 +0,0 @@
{
programs.nixvim.plugins.which-key.enable=true;
}

View File

@ -1,6 +0,0 @@
{
programs.nixvim.plugins.wilder = {
enable = true;
modes = [ ":" "/" "?" ];
};
}