Skip to content

Commit

Permalink
feat: add gen.nvim and oil.nvim
Browse files Browse the repository at this point in the history
  • Loading branch information
adrielp committed Jun 24, 2024
1 parent 6dffa7c commit 186fdb4
Show file tree
Hide file tree
Showing 3 changed files with 148 additions and 112 deletions.
2 changes: 1 addition & 1 deletion .config/nvim/lua/core/mappings.lua
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ keymap("n", "<leader>u", ":UndotreeShow<cr>", opts)
keymap("n", "<leader>C", ":let @/ = ''<cr>", opts)
keymap("n", "<leader>so", ":so %<cr>", opts)
keymap("t", "<esc>", "<c-\\><C-n>", term_opts)
keymap("n", "<leader>n", ":Ex<cr>", opts)
-- keymap("n", "<leader>n", ":Ex<cr>", opts)
-- keymap("n", "<C-d", "<C-d>zz", opts)
-- keymap("n", "<C-u", "<C-u>zz", opts)

Expand Down
1 change: 1 addition & 0 deletions .config/nvim/lua/plugins/config/whichkey.lua
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ local options = {
local wk = require("which-key")

wk.register({
n = {"<cmd>Oil<cr>", " Open Oil"},
f = {
name = " File",
f = { "<cmd>Telescope find_files<cr>", " Find File" },
Expand Down
257 changes: 146 additions & 111 deletions .config/nvim/lua/plugins/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,134 +2,134 @@

local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
if not vim.loop.fs_stat(lazypath) then
vim.fn.system({
"git",
"clone",
"--filter=blob:none",
"https://github.com/folke/lazy.nvim.git",
"--branch=stable", -- latest stable release
lazypath,
})
vim.fn.system({
"git",
"clone",
"--filter=blob:none",
"https://github.com/folke/lazy.nvim.git",
"--branch=stable", -- latest stable release
lazypath,
})
end
vim.opt.rtp:prepend(lazypath)

-- Plugins I use
local plugs = {
-- Essential Plugins
--'tpope/vim-fugitive',
{
'windwp/nvim-autopairs',
init = function()
require('nvim-autopairs').setup{}
end
},
'mbbill/undotree',
-- Essential Plugins
--'tpope/vim-fugitive',
{
'windwp/nvim-autopairs',
init = function()
require('nvim-autopairs').setup{}
end
},
'mbbill/undotree',
{
'nvim-lualine/lualine.nvim',
dependencies = {
'nvim-tree/nvim-web-devicons'
}

},
-- 'vim-airline/vim-airline',
'github/copilot.vim',
{
'nvim-treesitter/nvim-treesitter',
build = ':TSUpdate'
},

{'nvim-treesitter/playground'},
'theprimeagen/harpoon',
{
'nvim-telescope/telescope.nvim',
dependencies = {
'nvim-lua/plenary.nvim'
}
},
-- Theme
{
'catppuccin/nvim',
name = 'catppuccin',
lazy = false,
priority = 1000,
opts = {
transparent_background = true
},
init = function()
vim.cmd.colorscheme 'catppuccin-mocha'
end
},
-- LSP
{
'VonHeikemen/lsp-zero.nvim',
branch = 'v2.x',
dependencies = {
-- LSP Support
{'neovim/nvim-lspconfig'},
{
'williamboman/mason.nvim',
build = function()
-- vim.cmd 'MasonUpdate'
-- vim.cmd, 'MasonUpdate'
pcall(vim.cmd, 'MasonUpdate')
end,
},
{'williamboman/mason-lspconfig.nvim'},

-- Autocompletion
{'hrsh7th/nvim-cmp'},
{'hrsh7th/cmp-nvim-lsp'},
{'L3MON4D3/LuaSnip'}

-- Optionals
-- {'hrsh7th/cmp-buffer'},
-- {'hrsh7th/cmp-path'},
-- {'saadparwaiz1/cmp_luasnip'},
-- {'hrsh7th/cmp-nvim-lua'},
-- {'rafamadriz/friendly-snippets'},
}
},
-- Only load whichkey after all the gui
{
"folke/which-key.nvim",
opts = function()
return require ('plugins.config.whichkey')
end,
config = function(_, opts)
vim.o.timeout = true
vim.o.timeoutlen = 300
require("which-key").setup(opts)
end,
},
-- 'vim-airline/vim-airline',
'github/copilot.vim',
{
"darrikonn/vim-gofmt",
'nvim-treesitter/nvim-treesitter',
build = ':TSUpdate'
},

{'nvim-treesitter/playground'},
'theprimeagen/harpoon',
{
"arnamak/stay-centered.nvim",
init = function()
require('stay-centered').setup{}
end
'nvim-telescope/telescope.nvim',
dependencies = {
'nvim-lua/plenary.nvim'
}
},
-- See the docs for more information
-- https://github.com/huynle/ogpt.nvim
-- Theme
{
"huynle/ogpt.nvim",
event = "VeryLazy",
'catppuccin/nvim',
name = 'catppuccin',
lazy = false,
priority = 1000,
opts = {
default_provider = "ollama",
providers = {
ollama = {
api_host = os.getenv("OLLAMA_API_HOST") or "http://localhost:11434",
api_key = os.getenv("OLLAMA_API_KEY") or "",
}
}
transparent_background = true
},
init = function()
vim.cmd.colorscheme 'catppuccin-mocha'
end
},
-- LSP
{
'VonHeikemen/lsp-zero.nvim',
branch = 'v2.x',
dependencies = {
"MunifTanjim/nui.nvim",
"nvim-lua/plenary.nvim",
"nvim-telescope/telescope.nvim"
-- LSP Support
{'neovim/nvim-lspconfig'},
{
'williamboman/mason.nvim',
build = function()
-- vim.cmd 'MasonUpdate'
-- vim.cmd, 'MasonUpdate'
pcall(vim.cmd, 'MasonUpdate')
end,
},
{'williamboman/mason-lspconfig.nvim'},

-- Autocompletion
{'hrsh7th/nvim-cmp'},
{'hrsh7th/cmp-nvim-lsp'},
{'L3MON4D3/LuaSnip'}

-- Optionals
-- {'hrsh7th/cmp-buffer'},
-- {'hrsh7th/cmp-path'},
-- {'saadparwaiz1/cmp_luasnip'},
-- {'hrsh7th/cmp-nvim-lua'},
-- {'rafamadriz/friendly-snippets'},
}
},
-- Only load whichkey after all the gui
{
"folke/which-key.nvim",
opts = function()
return require ('plugins.config.whichkey')
end,
config = function(_, opts)
vim.o.timeout = true
vim.o.timeoutlen = 300
require("which-key").setup(opts)
end,
},
{
"darrikonn/vim-gofmt",
},
{
"arnamak/stay-centered.nvim",
init = function()
require('stay-centered').setup{}
end
},
-- See the docs for more information
-- https://github.com/huynle/ogpt.nvim
-- {
-- "huynle/ogpt.nvim",
-- event = "VeryLazy",
-- opts = {
-- default_provider = "ollama",
-- providers = {
-- ollama = {
-- api_host = os.getenv("OLLAMA_API_HOST") or "http://localhost:11434",
-- api_key = os.getenv("OLLAMA_API_KEY") or "",
-- }
-- }
-- },
-- dependencies = {
-- "MunifTanjim/nui.nvim",
-- "nvim-lua/plenary.nvim",
-- "nvim-telescope/telescope.nvim"
-- }
-- },
-- NeoGit, a replacement for Vim Fugitive
{
"NeogitOrg/neogit",
Expand All @@ -142,14 +142,49 @@ local plugs = {
},
-- Lua
{
"folke/zen-mode.nvim",
"folke/zen-mode.nvim",
},
{
"numToStr/Comment.nvim",
{
"numToStr/Comment.nvim",
config = function()
require ('Comment').setup()
require ('Comment').setup()
end,
}
},
{
'stevearc/oil.nvim',
-- opts = {},
-- Optional dependencies
dependencies = { "nvim-tree/nvim-web-devicons" },
init = function()
require('oil').setup{}
end
},
{
'David-Kunz/gen.nvim',
opts = {
model = "llama3", -- The default model to use.
host = "localhost", -- The host running the Ollama service.
port = "11434", -- The port on which the Ollama service is listening.
quit_map = "q", -- set keymap for close the response window
retry_map = "<c-r>", -- set keymap to re-send the current prompt
init = function(options) pcall(io.popen, "ollama serve > /dev/null 2>&1 &") end,
-- Function to initialize Ollama
command = function(options)
local body = {model = options.model, stream = true}
return "curl --silent --no-buffer -X POST http://" .. options.host .. ":" .. options.port .. "/api/chat -d $body"
end,
-- The command for the Ollama service. You can use placeholders $prompt, $model and $body (shellescaped).
-- This can also be a command string.
-- The executed command must return a JSON object with { response, context }
-- (context property is optional).
-- list_models = '<omitted lua function>', -- Retrieves a list of model names
display_mode = "float", -- The display mode. Can be "float" or "split" or "horizontal-split".
show_prompt = false, -- Shows the prompt submitted to Ollama.
show_model = false, -- Displays which model you are using at the beginning of your chat session.
no_auto_close = false, -- Never closes the window automatically.
debug = false -- Prints errors and the command which is run.
}
}
}

-- can add opts to .setup(plugs)
Expand Down

0 comments on commit 186fdb4

Please sign in to comment.