avante and remote sshfs

This commit is contained in:
RingOfStorms (Joshua Bell) 2024-11-14 13:40:28 -06:00
parent 0799ca73d0
commit 615c53c8fb
6 changed files with 210 additions and 49 deletions

51
flake.lock generated
View file

@ -528,6 +528,22 @@
"type": "github"
}
},
"nvim_plugin-nosduco/remote-sshfs.nvim": {
"flake": false,
"locked": {
"lastModified": 1724901856,
"narHash": "sha256-vFEIISxhTIGSl9LzDYHuEIkjLGkU0y5XhfWI/i5DgN4=",
"owner": "nosduco",
"repo": "remote-sshfs.nvim",
"rev": "03f6c40c4032eeb1ab91368e06db9c3f3a97a75d",
"type": "github"
},
"original": {
"owner": "nosduco",
"repo": "remote-sshfs.nvim",
"type": "github"
}
},
"nvim_plugin-nvim-lua/plenary.nvim": {
"flake": false,
"locked": {
@ -800,6 +816,22 @@
"type": "github"
}
},
"nvim_plugin-stevearc/dressing.nvim": {
"flake": false,
"locked": {
"lastModified": 1731521499,
"narHash": "sha256-O0sdxU+ZQnclnnC5IfBpgqlMxjsJKlmPYQYPP+S3cn8=",
"owner": "stevearc",
"repo": "dressing.nvim",
"rev": "fc78a3ca96f4db9f8893bb7e2fd9823e0780451b",
"type": "github"
},
"original": {
"owner": "stevearc",
"repo": "dressing.nvim",
"type": "github"
}
},
"nvim_plugin-tpope/vim-sleuth": {
"flake": false,
"locked": {
@ -864,6 +896,22 @@
"type": "github"
}
},
"nvim_plugin-yetone/avante.nvim": {
"flake": false,
"locked": {
"lastModified": 1731602098,
"narHash": "sha256-pWgJO4v6nUjO9rkTzPKO8pXNwAC372LE6cqv7P9Wfxg=",
"owner": "yetone",
"repo": "avante.nvim",
"rev": "839a8ee25a84f813545440c4c798edd25bfd68a9",
"type": "github"
},
"original": {
"owner": "yetone",
"repo": "avante.nvim",
"type": "github"
}
},
"nvim_plugin-zbirenbaum/copilot-cmp": {
"flake": false,
"locked": {
@ -931,6 +979,7 @@
"nvim_plugin-mfussenegger/nvim-lint": "nvim_plugin-mfussenegger/nvim-lint",
"nvim_plugin-mrcjkb/rustaceanvim": "nvim_plugin-mrcjkb/rustaceanvim",
"nvim_plugin-neovim/nvim-lspconfig": "nvim_plugin-neovim/nvim-lspconfig",
"nvim_plugin-nosduco/remote-sshfs.nvim": "nvim_plugin-nosduco/remote-sshfs.nvim",
"nvim_plugin-nvim-lua/plenary.nvim": "nvim_plugin-nvim-lua/plenary.nvim",
"nvim_plugin-nvim-lualine/lualine.nvim": "nvim_plugin-nvim-lualine/lualine.nvim",
"nvim_plugin-nvim-telescope/telescope-file-browser.nvim": "nvim_plugin-nvim-telescope/telescope-file-browser.nvim",
@ -948,10 +997,12 @@
"nvim_plugin-saadparwaiz1/cmp_luasnip": "nvim_plugin-saadparwaiz1/cmp_luasnip",
"nvim_plugin-sindrets/diffview.nvim": "nvim_plugin-sindrets/diffview.nvim",
"nvim_plugin-stevearc/conform.nvim": "nvim_plugin-stevearc/conform.nvim",
"nvim_plugin-stevearc/dressing.nvim": "nvim_plugin-stevearc/dressing.nvim",
"nvim_plugin-tpope/vim-sleuth": "nvim_plugin-tpope/vim-sleuth",
"nvim_plugin-tpope/vim-surround": "nvim_plugin-tpope/vim-surround",
"nvim_plugin-uga-rosa/ccc.nvim": "nvim_plugin-uga-rosa/ccc.nvim",
"nvim_plugin-windwp/nvim-ts-autotag": "nvim_plugin-windwp/nvim-ts-autotag",
"nvim_plugin-yetone/avante.nvim": "nvim_plugin-yetone/avante.nvim",
"nvim_plugin-zbirenbaum/copilot-cmp": "nvim_plugin-zbirenbaum/copilot-cmp",
"nvim_plugin-zbirenbaum/copilot.lua": "nvim_plugin-zbirenbaum/copilot.lua",
"rust-overlay": "rust-overlay"

View file

@ -108,10 +108,10 @@
"nvim_plugin-zbirenbaum/copilot.lua".flake = false;
"nvim_plugin-CopilotC-Nvim/CopilotChat.nvim".url = "github:CopilotC-Nvim/CopilotChat.nvim";
"nvim_plugin-CopilotC-Nvim/CopilotChat.nvim".flake = false;
# "nvim_plugin-yetone/avante.nvim".url = "github:yetone/avante.nvim";
# "nvim_plugin-yetone/avante.nvim".flake = false;
# "nvim_plugin-stevearc/dressing.nvim".url = "github:stevearc/dressing.nvim";
# "nvim_plugin-stevearc/dressing.nvim".flake = false;
"nvim_plugin-yetone/avante.nvim".url = "github:yetone/avante.nvim";
"nvim_plugin-yetone/avante.nvim".flake = false;
"nvim_plugin-stevearc/dressing.nvim".url = "github:stevearc/dressing.nvim";
"nvim_plugin-stevearc/dressing.nvim".flake = false;
"nvim_plugin-folke/neodev.nvim".url = "github:folke/neodev.nvim";
"nvim_plugin-folke/neodev.nvim".flake = false;
"nvim_plugin-mrcjkb/rustaceanvim".url = "github:mrcjkb/rustaceanvim";
@ -124,6 +124,8 @@
"nvim_plugin-rafamadriz/friendly-snippets".flake = false;
"nvim_plugin-ron/ron.vim".url = "github:ron-rs/ron.vim";
"nvim_plugin-ron/ron.vim".flake = false;
"nvim_plugin-nosduco/remote-sshfs.nvim".url = "github:nosduco/remote-sshfs.nvim";
"nvim_plugin-nosduco/remote-sshfs.nvim".flake = false;
};
outputs =
{
@ -165,6 +167,44 @@
"nvim_plugin-nvim-treesitter/nvim-treesitter" = nvim-treesitter.withAllGrammars;
};
avante-nvim-lib = pkgs.rustPlatform.buildRustPackage {
pname = "avante-nvim-lib";
version = "0.0.0";
src = inputs."nvim_plugin-yetone/avante.nvim";
buildFeatures = [ "luajit" ];
doCheck = false;
cargoLock = {
lockFile = inputs."nvim_plugin-yetone/avante.nvim" + "/Cargo.lock";
allowBuiltinFetchGit = true;
};
nativeBuildInputs = with pkgs; [
pkg-config
];
buildInputs = with pkgs; [
openssl.dev
];
env = {
OPENSSL_NO_VENDOR = "1";
OPENSSL_LIB_DIR = "${pkgs.openssl.out}/lib";
OPENSSL_INCLUDE_DIR = "${pkgs.openssl.dev}/include";
OPENSSL_DIR = "${pkgs.openssl.dev}";
};
postInstall = ''
# mv $out/lib/libavante_repo_map.so $out/lib/avante_repo_map.so
for f in $out/lib/lib*; do
mv "$f" "$out/lib/''${f##*/lib}"
done
'';
meta = {
description = "Avante nvim libraries";
homepage = "https://github.com/yetone/avante.nvim";
license = pkgs.lib.licenses.asl20;
};
};
# This will be how we put any nix related stuff into our lua config
luaNixGlobal =
"NIX="
@ -182,6 +222,7 @@
(builtins.filter (n: builtins.substring 0 12 n == "nvim_plugin-") (builtins.attrNames inputs));
});
# These are appended at the start of the path so that they take precedence over local install tools
runtimeDependencies = with pkgs; [
# tools
ripgrep # search
@ -190,9 +231,11 @@
tree-sitter
glow # markdown renderer
curl # http requests
# nodePackages.cspell TODO
sshfs # remote dev for nosduco/remote-sshfs.nvim
# nodePackages.cspell TODO check out `typos` rust checker instead?
];
# These are appended at the end of the PATH so any local installed tools will take precedence
defaultRuntimeDependencies = with pkgs; [
# linters
markdownlint-cli
@ -261,6 +304,16 @@
"--set"
"LAZY"
"${lazyPath}"
# Link avante libraries
"--prefix"
"LD_LIBRARY_PATH"
":"
"${avante-nvim-lib}/lib"
# Add Lua C modules path
"--prefix"
"LUA_CPATH"
";"
"${avante-nvim-lib}/lib/?.so"
# Don't use default directories to not collide with another neovim config
# All things at runtime should be deletable since we are using nix to handle downloads and bins
# so I've chosen to put everything into the local state directory.

View file

@ -1,36 +0,0 @@
return {
"yetone/avante.nvim",
dependencies = {
"nvim-treesitter/nvim-treesitter",
"stevearc/dressing.nvim",
"nvim-lua/plenary.nvim",
"MunifTanjim/nui.nvim",
--- The below dependencies are optional,
-- {
-- -- support for image pasting
-- "HakonHarnes/img-clip.nvim",
-- event = "VeryLazy",
-- opts = {
-- -- recommended settings
-- default = {
-- embed_image_as_base64 = false,
-- prompt_for_file_name = false,
-- drag_and_drop = {
-- insert_mode = true,
-- },
-- -- required for Windows users
-- use_absolute_path = true,
-- },
-- },
-- },
},
event = "VeryLazy",
lazy = false,
opts = {
provider = "claude",
},
config = function(_, opts)
require("avante_lib").load()
require("avante").setup(opts)
end,
}

80
lua/plugins/avante.lua Normal file
View file

@ -0,0 +1,80 @@
return {
-- cond = false,
"yetone/avante.nvim",
dependencies = {
"nvim-treesitter/nvim-treesitter",
"stevearc/dressing.nvim",
"nvim-lua/plenary.nvim",
"MunifTanjim/nui.nvim",
--- The below dependencies are optional,
-- {
-- -- support for image pasting
-- "HakonHarnes/img-clip.nvim",
-- event = "VeryLazy",
-- opts = {
-- -- recommended settings
-- default = {
-- embed_image_as_base64 = false,
-- prompt_for_file_name = false,
-- drag_and_drop = {
-- insert_mode = true,
-- },
-- -- required for Windows users
-- use_absolute_path = true,
-- },
-- },
-- },
},
event = "VeryLazy",
build = function()
-- TODO does this actually work? I still dont have full non nix support tested for this config.
if not NIX then
vim.cmd("make")
end
end,
lazy = false,
opts = {
provider = "claude",
behavior = {
-- auto_suggestions = true, -- Experimental stage
auto_set_keymaps = false,
support_paste_from_clipboard = true,
},
},
config = function(_, opts)
require("avante_lib").load()
require("avante").setup(opts)
end,
keys = {
{
"<leader><leader>c",
"<cmd>AvanteToggle<cr>",
desc = "Avante - Toggle Chat",
mode = { "n", "v", "x" },
},
{
"<leader><leader>r",
"<cmd>AvanteRefresh<cr>",
desc = "Avante - Refresh",
mode = { "n", "v", "x" },
},
{
"<leader><leader>f",
"<cmd>AvanteFocus<cr>",
desc = "CopilotChat - Quick chat",
mode = { "n", "v", "x" },
},
{
"<leader><leader>e",
"<cmd>AvanteEdit<cr>",
desc = "Avante - Edit Selection",
mode = { "v", "x" },
},
{
"<leader><leader>e",
"<esc>ggVG<cmd>AvanteEdit<cr>",
desc = "Avante - Edit File",
mode = { "n" },
},
},
}

View file

@ -50,9 +50,8 @@ return {
},
},
keys = {
-- Show help actions with telescope
{
"<leader><leader>h",
"<leader>ch",
function()
local actions = require("CopilotChat.actions")
require("CopilotChat.integrations.telescope").pick(actions.help_actions())
@ -60,9 +59,8 @@ return {
desc = "CopilotChat - Help actions",
mode = { "n", "v", "x" },
},
-- Show prompts actions with telescope
{
"<leader><leader>p",
"<leader>cp",
function()
local actions = require("CopilotChat.actions")
require("CopilotChat.integrations.telescope").pick(actions.prompt_actions())
@ -70,9 +68,8 @@ return {
desc = "CopilotChat - Prompt actions",
mode = { "n", "v", "x" },
},
-- Quick chat with Copilot
{
"<leader><leader>q",
"<leader>cq",
function()
local input = vim.fn.input("Quick Chat: ")
if input ~= "" then
@ -82,9 +79,8 @@ return {
desc = "CopilotChat - Quick chat",
mode = { "n", "v", "x" },
},
-- Quick chat with Copilot
{
"<leader><leader>c",
"<leader>cc",
function()
require("CopilotChat").toggle()
end,

View file

@ -0,0 +1,17 @@
return {
"nosduco/remote-sshfs.nvim",
cmd = {
"RemoteSshfs",
"RemoteSSHFSConnect",
"RemoteSSHFSDisconnect",
"RemoteSSHFSEdit",
"RemoteSSHFSFindFiles",
"RemoteSSHFSLiveGrep",
},
dependencies = { "nvim-telescope/telescope.nvim" },
opts = {},
config = function(_, opts)
require("remote-sshfs").setup(opts)
require("telescope").load_extension("remote-sshfs")
end,
}