summaryrefslogtreecommitdiff
path: root/nvim
diff options
context:
space:
mode:
authorJosh <joshott16@gmail.com>2025-07-22 13:17:40 -0400
committerJosh <joshott16@gmail.com>2025-07-22 13:17:40 -0400
commit795287e3ec351def221f9b44d358a182062e203a (patch)
tree865b52db0b2fb2392dafd0828440ea4492481b35 /nvim
parent2feea510cb508d22345f3f6d3fc085613fccd6ac (diff)
downloaddotfiles-795287e3ec351def221f9b44d358a182062e203a.tar.gz
dotfiles-795287e3ec351def221f9b44d358a182062e203a.zip
toggleterm config + misc stuff
Diffstat (limited to 'nvim')
-rw-r--r--nvim/after/plugin/mini.lua11
-rw-r--r--nvim/after/plugin/toggleterm.lua47
-rw-r--r--nvim/lua/commands.lua18
3 files changed, 76 insertions, 0 deletions
diff --git a/nvim/after/plugin/mini.lua b/nvim/after/plugin/mini.lua
new file mode 100644
index 0000000..92e42b4
--- /dev/null
+++ b/nvim/after/plugin/mini.lua
@@ -0,0 +1,11 @@
+require('mini.files').setup({
+ mappings = {
+ close = '<C-c>',
+ go_in = '<Right>',
+ go_in_plus = '<S-Right>',
+ go_out = '<Left>',
+ go_out_plus = '<S-Left>',
+ },
+})
+
+require('mini.trailspace').setup()
diff --git a/nvim/after/plugin/toggleterm.lua b/nvim/after/plugin/toggleterm.lua
new file mode 100644
index 0000000..61742f6
--- /dev/null
+++ b/nvim/after/plugin/toggleterm.lua
@@ -0,0 +1,47 @@
+local Terminal = require('toggleterm.terminal').Terminal
+
+-- lazygit
+local lazygit = Terminal:new({
+ cmd = 'lazygit',
+ display_name = 'lazygit',
+ dir = 'git_dir',
+ hidden = true,
+ direction = 'float',
+ winbar = { enabled = false, },
+ float_opts = {
+ border = 'rounded',
+ }
+})
+
+function _lazygit_toggle()
+ lazygit:toggle()
+end
+
+-- julia
+local jlrepl = Terminal:new({
+ cmd = 'julia',
+ on_open = function()
+ local key = vim.api.nvim_replace_termcodes([[<C-\><C-n><C-w><C-p>]], true, false, true)
+ vim.api.nvim_feedkeys(key, 'n', false)
+ vim.keymap.set('n', '<leader>jr', '<cmd>lua _jlrepl_exec()<CR>', { noremap = true, silent = true })
+ end,
+ on_close = function()
+ vim.keymap.set('n', '<leader>jr', '<Nop>')
+ end,
+})
+
+function _jlrepl_exec()
+ jlrepl:send(string.format('include("%s")', vim.fn.expand('%:p')), true)
+end
+
+function _jlrepl_open()
+ if not jlrepl:is_open() then
+ jlrepl:open()
+ end
+end
+
+-- repl send
+local trim_spaces = true
+vim.keymap.set("v", "<space>s", function()
+ require("toggleterm").send_lines_to_terminal("single_line", trim_spaces, { args = vim.v.count })
+end)
diff --git a/nvim/lua/commands.lua b/nvim/lua/commands.lua
index 8714158..aea15ca 100644
--- a/nvim/lua/commands.lua
+++ b/nvim/lua/commands.lua
@@ -8,3 +8,21 @@ vim.api.nvim_create_autocmd("ColorScheme", {
}
end,
})
+
+vim.api.nvim_create_autocmd({'BufEnter', 'BufWinEnter'}, {
+ pattern = '*.jl',
+ callback = function(ev)
+ vim.keymap.set('n', '<leader>js', '<cmd>lua _jlrepl_open()<CR>', { noremap = true, silent = true , buffer = true })
+ end
+})
+
+vim.api.nvim_create_autocmd({'BufEnter', 'BufWinEnter'}, {
+ pattern = '*.tex',
+ callback = function(ev)
+ vim.keymap.set('i', '<C-f>', [[<Esc>: silent exec '.!inkscape-figures create "'.getline('.').'" "'.b:vimtex.root.'/figures/"'<CR><CR>:w<CR>]], { buffer = true})
+ vim.keymap.set('n', '<C-f>', [[: silent exec '!inkscape-figures edit "'.b:vimtex.root.'/figures/" > /dev/null 2>&1 &'<CR><CR>:redraw!<CR>]], { buffer = true})
+
+ vim.keymap.set('i', '<C-x>', [[<Esc>: silent exec '.!xoppdog shake "'.getline('.').'" "'.b:vimtex.root.'/figures/"'<CR><CR>:w<CR>]], { buffer = true})
+ vim.keymap.set('n', '<C-x>', [[: silent exec '!xoppdog fetch "'.b:vimtex.root.'/figures/" > /dev/null 2>&1 &'<CR><CR>:redraw!<CR>]], { buffer = true})
+ end
+})