Small fixes

This commit is contained in:
2022-08-24 02:32:50 +02:00
parent 623b7fb584
commit 029f385a41
3 changed files with 10 additions and 29 deletions

View File

@@ -7,8 +7,8 @@
:hiddenFalsePositives (.. (vim.fn.stdpath "config") "/spell/false.txt")}) :hiddenFalsePositives (.. (vim.fn.stdpath "config") "/spell/false.txt")})
(fn file_exists [file] (let [f (io.open file "rb")] (fn file_exists [file] (let [f (io.open file "rb")]
(match f nil (do (f.close f) false) (match f nil false
_ true))) _ (do (f.close f) true))))
(fn lines_from [file] (match (file_exists file) false [] (fn lines_from [file] (match (file_exists file) false []
true (let [lines []] true (let [lines []]

View File

@@ -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 "<cmd>lua require('%s').apply_function(%s)<CR>" 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

View File

@@ -120,12 +120,14 @@
:open_automatic true :open_automatic true
:placement_editor_edge true :placement_editor_edge true
:width 30 :width 30
:on_attach (fn [bufnr] (vim.api.nvim_buf_set_keymap bufnr "n" "t" :on_attach (fn [bufnr]
((. (require :map_utils) :lua_fn) (fn [] (vim.tbl_map (fn [buf] (if (= (vim.api.nvim_buf_get_option buf "filetype") "aerial") (map! [n :buffer] :t (fn []
(vim.tbl_map (fn [win] (vim.api.nvim_set_current_win win)) (vim.tbl_map (fn [buf]
(vim.fn.win_findbuf buf)))) (if (= (vim.api.nvim_buf_get_option buf "filetype") "aerial")
(vim.api.nvim_list_bufs)))) (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) (setup :guess-indent)