diff --git a/fnl/prelude.fnl b/fnl/prelude.fnl index 104fcd7..03979c1 100644 --- a/fnl/prelude.fnl +++ b/fnl/prelude.fnl @@ -28,6 +28,7 @@ (set vim.g.maplocalleader ",") (let [map vim.keymap.set + cmd (fn [c] (.. : c :)) opts {:noremap true :silent true} N [[: ":lua vim.cmd('doautocmd User TriggerLeader')"] [";" ":"] @@ -37,8 +38,12 @@ ;; normal mode keymaps (each [_ K (ipairs N)] (map :n (. K 1) (. K 2) (or (. K 3) opts))) + ;; visual mode keymaps (each [_ K (ipairs V)] - (map :v (. K 1) (. K 2) (or (. K 3) opts)))) + (map :v (. K 1) (. K 2) (or (. K 3) opts))) + ;; term toggle keymaps + (for [i 0 9] + (map [:n :t :i] (.. :") (cmd (.. "TermToggle " i)) opts))) ;; user events (var specificFileEnterAutoCmd nil) diff --git a/lua/autogen/prelude.lua b/lua/autogen/prelude.lua index 1592417..88988ce 100644 --- a/lua/autogen/prelude.lua +++ b/lua/autogen/prelude.lua @@ -1,6 +1,6 @@ -- [nfnl] Compiled from fnl/prelude.fnl by https://github.com/Olical/nfnl, do not edit. do - local opts = {langmenu = "none", shortmess = (vim.o.shortmess .. "sWIcCS"), cmdheight = 0, termguicolors = true, signcolumn = "no", showtabline = 0, laststatus = 0, foldlevel = 99, foldlevelstart = 99, showmode = false, number = false} + local opts = {langmenu = "none", shortmess = (vim.o.shortmess .. "sWIcCS"), cmdheight = 0, termguicolors = true, signcolumn = "no", showtabline = 0, laststatus = 0, foldlevel = 99, foldlevelstart = 99, number = false, showmode = false} vim.loader.enable() for k, v in pairs(opts) do vim.o[k] = v @@ -10,6 +10,11 @@ vim.g.mapleader = " " vim.g.maplocalleader = "," do local map = vim.keymap.set + local cmd + local function _1_(c) + return ("" .. c .. "") + end + cmd = _1_ local opts = {noremap = true, silent = true} local N = {{"", ":lua vim.cmd('doautocmd User TriggerLeader')"}, {";", ":"}} local V = {{";", ":"}} @@ -19,13 +24,16 @@ do for _, K in ipairs(V) do map("v", K[1], K[2], (K[3] or opts)) end + for i = 0, 9 do + map({"n", "t", "i"}, (""), cmd(("TermToggle " .. i)), opts) + end end local specificFileEnterAutoCmd = nil local A = vim.api local gen = A.nvim_create_autocmd local exec = A.nvim_exec_autocmds local del = A.nvim_del_autocmd -local function _1_() +local function _2_() if (vim.bo.filetype ~= "") then exec("User", {pattern = "SpecificFileEnter"}) return del(specificFileEnterAutoCmd) @@ -33,5 +41,5 @@ local function _1_() return nil end end -specificFileEnterAutoCmd = gen("FileType", {callback = _1_}) +specificFileEnterAutoCmd = gen("FileType", {callback = _2_}) return nil