Skip to content

Commit

Permalink
dev
Browse files Browse the repository at this point in the history
  • Loading branch information
jmbuhr committed Oct 9, 2024
1 parent 3d0cd29 commit 039f622
Show file tree
Hide file tree
Showing 8 changed files with 86 additions and 11 deletions.
25 changes: 25 additions & 0 deletions after/queries/python/injections.scm
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
; extends
((call
function: (identifier) @function_name (#eq? @function_name "Style")
arguments: (argument_list
(string
(string_content) @injection.content)))

(#set! injection.language "css"))

((call
function: (identifier) @function_name (#eq? @function_name "Script")
arguments: (argument_list
(string
(string_content) @injection.content)))

(#set! injection.language "javascript"))

((call
function: (identifier) @function_name (#eq? @function_name "On")
arguments: (argument_list

(string
(string_content) @injection.content))

(#set! injection.language "javascript")))
2 changes: 2 additions & 0 deletions ftplugin/python.lua
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
vim.b.slime_cell_delimiter = '#\\s\\=%%'

require("otter").activate()
5 changes: 5 additions & 0 deletions init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,8 @@ require 'config.global'
require 'config.lazy'
require 'config.autocommands'
require 'config.redir'


vim.treesitter.language.add('pandoc_markdown', { path = "/usr/local/lib/libtree-sitter-pandoc-markdown.so" })
vim.treesitter.language.add('pandoc_markdown_inline', { path = "/usr/local/lib/libtree-sitter-pandoc-markdown-inline.so" })
vim.treesitter.language.register('pandoc_markdown', { 'quarto', 'rmarkdown' })
6 changes: 4 additions & 2 deletions lua/config/keymap.lua
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,13 @@ nmap('Q', '<Nop>')
--- TODO: figure out bracketed paste for reticulate python repl.
local function send_cell()
local has_molten, molten_status = pcall(require, 'molten.status')
local molten_works = false
local molten_active = ""
if has_molten then
molten_active = molten_status.kernels()
molten_works, molten_active = pcall(molten_status.kernels)
end
if molten_active ~= vim.NIL and molten_active ~= "" then
if molten_works and molten_active ~= vim.NIL and molten_active ~= "" then
print('using quarto send')
vim.cmd.QuartoSend()
return
end
Expand Down
46 changes: 43 additions & 3 deletions lua/plugins/completion.lua
Original file line number Diff line number Diff line change
Expand Up @@ -123,11 +123,11 @@ return {
{ name = 'path' },
{ name = 'nvim_lsp_signature_help' },
{ name = 'nvim_lsp' },
{ name = 'luasnip', keyword_length = 3, max_item_count = 3 },
{ name = 'luasnip', keyword_length = 3, max_item_count = 3 },
{ name = 'pandoc_references' },
{ name = 'buffer', keyword_length = 5, max_item_count = 3 },
{ name = 'buffer', keyword_length = 5, max_item_count = 3 },
{ name = 'spell' },
{ name = 'treesitter', keyword_length = 5, max_item_count = 3 },
{ name = 'treesitter', keyword_length = 5, max_item_count = 3 },
{ name = 'calc' },
{ name = 'latex_symbols' },
{ name = 'emoji' },
Expand Down Expand Up @@ -174,4 +174,44 @@ return {
}
end,
},

{ -- LLMs
"olimorris/codecompanion.nvim",
dependencies = {
"nvim-lua/plenary.nvim",
"nvim-treesitter/nvim-treesitter",
"nvim-telescope/telescope.nvim",
{
"stevearc/dressing.nvim", -- Optional: Improves the default Neovim UI
opts = {},
},
},
keys = {
{ '<leader>ac', ':CodeCompanionChat<cr>', desc = '[a]i chat' },
},
config = function()
require("codecompanion").setup({
strategies = {
chat = {
adapter = "anthropic",
},
inline = {
adapter = "anthropic",
},
agent = {
adapter = "anthropic",
},
},
adapters = {
anthropic = function()
return require("codecompanion.adapters").extend("anthropic", {
env = {
api_key = os.getenv("ANTHROPIC_API_KEY")
},
})
end,
},
})
end
}
}
8 changes: 4 additions & 4 deletions lua/plugins/lsp.lua
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ return {

-- for lsp features in code cells / embedded code
'jmbuhr/otter.nvim',
dev = true,
dev = false,
dependencies = {
{
'neovim/nvim-lspconfig',
Expand Down Expand Up @@ -100,8 +100,8 @@ return {
map('gh', vim.lsp.buf.signature_help, '[g]o to signature [h]elp')
map('gI', vim.lsp.buf.implementation, '[g]o to [I]mplementation')
map('gr', vim.lsp.buf.references, '[g]o to [r]eferences')
map('[d', function () vim.diagnostic.jump({count = 1}) end,'previous [d]iagnostic ')
map(']d', function () vim.diagnostic.jump({count = -1}) end, 'next [d]iagnostic ')
map(']d', function () vim.diagnostic.jump({count = 1}) end,'previous [d]iagnostic ')
map('[d', function () vim.diagnostic.jump({count = -1}) end, 'next [d]iagnostic ')
map('<leader>ll', vim.lsp.codelens.run, '[l]ens run')
map('<leader>lR', vim.lsp.buf.rename, '[l]sp [R]ename')
map('<leader>lf', vim.lsp.buf.format, '[l]sp [f]ormat')
Expand Down Expand Up @@ -182,7 +182,7 @@ return {
flags = lsp_flags,
}

lspconfig.tsserver.setup {
lspconfig.ts_ls.setup {
capabilities = capabilities,
flags = lsp_flags,
filetypes = { 'js', 'javascript', 'typescript', 'ojs' },
Expand Down
2 changes: 1 addition & 1 deletion lua/plugins/notes.lua
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ return {

{
'epwalsh/obsidian.nvim',
enabled = false,
enabled = true,
ft = 'markdown',
event = {
-- If you want to use the home shortcut '~' here you need to call 'vim.fn.expand'.
Expand Down
3 changes: 2 additions & 1 deletion lua/plugins/quarto.lua
Original file line number Diff line number Diff line change
Expand Up @@ -127,12 +127,13 @@ return {

{
'benlubas/molten-nvim',
dev = true,
enabled = true,
build = ':UpdateRemotePlugins',
init = function()
vim.g.molten_image_provider = 'image.nvim'
vim.g.molten_output_win_max_height = 20
vim.g.molten_auto_open_output = false
vim.g.molten_auto_open_output = true
end,
keys = {
{ '<leader>mi', ':MoltenInit<cr>', desc = '[m]olten [i]nit' },
Expand Down

0 comments on commit 039f622

Please sign in to comment.