From c41f25fa0d1c882d3dd484d10666b5341dec5c92 Mon Sep 17 00:00:00 2001 From: Gustaf Rydholm Date: Fri, 13 Jan 2023 01:49:50 +0100 Subject: Refactor --- fnl/plugins/lsp/keymaps.fnl | 5 +---- fnl/settings/autocmds.fnl | 5 +---- fnl/settings/keymaps.fnl | 5 +---- fnl/settings/usercmds.fnl | 5 +---- 4 files changed, 4 insertions(+), 16 deletions(-) diff --git a/fnl/plugins/lsp/keymaps.fnl b/fnl/plugins/lsp/keymaps.fnl index 9b95140..cd62073 100644 --- a/fnl/plugins/lsp/keymaps.fnl +++ b/fnl/plugins/lsp/keymaps.fnl @@ -10,12 +10,9 @@ [:n :gl "lua vim.diagnostic.open_float()"] [:n :gs "lua vim.lsp.buf.signature_help()"]]) -(fn buf-set-keymap [bufnr mode key cmd opts] - (vim.api.nvim_buf_set_keymap bufnr mode key cmd opts)) - (fn on-attach [bufnr] (each [_ mapping (ipairs mappings)] (match mapping - [mode key cmd] (buf-set-keymap bufnr mode key cmd opts)))) + [mode key cmd] (vim.api.nvim_buf_set_keymap bufnr mode key cmd opts)))) {: on-attach} diff --git a/fnl/settings/autocmds.fnl b/fnl/settings/autocmds.fnl index ca361b3..cd3a27e 100644 --- a/fnl/settings/autocmds.fnl +++ b/fnl/settings/autocmds.fnl @@ -1,8 +1,5 @@ ;; Autocommands for nvim. -(fn create-autocmd [event opts] - (vim.api.nvim_create_autocmd event opts)) - (local autocmds [[:FileType {:pattern [:qf :help :man :lspinfo :spectre_panel] @@ -38,4 +35,4 @@ (each [_ autocmd (ipairs autocmds)] (match autocmd - [event opts] (create-autocmd event opts))) + [event opts] (vim.api.nvim_create_autocmd event opts))) diff --git a/fnl/settings/keymaps.fnl b/fnl/settings/keymaps.fnl index b59f68f..04073c8 100644 --- a/fnl/settings/keymaps.fnl +++ b/fnl/settings/keymaps.fnl @@ -1,8 +1,5 @@ ;; Custom keymappings. -(fn map [mode lhs rhs opt] - (vim.api.nvim_set_keymap mode lhs rhs opt)) - (local opts {:noremap true :silent true}) (local mappings [;;Remap space as leader key @@ -48,4 +45,4 @@ (each [_ mapping (ipairs mappings)] (match mapping - [mode key cmd] (map mode key cmd opts))) + [mode key cmd] (vim.api.nvim_set_keymap mode key cmd opts))) diff --git a/fnl/settings/usercmds.fnl b/fnl/settings/usercmds.fnl index 14020af..002e1b2 100644 --- a/fnl/settings/usercmds.fnl +++ b/fnl/settings/usercmds.fnl @@ -6,9 +6,6 @@ theme (. opts :theme)] ((. telescope builtin) ((. themes theme) opts)))) -(fn create-usercmd [event cmd opts] - (vim.api.nvim_create_user_command event cmd opts)) - (local usercmds [[:OrgAgendaPrompt (lambda [] (let [orgmode (require :orgmode)] @@ -87,4 +84,4 @@ (each [_ usercmd (ipairs usercmds)] (match usercmd - [event cmd opts] (create-usercmd event cmd opts))) + [event cmd opts] (vim.api.nvim_create_user_command event cmd opts))) -- cgit v1.2.3-70-g09d2