Created
June 15, 2025 14:22
-
-
Save dch/d7792a3c47c18443c0666a28f2edc0a8 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- vim: set filetype=lua : | |
--- bootstrap plugin manager | |
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, | |
}) | |
end | |
vim.opt.rtp:prepend(lazypath) | |
--- load plugins | |
-- load('user.plugins') | |
local plugins = { | |
-- old skool vim plugins | |
{ | |
'gleam-lang/gleam.vim' | |
}, | |
{ | |
'ntpeters/vim-better-whitespace' | |
}, | |
{ | |
'tpope/vim-commentary' | |
}, | |
{ | |
'tpope/vim-surround' | |
}, | |
{ | |
'tpope/vim-unimpaired' | |
}, | |
-- new age lua plugins | |
{ | |
"nvim-treesitter/nvim-treesitter", | |
branch = "main", | |
build = ":TSUpdate", | |
config = function() | |
require("nvim-treesitter.configs").setup({ | |
highlight = { enable = true }, | |
additional_vim_regex_highlighting = false, | |
indent = { enable = true }, | |
auto_install = true, | |
ensure_installed = { | |
"c", | |
"css", | |
"diff", | |
"eex", | |
"elixir", | |
"heex", | |
"html", | |
"json", | |
"lua", | |
"luadoc", | |
"markdown", | |
"markdown_inline", | |
"org", | |
"xml", | |
"yaml", | |
}, | |
}) | |
end, | |
}, | |
{ | |
'ibhagwan/fzf-lua', | |
-- optional for icon support | |
dependencies = { 'nvim-tree/nvim-web-devicons' }, | |
config = function() | |
-- calling `setup` is optional for customization | |
require('fzf-lua').setup({'telescope',winopts={preview={default='bat'}}}) | |
end | |
}, | |
{ | |
"folke/which-key.nvim", | |
event = "VeryLazy", | |
init = function() | |
vim.o.timeout = true | |
vim.o.timeoutlen = 300 | |
end, | |
opts = { | |
-- your configuration comes here | |
-- or leave it empty to use the default settings | |
-- refer to the configuration section below | |
} | |
}, | |
-- https://github.com/elixir-tools/elixir-tools.nvim | |
{ | |
'elixir-tools/elixir-tools.nvim', | |
version = '*', | |
event = { 'BufReadPre', 'BufNewFile' }, | |
config = function() | |
local elixir = require('elixir') | |
local elixirls = require('elixir.elixirls') | |
elixir.setup { | |
nextls = {enable = false, port = 1999}, | |
credo = {enable = true}, | |
elixirls = { | |
enable = false, | |
settings = elixirls.settings { | |
dialyzerEnabled = false, | |
enableTestLenses = false, | |
}, | |
on_attach = function(client, bufnr) | |
vim.keymap.set('n', '<space>fp', ':ElixirFromPipe<cr>', { buffer = true, noremap = true }) | |
vim.keymap.set('n', '<space>tp', ':ElixirToPipe<cr>', { buffer = true, noremap = true }) | |
vim.keymap.set('v', '<space>em', ':ElixirExpandMacro<cr>', { buffer = true, noremap = true }) | |
end, | |
} | |
} | |
end, | |
dependencies = { | |
'nvim-lua/plenary.nvim', | |
}, | |
}, | |
{ | |
'github/copilot.vim' | |
}, | |
{ | |
'nvim-orgmode/orgmode', | |
event = 'VeryLazy', | |
ft = { 'org' }, | |
config = function() | |
-- Setup orgmode | |
require('orgmode').setup({ | |
org_agenda_files = '~/orgfiles/**/*', | |
org_default_notes_file = '~/orgfiles/refile.org', | |
}) | |
-- NOTE: If you are using nvim-treesitter with ~ensure_installed = "all"~ option | |
-- add ~org~ to ignore_install | |
-- require('nvim-treesitter.configs').setup({ | |
-- ensure_installed = 'all', | |
-- ignore_install = { 'org' }, | |
-- }) | |
end, | |
} | |
} | |
require('lazy').setup(plugins) | |
-- https://github.com/dpayne/CodeGPT.nvim | |
local function get_anthropic_api_key() | |
local cmd = "vault read -field=token secret/claude" | |
local handle = io.popen(cmd) | |
local api_key = handle:read("*a") | |
handle:close() | |
return api_key:gsub("%s+", "") | |
end | |
local function get_openai_api_key() | |
local cmd = "vault read -field=api secret/openai" | |
local handle = io.popen(cmd) | |
local api_key = handle:read("*a") | |
handle:close() | |
return api_key:gsub("%s+", "") | |
end | |
vim.g["codegpt_api_provider"] = "openai" | |
-- vim.g["codegpt_openai_api_key"] = get_openai_api_key() | |
-- vim.g["codegpt_api_provider"] = "anthropic" | |
-- vim.g["codegpt_anthropic_api_key"] = get_anthropic_api_key() | |
vim.g["codegpt_global_commands_defaults"] = { | |
model = 'chatgpt-4o', | |
-- model = 'claude-3-opus-20240229', | |
max_tokens = 8192, | |
temperature = 0.6, | |
-- top_p = 0.9, | |
-- frequency_penalty = 0.0, | |
-- presence_penalty = 0.0, | |
} | |
vim.g["codegpt_hooks"] = { | |
request_started = function() | |
vim.cmd("hi StatusLine ctermbg=NONE ctermfg=yellow") | |
end, | |
request_finished = vim.schedule_wrap(function() | |
vim.cmd("hi StatusLine ctermbg=NONE ctermfg=NONE") | |
end) | |
} | |
local configs = { | |
-- 'trashfire.vim', | |
'commands.lua', | |
-- 'settings.lua', | |
'ui.vim', | |
'ui.lua', | |
'ai.lua', | |
'keymaps.lua', | |
} | |
-- import custom configs | |
for _, name in ipairs(configs) do | |
local path = string.format('%s/user/%s', vim.fn.stdpath('config'), name) | |
local source_cmd = 'source ' .. path | |
vim.cmd(source_cmd) | |
end | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment