clean up and improve docs

This commit is contained in:
Noah Masur
2023-07-30 20:26:23 -04:00
parent ef2ee7b871
commit 3d6f57c324
18 changed files with 102 additions and 65 deletions

View File

@ -10,6 +10,7 @@
pkgs.vimPlugins.which-key-nvim # Keybind helper
];
# Initialize some plugins
setup.Comment = { };
setup.colorizer = { };
setup.glow = { };

View File

@ -1,5 +1,7 @@
{ pkgs, dsl, ... }: {
# Telescope is a fuzzy finder that can work with different sub-plugins
plugins = [
pkgs.vimPlugins.telescope-nvim
pkgs.vimPlugins.project-nvim

View File

@ -12,6 +12,8 @@ vim.api.nvim_create_autocmd("TermOpen", {
end,
})
-- These are all the different types of terminals we can trigger
local terminal = require("toggleterm.terminal").Terminal
local basicterminal = terminal:new()

View File

@ -1,5 +1,7 @@
{ pkgs, dsl, ... }: {
# Toggleterm provides a floating terminal inside the editor for quick access
plugins = [ pkgs.vimPlugins.toggleterm-nvim ];
use.toggleterm.setup = dsl.callWith {

View File

@ -1,5 +1,7 @@
{ pkgs, dsl, ... }: {
# This plugin creates a side drawer for navigating the current project
plugins = [ pkgs.vimPlugins.nvim-tree-lua pkgs.vimPlugins.nvim-web-devicons ];
# Disable netrw eagerly
@ -10,16 +12,16 @@
};
setup.nvim-tree = {
disable_netrw = true;
hijack_netrw = true;
sync_root_with_cwd = true;
respect_buf_cwd = true;
update_focused_file = {
disable_netrw = true; # Disable the built-in file manager
hijack_netrw = true; # Works as the file manager
sync_root_with_cwd = true; # Change project whenever currend dir changes
respect_buf_cwd = true; # Change to exact location of focused buffer
update_focused_file = { # Change project based on the focused buffer
enable = true;
update_root = true;
ignore_list = { };
};
diagnostics = {
diagnostics = { # Enable LSP and linter integration
enable = true;
icons = {
hint = "";
@ -28,7 +30,7 @@
error = "";
};
};
renderer = {
renderer = { # Show files with changes vs. current commit
icons = {
glyphs = {
git = {
@ -43,6 +45,7 @@
};
};
};
# Set keybinds and initialize program
on_attach = dsl.rawLua ''
function (bufnr)
local api = require('nvim-tree.api')
@ -58,7 +61,7 @@
vim.keymap.set('n', 'v', api.node.open.vertical, opts('Open: Vertical Split'))
end
'';
view = {
view = { # Set look and feel
width = 30;
hide_root_folder = false;
side = "left";
@ -67,6 +70,7 @@
};
};
# Toggle the sidebar
lua = ''
vim.keymap.set("n", "<Leader>e", ":NvimTreeFindFileToggle<CR>", { silent = true })
'';

View File

@ -18,11 +18,16 @@ in {
home.packages = [ neovim ];
# Use Neovim as the editor for git commit messages
programs.git.extraConfig.core.editor = "nvim";
# Set Neovim as the default app for text editing and manual pages
home.sessionVariables = {
EDITOR = "nvim";
MANPAGER = "nvim +Man!";
};
# Create quick aliases for launching Neovim
programs.fish = {
shellAliases = { vim = "nvim"; };
shellAbbrs = {
@ -31,12 +36,20 @@ in {
vll = "nvim -c 'Telescope oldfiles'";
};
};
# Set Neovim as the kitty terminal "scrollback" (vi mode) option.
# Requires removing some of the ANSI escape codes that are sent to the
# scrollback using sed and baleia, as well as removing several
# unnecessary features.
programs.kitty.settings.scrollback_pager = ''
$SHELL -c 'sed -r "s/[[:cntrl:]]\]133;[AC]..//g" | ${neovim}/bin/nvim -c "setlocal nonumber norelativenumber nolist laststatus=0" -c "lua baleia = require(\"baleia\").setup({}); baleia.once(0)" -c "map <silent> q :qa!<CR>" -c "autocmd VimEnter * normal G"' '';
# Create a desktop option for launching Neovim from a file manager
# (Requires launching the terminal and then executing Neovim)
xdg.desktopEntries.nvim = lib.mkIf pkgs.stdenv.isLinux {
name = "Neovim wrapper";
exec = "kitty nvim %F";
mimeType = [ "text/plain" "text/markdown" ];
};
xdg.mimeApps.defaultApplications = lib.mkIf pkgs.stdenv.isLinux {
"text/plain" = [ "nvim.desktop" ];
@ -45,9 +58,6 @@ in {
};
# # Used for icons in Vim
# fonts.fonts = with pkgs; [ nerdfonts ];
};
}