updates to code completion, gen-ai functionality, and nvim-tree
This commit is contained in:
parent
0c6dab5310
commit
a68c97c516
6 changed files with 215 additions and 161 deletions
|
@ -1,7 +1,25 @@
|
||||||
{ ... }:
|
{ ... }:
|
||||||
{
|
{
|
||||||
programs.nixvim = {
|
programs.nixvim = {
|
||||||
plugins.cmp = {
|
plugins = {
|
||||||
|
cmp-cmdline.enable = true;
|
||||||
|
cmp-git.enable = true;
|
||||||
|
cmp-npm.enable = true;
|
||||||
|
cmp-path.enable = true;
|
||||||
|
cmp-rg.enable = true;
|
||||||
|
cmp-tmux.enable = true;
|
||||||
|
cmp-treesitter.enable = true;
|
||||||
|
cmp-zsh.enable = true;
|
||||||
|
cmp_yanky.enable = true;
|
||||||
|
copilot-cmp = {
|
||||||
|
enable = true;
|
||||||
|
settings = {
|
||||||
|
event = ["InsertEnter" "LspAttach"]; # When to trigger Copilot
|
||||||
|
fix_pairs = true; # Fix parentheses/brackets completion
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
cmp = {
|
||||||
enable = true;
|
enable = true;
|
||||||
autoEnableSources = true;
|
autoEnableSources = true;
|
||||||
settings = {
|
settings = {
|
||||||
|
@ -24,7 +42,7 @@
|
||||||
option.get_bufnrs.__raw = "vim.api.nvim_list_bufs";
|
option.get_bufnrs.__raw = "vim.api.nvim_list_bufs";
|
||||||
keywordLength = 3;
|
keywordLength = 3;
|
||||||
}
|
}
|
||||||
# { name = "copilot"; } # enable/disable copilot
|
{ name = "copilot"; }
|
||||||
{
|
{
|
||||||
name = "path"; # file system paths
|
name = "path"; # file system paths
|
||||||
keywordLength = 3;
|
keywordLength = 3;
|
||||||
|
@ -154,4 +172,5 @@
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,20 @@
|
||||||
{ pkgs, ... }:
|
{ pkgs, ... }:
|
||||||
{
|
{
|
||||||
programs.nixvim.plugins = {
|
programs.nixvim = {
|
||||||
codecompanion = {
|
keymaps = [
|
||||||
|
{
|
||||||
|
mode = [ "n" ];
|
||||||
|
key = "<c-c>";
|
||||||
|
action = ":CodeCompanionActions<CR>";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
mode = [ "n" ];
|
||||||
|
key = ",c";
|
||||||
|
action = ":CodeCompanionChat Toggle<CR>";
|
||||||
|
}
|
||||||
|
];
|
||||||
|
|
||||||
|
plugins.codecompanion = {
|
||||||
enable = true;
|
enable = true;
|
||||||
|
|
||||||
settings = {
|
settings = {
|
||||||
|
|
|
@ -26,13 +26,7 @@
|
||||||
gitsigns.enable = true;
|
gitsigns.enable = true;
|
||||||
indent-blankline.enable = true;
|
indent-blankline.enable = true;
|
||||||
lightline.enable = false;
|
lightline.enable = false;
|
||||||
lsp-signature.enable = true;
|
# lsp-signature.enable = true;
|
||||||
# config = ''
|
|
||||||
# lua << EOF
|
|
||||||
# require("lsp_signature").setup()
|
|
||||||
# EOF
|
|
||||||
# '';
|
|
||||||
|
|
||||||
lualine.enable = true;
|
lualine.enable = true;
|
||||||
nix.enable = true;
|
nix.enable = true;
|
||||||
noice.enable = true;
|
noice.enable = true;
|
||||||
|
@ -58,6 +52,7 @@
|
||||||
# EOF
|
# EOF
|
||||||
# '';
|
# '';
|
||||||
|
|
||||||
|
oil.enable = true;
|
||||||
rainbow-delimiters.enable = true;
|
rainbow-delimiters.enable = true;
|
||||||
sleuth.enable = true;
|
sleuth.enable = true;
|
||||||
treesitter.enable = false;
|
treesitter.enable = false;
|
||||||
|
@ -67,5 +62,6 @@
|
||||||
# ## Only on unstable at the moment
|
# ## Only on unstable at the moment
|
||||||
web-devicons.enable = true;
|
web-devicons.enable = true;
|
||||||
which-key.enable = true;
|
which-key.enable = true;
|
||||||
|
yanky.enable = true;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,15 @@
|
||||||
{ ... }:
|
{ ... }:
|
||||||
{
|
{
|
||||||
programs.nixvim = {
|
programs.nixvim = {
|
||||||
|
# keymaps = [
|
||||||
|
# {
|
||||||
|
# mode = "i";
|
||||||
|
# key = "<c-c>";
|
||||||
|
# action.__raw = ''function() require("luasnip.extras.select_choice")() end'';
|
||||||
|
# options.desc = "Search";
|
||||||
|
# }
|
||||||
|
# ];
|
||||||
|
|
||||||
plugins.luasnip = {
|
plugins.luasnip = {
|
||||||
enable = true;
|
enable = true;
|
||||||
|
|
||||||
|
@ -28,14 +37,5 @@
|
||||||
# '';
|
# '';
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
# keymaps = [
|
|
||||||
# {
|
|
||||||
# mode = "i";
|
|
||||||
# key = "<c-c>";
|
|
||||||
# action.__raw = ''function() require("luasnip.extras.select_choice")() end'';
|
|
||||||
# options.desc = "Search";
|
|
||||||
# }
|
|
||||||
# ];
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,6 +8,19 @@
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
extraConfigLua = ''
|
||||||
|
function _G.launch_find_files_wrapped()
|
||||||
|
-- Try custom function first
|
||||||
|
local handled = require('treeutils').launch_find_files()
|
||||||
|
|
||||||
|
if handled == "default" then
|
||||||
|
-- If custom function didn't handle it, execute default behavior
|
||||||
|
local default_key = vim.api.nvim_replace_termcodes('<c-f>', true, true, true)
|
||||||
|
vim.api.nvim_feedkeys(default_key, 'n', false)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
'';
|
||||||
|
|
||||||
keymaps = [
|
keymaps = [
|
||||||
## Go to current buffer's file in nvim-tree
|
## Go to current buffer's file in nvim-tree
|
||||||
{
|
{
|
||||||
|
@ -25,7 +38,7 @@
|
||||||
{
|
{
|
||||||
mode = [ "n" ];
|
mode = [ "n" ];
|
||||||
key = "<c-f>";
|
key = "<c-f>";
|
||||||
action = "<cmd>lua require('treeutils').launch_find_files()<CR>";
|
action = "<cmd>lua launch_find_files_wrapped()<CR>";
|
||||||
options = { noremap = true; };
|
options = { noremap = true; };
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
|
|
|
@ -22,15 +22,28 @@ function M.launch_live_grep(opts)
|
||||||
end
|
end
|
||||||
|
|
||||||
function M.launch_find_files(opts)
|
function M.launch_find_files(opts)
|
||||||
return M.launch_telescope("find_files", opts)
|
return M.launch_telescope("find_files", opts, { active_only_in_tree = true })
|
||||||
|
end
|
||||||
|
|
||||||
|
function M.launch_telescope(func_name, opts, internal_opts)
|
||||||
|
internal_opts = internal_opts or {}
|
||||||
|
local buffname = vim.fn.bufname()
|
||||||
|
if (internal_opts.active_only_in_tree) then
|
||||||
|
-- Make sure this is being called in NvimTree
|
||||||
|
if (string.sub(buffname, 1, string.len('NvimTree')) ~= 'NvimTree') then
|
||||||
|
return "default"
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function M.launch_telescope(func_name, opts)
|
|
||||||
local telescope_status_ok, _ = pcall(require, "telescope")
|
local telescope_status_ok, _ = pcall(require, "telescope")
|
||||||
if not telescope_status_ok then
|
if not telescope_status_ok then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
local node = api.tree.get_node_under_cursor()
|
local node = api.tree.get_node_under_cursor()
|
||||||
|
if (node == nil) then
|
||||||
|
-- Tree is probably not open
|
||||||
|
return
|
||||||
|
end
|
||||||
local is_folder = node.fs_stat and node.fs_stat.type == 'directory' or false
|
local is_folder = node.fs_stat and node.fs_stat.type == 'directory' or false
|
||||||
local basedir = is_folder and node.absolute_path or vim.fn.fnamemodify(node.absolute_path, ":h")
|
local basedir = is_folder and node.absolute_path or vim.fn.fnamemodify(node.absolute_path, ":h")
|
||||||
if (node.name == '..' and TreeExplorer ~= nil) then
|
if (node.name == '..' and TreeExplorer ~= nil) then
|
||||||
|
|
Loading…
Add table
Reference in a new issue