feat:neovim updtes

This commit is contained in:
2024-10-11 11:32:17 -04:00
parent 114f618815
commit c01bc77f3b
4 changed files with 187 additions and 102 deletions

View File

@@ -1,4 +1,4 @@
{ config, pkgs, inputs, ... }:
{ config, pkgs, inputs, lib, ... }:
{
imports = [
inputs.nixvim.homeManagerModules.nixvim
@@ -22,7 +22,7 @@
lsp = {
enable = true;
servers = {
tsserver.enable = true; # TS/JS
ts-ls.enable = true; # TS/JS
biome.enable = true; # TS/JS
pyright.enable = true; # Python
@@ -112,7 +112,37 @@
};
};
treesitter-context.enable = true;
treesitter-textobjects.enable = true;
treesitter-textobjects = {
enable = true;
move = {
enable = true;
gotoNextStart = {
"]m" = { query = "@function.outer"; };
"]]" = { query = "@class.outer"; desc = "Next class start"; };
"]o" = { query = "@loop.*"; };
"]s" = { query = "@scope"; queryGroup = "locals"; desc = "Next scope"; };
"]z" = { query = "@fold"; queryGroup = "folds"; desc = "Next fold"; };
};
gotoNextEnd = {
"]M" = { query = "@function.outer"; };
"][" = { query = "@class.outer"; };
};
gotoPreviousStart = {
"[m" = { query = "@function.outer"; };
"[[" = { query = "@class.outer"; };
};
gotoPreviousEnd = {
"[M" = { query = "@function.outer"; };
"[]" = { query = "@class.outer"; };
};
gotoNext = {
"]d" = { query = "@conditional.outer"; };
};
gotoPrevious = {
"[d" = { query = "@conditional.outer"; };
};
};
};
ts-autotag.enable = true;
which-key.enable = true;
@@ -134,6 +164,7 @@
enable = true;
enableTelescope = true;
};
web-devicons.enable = true;
};
opts = {
@@ -154,6 +185,8 @@
smarttab = true;
scrolloff = 5;
termguicolors = true;
foldmethod = lib.mkForce "expr";
foldexpr = lib.mkForce "v:lua.vim.treesitter.foldexpr()";
};
globals = {
mapleader = " ";
@@ -178,6 +211,7 @@
{ action.__raw = "function() require('flash').treesitter() end"; key = "S"; mode = [ "n" "x" "o" ]; options.desc = "Flash Treesitter"; }
{ action.__raw = "function() require('flash').remote() end"; key = "r"; mode = [ "o" ]; options.desc = "Remote Flash"; }
{ action.__raw = "function() require('flash').treesitter_search() end"; key = "R"; mode = [ "o" ]; options.desc = "Treesitter Search"; }
{ action.__raw = "function() require('flash').toggle() end"; key = "<c-s>"; mode = [ "c" ]; options.desc = "Toggle Flash"; }
];
};
}

View File

@@ -6,60 +6,60 @@ local font = wezterm.font({family = "Comic Mono"})
config.front_end = "WebGpu"
config.color_scheme = "Gruvbox Dark (Gogh)"
config.font = font
config.font_size = 13
config.window_decorations = "RESIZE"
config.window_frame = {
font = font,
font_size = 14,
font = font,
font_size = 14,
}
config.hide_tab_bar_if_only_one_tab = true
config.tab_bar_at_bottom = false
wezterm.on('update-status', function(window)
local SOLID_LEFT_ARROW = utf8.char(0xe0b2)
local color_scheme = window:effective_config().resolved_palette
local bg = color_scheme.background
local fg = color_scheme.foreground
-- set theme based on system appearance
function get_appearance()
if wezterm.gui then
return wezterm.gui.get_appearance()
end
return 'Dark'
end
window:set_right_status(wezterm.format({
{ Background = { Color = 'none' }},
{ Foreground = { Color = bg }},
{ Text = SOLID_LEFT_ARROW },
function scheme_for_appearance(appearance)
if appearance:find 'Dark' then
return 'Gruvbox Dark (Gogh)'
else
return 'Gruvbox (Gogh)'
end
end
{ Background = { Color = bg }},
{ Foreground = { Color = fg }},
{ Text = ' ' .. wezterm.hostname() .. ' ' },
}))
end)
config.color_scheme = scheme_for_appearance(get_appearance())
config.leader = { key = 'a', mods = 'CTRL', timeout_milliseconds = 1000 }
function nav_pane(key, dir)
return {
key = key,
mods = "LEADER",
action = wezterm.action.ActivatePaneDirection(dir),
}
return {
key = key,
mods = "LEADER",
action = wezterm.action.ActivatePaneDirection(dir),
}
end
config.keys = {
{
key = "\\",
mods = "LEADER",
action = wezterm.action.SplitHorizontal { domain = 'CurrentPaneDomain' }
},
{
key = "-",
mods = "LEADER",
action = wezterm.action.SplitVertical { domain = 'CurrentPaneDomain' }
},
nav_pane("h", "Left"),
nav_pane("j", "Down"),
nav_pane("k", "Up"),
nav_pane("l", "Right"),
{
key = "\\",
mods = "LEADER",
action = wezterm.action.SplitHorizontal { domain = 'CurrentPaneDomain' }
},
{
key = "-",
mods = "LEADER",
action = wezterm.action.SplitVertical { domain = 'CurrentPaneDomain' }
},
nav_pane("h", "Left"),
nav_pane("j", "Down"),
nav_pane("k", "Up"),
nav_pane("l", "Right"),
}
local function get_current_working_dir(tab)
@@ -70,34 +70,34 @@ local function get_current_working_dir(tab)
or string.gsub(current_dir.file_path, '(.*[/\\])(.*)', '%2')
end
wezterm.on('format-tab-title', function(tab, tabs, panes, config, hover, max_width)
local has_unseen_output = false
if not tab.is_active then
for _, pane in ipairs(tab.panes) do
if pane.has_unseen_output then
has_unseen_output = true
break
end
end
end
local cwd = wezterm.format({
{ Text = get_current_working_dir(tab) },
})
local process = get_process(tab)
local title = process and string.format(' %s (%s) ', process, cwd) or ' [?] '
if has_unseen_output then
return {
{ Foreground = { Color = '#28719c' } },
{ Text = title },
}
end
return {
{ Text = title },
}
end)
-- wezterm.on('format-tab-title', function(tab, tabs, panes, config, hover, max_width)
-- local has_unseen_output = false
-- if not tab.is_active then
-- for _, pane in ipairs(tab.panes) do
-- if pane.has_unseen_output then
-- has_unseen_output = true
-- break
-- end
-- end
-- end
--
-- local cwd = wezterm.format({
-- { Text = get_current_working_dir(tab) },
-- })
--
-- local process = get_process(tab)
-- local title = process and string.format(' %s (%s) ', process, cwd) or ' [?] '
--
-- if has_unseen_output then
-- return {
-- { Foreground = { Color = '#28719c' } },
-- { Text = title },
-- }
-- end
--
-- return {
-- { Text = title },
-- }
-- end)
return config