From a07cea1de3f964da245874fb2f18969df6ef4ce6 Mon Sep 17 00:00:00 2001 From: aktersnurra Date: Sat, 30 Apr 2022 18:42:38 +0200 Subject: fix: renmae ncomment --- fnl/config/comment.fnl | 28 ++++++++++++++++++++++++++++ fnl/config/init.fnl | 2 +- fnl/config/ncomment.fnl | 28 ---------------------------- 3 files changed, 29 insertions(+), 29 deletions(-) create mode 100644 fnl/config/comment.fnl delete mode 100644 fnl/config/ncomment.fnl (limited to 'fnl/config') diff --git a/fnl/config/comment.fnl b/fnl/config/comment.fnl new file mode 100644 index 0000000..92df966 --- /dev/null +++ b/fnl/config/comment.fnl @@ -0,0 +1,28 @@ +;; Language aware commenting. +(module config.comment + {autoload {util util}}) + +(defn- get-type [ctx U] + (if (= ctx.ctype U.ctype.line) + :__default + :__multiline)) + +(defn- get-location [ctx U] + (let [utils (require :ts_context_commentstring.utils)] + (if (= ctx.ctype U.ctype.block) + (utils.get_cursor_location) + (or (= ctx.cmotion U.cmotion.v) (= ctx.cmotion U.cmotion.V)) + (utils.get_visual_start_location) + nil))) + +(defn- pre-hook [ctx] + (let [U (require :Comment.utils) + internal (require :ts_context_commentstring.internal)] + (internal.calculate_commentstring + {:key (get-type ctx U) + :location (get-location ctx U)}))) + +(let [nvim-comment (util.load-plugin :Comment)] + (nvim-comment.setup + {:pre_hook (fn [ctx] + (pre-hook ctx))})) diff --git a/fnl/config/init.fnl b/fnl/config/init.fnl index be81549..7013719 100644 --- a/fnl/config/init.fnl +++ b/fnl/config/init.fnl @@ -13,7 +13,7 @@ config.gitsigns config.hop config.lualine - config.ncomment + config.comment config.nvim-tree config.orgmode config.project diff --git a/fnl/config/ncomment.fnl b/fnl/config/ncomment.fnl deleted file mode 100644 index e6a77d1..0000000 --- a/fnl/config/ncomment.fnl +++ /dev/null @@ -1,28 +0,0 @@ -;; Language aware commenting. -(module config.ncomment - {autoload {util util}}) - -(defn- get-type [ctx U] - (if (= ctx.ctype U.ctype.line) - :__default - :__multiline)) - -(defn- get-location [ctx U] - (let [utils (require :ts_context_commentstring.utils)] - (if (= ctx.ctype U.ctype.block) - (utils.get_cursor_location) - (or (= ctx.cmotion U.cmotion.v) (= ctx.cmotion U.cmotion.V)) - (utils.get_visual_start_location) - nil))) - -(defn- pre-hook [ctx] - (let [U (require :Comment.utils) - internal (require :ts_context_commentstring.internal)] - (internal.calculate_commentstring - {:key (get-type ctx U) - :location (get-location ctx U)}))) - -(let [ncomment (util.load-plugin :Comment)] - (ncomment.setup - {:pre_hook (fn [ctx] - (pre-hook ctx))})) -- cgit v1.2.3-70-g09d2