From 029f385a418f086770bbd5c53127c4e7d3b6517f Mon Sep 17 00:00:00 2001 From: Pierre Jeanjean Date: Wed, 24 Aug 2022 02:32:50 +0200 Subject: [PATCH] Small fixes --- .config/nvim/fnl/lspconfig/ltex.fnl | 4 ++-- .config/nvim/fnl/map_utils.fnl | 21 --------------------- .config/nvim/fnl/settings.fnl | 14 ++++++++------ 3 files changed, 10 insertions(+), 29 deletions(-) delete mode 100644 .config/nvim/fnl/map_utils.fnl diff --git a/.config/nvim/fnl/lspconfig/ltex.fnl b/.config/nvim/fnl/lspconfig/ltex.fnl index 35ef153..efae5b7 100644 --- a/.config/nvim/fnl/lspconfig/ltex.fnl +++ b/.config/nvim/fnl/lspconfig/ltex.fnl @@ -7,8 +7,8 @@ :hiddenFalsePositives (.. (vim.fn.stdpath "config") "/spell/false.txt")}) (fn file_exists [file] (let [f (io.open file "rb")] - (match f nil (do (f.close f) false) - _ true))) + (match f nil false + _ (do (f.close f) true)))) (fn lines_from [file] (match (file_exists file) false [] true (let [lines []] diff --git a/.config/nvim/fnl/map_utils.fnl b/.config/nvim/fnl/map_utils.fnl deleted file mode 100644 index a4987b3..0000000 --- a/.config/nvim/fnl/map_utils.fnl +++ /dev/null @@ -1,21 +0,0 @@ -(local M {}) -(local module_name "map_utils") -(local fn_store []) - -(fn register_fn [new_fn] - (do (table.insert fn_store new_fn) - (length fn_store))) - -(fn M.apply_function [id] - ((. fn_store id))) - -(fn M.apply_expr [id] - (vim.api.nvim_replace_termcodes ((. fn_store id)) true true true)) - -(fn M.lua_fn [lfn] - (string.format "lua require('%s').apply_function(%s)" module_name (register_fn lfn))) - -(fn M.lua_expr [lfn] - (string.format "v:lua.require'%s'.apply_expr(%s)" module_name (register_fn lfn))) - -M diff --git a/.config/nvim/fnl/settings.fnl b/.config/nvim/fnl/settings.fnl index 93d761d..172edc5 100644 --- a/.config/nvim/fnl/settings.fnl +++ b/.config/nvim/fnl/settings.fnl @@ -120,12 +120,14 @@ :open_automatic true :placement_editor_edge true :width 30 - :on_attach (fn [bufnr] (vim.api.nvim_buf_set_keymap bufnr "n" "t" - ((. (require :map_utils) :lua_fn) (fn [] (vim.tbl_map (fn [buf] (if (= (vim.api.nvim_buf_get_option buf "filetype") "aerial") - (vim.tbl_map (fn [win] (vim.api.nvim_set_current_win win)) - (vim.fn.win_findbuf buf)))) - (vim.api.nvim_list_bufs)))) - {}))}) + :on_attach (fn [bufnr] + (map! [n :buffer] :t (fn [] + (vim.tbl_map (fn [buf] + (if (= (vim.api.nvim_buf_get_option buf "filetype") "aerial") + (vim.tbl_map (fn [win] + (vim.api.nvim_set_current_win win)) + (vim.fn.win_findbuf buf)))) + (vim.api.nvim_list_bufs)))))}) (setup :guess-indent)