Nvim : Integrate ollama.
This commit is contained in:
parent
ddb61d4091
commit
ab328fa858
|
@ -48,6 +48,10 @@
|
||||||
url = "git+https://git.voronind.com/mirror/lualine.nvim.git";
|
url = "git+https://git.voronind.com/mirror/lualine.nvim.git";
|
||||||
flake = false;
|
flake = false;
|
||||||
};
|
};
|
||||||
|
nvimOllama = {
|
||||||
|
url = "git+https://git.voronind.com/mirror/ollama.nvim.git";
|
||||||
|
flake = false;
|
||||||
|
};
|
||||||
nvimPlenary = {
|
nvimPlenary = {
|
||||||
url = "git+https://git.voronind.com/mirror/plenary.nvim.git";
|
url = "git+https://git.voronind.com/mirror/plenary.nvim.git";
|
||||||
flake = false;
|
flake = false;
|
||||||
|
|
|
@ -17,8 +17,7 @@
|
||||||
after = [ "NetworkManager-wait-online.service" "ollama.service" ];
|
after = [ "NetworkManager-wait-online.service" "ollama.service" ];
|
||||||
serviceConfig.Type = "simple";
|
serviceConfig.Type = "simple";
|
||||||
script = ''
|
script = ''
|
||||||
${lib.getExe pkgs.ollama} pull llama2-uncensored
|
${lib.getExe pkgs.ollama} pull mistral
|
||||||
${lib.getExe pkgs.ollama} pull codellama
|
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,7 +9,7 @@ in {
|
||||||
vimAlias = true;
|
vimAlias = true;
|
||||||
configure = {
|
configure = {
|
||||||
customRC = ''
|
customRC = ''
|
||||||
set runtimepath+=~/.cache/nvim,~/.cache/nvim/treesitter,${inputs.nvimTrouble},${inputs.nvimAlign},${inputs.nvimAutoclose},${inputs.nvimBufferline},${inputs.nvimCloseBuffers},${inputs.nvimDevicons},${inputs.nvimGitsigns},${inputs.nvimGruvbox},${inputs.nvimIndentoMatic},${inputs.nvimLspconfig},${inputs.nvimLualine},${inputs.nvimPlenary},${inputs.nvimSingleComment},${inputs.nvimTelescope},${inputs.nvimTodo},${inputs.nvimTokyonight},${inputs.nvimTree},${inputs.nvimTreesitter},${inputs.nvimWhichKey}
|
set runtimepath+=~/.cache/nvim,~/.cache/nvim/treesitter,${inputs.nvimTrouble},${inputs.nvimAlign},${inputs.nvimAutoclose},${inputs.nvimBufferline},${inputs.nvimCloseBuffers},${inputs.nvimDevicons},${inputs.nvimGitsigns},${inputs.nvimGruvbox},${inputs.nvimIndentoMatic},${inputs.nvimLspconfig},${inputs.nvimLualine},${inputs.nvimOllama},${inputs.nvimPlenary},${inputs.nvimSingleComment},${inputs.nvimTelescope},${inputs.nvimTodo},${inputs.nvimTokyonight},${inputs.nvimTree},${inputs.nvimTreesitter},${inputs.nvimWhichKey}
|
||||||
|
|
||||||
lua dofile("${nvimSrc}/key/Rekey.lua")
|
lua dofile("${nvimSrc}/key/Rekey.lua")
|
||||||
lua dofile("${nvimSrc}/key/Leader.lua")
|
lua dofile("${nvimSrc}/key/Leader.lua")
|
||||||
|
@ -34,6 +34,7 @@ in {
|
||||||
lua dofile("${nvimSrc}/plugin/Align.lua")
|
lua dofile("${nvimSrc}/plugin/Align.lua")
|
||||||
lua dofile("${nvimSrc}/plugin/Treesitter.lua")
|
lua dofile("${nvimSrc}/plugin/Treesitter.lua")
|
||||||
lua dofile("${nvimSrc}/plugin/Fold.lua")
|
lua dofile("${nvimSrc}/plugin/Fold.lua")
|
||||||
|
lua dofile("${nvimSrc}/plugin/Ollama.lua")
|
||||||
lua dofile("${nvimSrc}/key/Autocomplete.lua")
|
lua dofile("${nvimSrc}/key/Autocomplete.lua")
|
||||||
lua dofile("${nvimSrc}/key/Buffer.lua")
|
lua dofile("${nvimSrc}/key/Buffer.lua")
|
||||||
lua dofile("${nvimSrc}/key/Comment.lua")
|
lua dofile("${nvimSrc}/key/Comment.lua")
|
||||||
|
@ -43,6 +44,7 @@ in {
|
||||||
lua dofile("${nvimSrc}/key/Gitsigns.lua")
|
lua dofile("${nvimSrc}/key/Gitsigns.lua")
|
||||||
lua dofile("${nvimSrc}/key/Lsp.lua")
|
lua dofile("${nvimSrc}/key/Lsp.lua")
|
||||||
lua dofile("${nvimSrc}/key/Navigation.lua")
|
lua dofile("${nvimSrc}/key/Navigation.lua")
|
||||||
|
lua dofile("${nvimSrc}/key/Ollama.lua")
|
||||||
lua dofile("${nvimSrc}/key/Sort.lua")
|
lua dofile("${nvimSrc}/key/Sort.lua")
|
||||||
lua dofile("${nvimSrc}/key/Telescope.lua")
|
lua dofile("${nvimSrc}/key/Telescope.lua")
|
||||||
lua dofile("${nvimSrc}/key/Terminal.lua")
|
lua dofile("${nvimSrc}/key/Terminal.lua")
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
# Usage: ask <QUERY>
|
# Usage: ask <QUERY>
|
||||||
function ask() {
|
function ask() {
|
||||||
curl http://localhost:11434/api/generate -d "{
|
curl http://localhost:11434/api/generate -d "{
|
||||||
\"model\": \"llama2-uncensored\",
|
\"model\": \"mistral\",
|
||||||
\"prompt\":\"${*}\"
|
\"prompt\":\"${*}\"
|
||||||
}" 2> /dev/null | parallel -j1 -- "echo {} | jq -r .response | tr -d '\n'"
|
}" 2> /dev/null | parallel -j1 -- "echo {} | jq -r .response | tr -d '\n'"
|
||||||
echo
|
echo
|
||||||
|
@ -12,7 +12,7 @@ function ask() {
|
||||||
# Usage: ask_code <QUERY>
|
# Usage: ask_code <QUERY>
|
||||||
function ask_code() {
|
function ask_code() {
|
||||||
curl http://localhost:11434/api/generate -d "{
|
curl http://localhost:11434/api/generate -d "{
|
||||||
\"model\": \"codellama\",
|
\"model\": \"mistral\",
|
||||||
\"prompt\":\"${*}\"
|
\"prompt\":\"${*}\"
|
||||||
}" 2> /dev/null | parallel -j1 -- "echo {} | jq -r .response | tr -d '\n'"
|
}" 2> /dev/null | parallel -j1 -- "echo {} | jq -r .response | tr -d '\n'"
|
||||||
echo
|
echo
|
||||||
|
|
2
.config/linux/system/module/common/nvim/key/Ollama.lua
Normal file
2
.config/linux/system/module/common/nvim/key/Ollama.lua
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
rekey_normal("<Leader>p", ":<c-u>lua require('ollama').prompt()<cr>")
|
||||||
|
rekey_visual("<Leader>p", ":<c-u>lua require('ollama').prompt()<cr>")
|
13
.config/linux/system/module/common/nvim/plugin/Ollama.lua
Normal file
13
.config/linux/system/module/common/nvim/plugin/Ollama.lua
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
require("ollama").setup {
|
||||||
|
model = "mistral",
|
||||||
|
url = "http://127.0.0.1:11434",
|
||||||
|
-- View the actual default prompts in ./lua/ollama/prompts.lua
|
||||||
|
prompts = {
|
||||||
|
Sample_Prompt = {
|
||||||
|
prompt = "This is a sample prompt that receives $input and $sel(ection), among others.",
|
||||||
|
input_label = "> ",
|
||||||
|
model = "mistral",
|
||||||
|
action = "display",
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Reference in a new issue