Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
jmbuhr committed Jan 9, 2024
1 parent a6c5aba commit d2c3036
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 36 deletions.
32 changes: 0 additions & 32 deletions ftplugin/quarto.lua
Original file line number Diff line number Diff line change
Expand Up @@ -10,35 +10,3 @@ vim.wo.showbreak = "|"
-- don't run vim ftplugin on top
vim.api.nvim_buf_set_var(0, "did_ftplugin", true)


local nmap = function(key, effect)
vim.keymap.set("n", key, effect, { silent = true, noremap = true })
end

local vmap = function(key, effect)
vim.keymap.set("v", key, effect, { silent = true, noremap = true })
end

local imap = function(key, effect)
vim.keymap.set("i", key, effect, { silent = true, noremap = true })
end

local runner = require'quarto.runner'

-- runner.run_cell,
-- runner.run_above,
-- runner.run_below, {})
-- runner.run_all, {})
-- runner.run_range, { range = 2 })
-- runner.run_line, {})

-- send code with ctrl+Enter
-- just like in e.g. RStudio
-- needs kitty (or other terminal) config:
-- map shift+enter send_text all \x1b[13;2u
-- map ctrl+enter send_text all \x1b[13;5u
nmap("<c-cr>", runner.run_cell)
nmap("<s-cr>", runner.run_cell)
imap("<c-cr>", runner.run_cell)
imap("<s-cr>", runner.run_cell)
vmap("<cr>", runner.run_range)
15 changes: 11 additions & 4 deletions lua/config/keymap.lua
Original file line number Diff line number Diff line change
Expand Up @@ -172,8 +172,9 @@ wk.register({
h = { ":QuartoHelp ", "help" },
r = {
name = "run",
r = { ":QuartoSendAbove<cr>", "to cursor" },
a = { ":QuartoSendAll<cr>", "all" },
a = { ":QuartoSendAbove<cr>", "above" },
b = { ":QuartoSendBelow<cr>", "below" },
A = { ":QuartoSendAll<cr>", "All" },
},
e = { ":lua require'otter'.export()<cr>", "export" },
E = { ":lua require'otter'.export(true)<cr>", "export overwrite" },
Expand Down Expand Up @@ -306,7 +307,14 @@ wk.register({
["<M-j>"] = { ":m'>+<cr>`<my`>mzgv`yo`z", "move line down" },
["<M-k>"] = { ":m'<-2<cr>`>my`<mzgv`yo`z", "move line up" },
["."] = { ":norm .<cr>", "repat last normal mode command" },
["q"] = { ":norm @q<cr>", "repat q macro" },
["@"] = { ":norm @q<cr>", "repat q macro" },
q = {
name = "quarto",
r = {
name = "run",
R = { ":QuartoSendRange<cr>", "All" },
},
},
}, { mode = "v" })

wk.register({
Expand All @@ -324,4 +332,3 @@ wk.register({
["<m-I>"] = { insert_py_chunk, "python code chunk" },
["<c-x><c-x>"] = { "<c-x><c-o>", "omnifunc completion" },
}, { mode = "i" })

0 comments on commit d2c3036

Please sign in to comment.