From 8a70637173d2ac4682386e4dcd00ca9109c97da6 Mon Sep 17 00:00:00 2001 From: elkowar <5300871+elkowar@users.noreply.github.com> Date: Sat, 1 May 2021 15:20:02 +0200 Subject: [PATCH] asdf --- files/.config/nvim/fnl/init.fnl | 25 +++++++++++-------- files/.config/nvim/fnl/keybinds.fnl | 2 +- files/.config/nvim/fnl/macros.fnl | 9 ++++++- files/.config/nvim/fnl/plugins/galaxyline.fnl | 6 ++--- files/.config/nvim/fnl/utils.fnl | 19 ++++++++------ files/.config/nvim/init.vim | 25 ++++++++++++++++++- files/.config/nvim/plugins.lua | 4 +-- 7 files changed, 65 insertions(+), 25 deletions(-) diff --git a/files/.config/nvim/fnl/init.fnl b/files/.config/nvim/fnl/init.fnl index dacf1b5..7d6b9a2 100644 --- a/files/.config/nvim/fnl/init.fnl +++ b/files/.config/nvim/fnl/init.fnl @@ -1,13 +1,14 @@ (module init {require {a aniseed.core - fennel aniseed.fennel - nvim aniseed.nvim - kb keybinds + fennel aniseed.fennel + nvim aniseed.nvim + str aniseed.string + kb keybinds utils utils nvim-treesitter-configs nvim-treesitter.configs gitsigns gitsigns} - ;nvim-biscuits nvim-biscuits} - require-macros [macros]}) + ;nvim-biscuits nvim-biscuits} + require-macros [macros]}) (require "plugins.telescope") (require "plugins.lsp") @@ -16,9 +17,11 @@ (local colors (utils.colors)) + + ;(set nvim.g.conjure#client#fennel#aniseed#aniseed_module_prefix "aniseed.") - +; Treesitter ------------------------------------------------------- <<<<< (nvim-treesitter-configs.setup { :ensure_installed "all" :highlight { :enable true @@ -43,6 +46,7 @@ ;(nvim-biscuits.setup {} ;{ :on_events ["InsertLeave" "CursorHoldI"]}) +; >>>>> ; gitsigns.nvim ------------------------------------------------------- <<<<< ; https://github.com/lewis6991/gitsigns.nvim @@ -53,9 +57,9 @@ :topdelete {:text "▍"} :changedelete {:text "▍"}} :keymaps { :noremap true - :buffer (do (a.println "TESTTESTTEST") - true)} - :current_line_blame false}) + :buffer true} + :current_line_blame true + :update_debounce 100}) (utils.highlight "GitSignsAdd" {:bg "NONE" :fg colors.bright_aqua}) (utils.highlight "GitSignsDelete" {:bg "NONE" :fg colors.neutral_red}) @@ -64,7 +68,8 @@ ; >>>>> -; " :: and _ as space ------------------------------------------------------------------- <<<<<}) + +; " :: and _ as space ------------------------------------------------------------------- <<<<< (var remapped-space nil) (fn _G.RebindShit [newKey] (set remapped-space {:old (vim.fn.maparg : :i) diff --git a/files/.config/nvim/fnl/keybinds.fnl b/files/.config/nvim/fnl/keybinds.fnl index 3efb10d..0c26830 100644 --- a/files/.config/nvim/fnl/keybinds.fnl +++ b/files/.config/nvim/fnl/keybinds.fnl @@ -8,7 +8,7 @@ require-macros [macros]}) -(utils.keymap :i : "compe#complete()" {:expr true}) +(utils.keymap :i : "call compe#complete()" {:expr true}) (utils.keymap :i : "compe#close('')" {:expr true}) diff --git a/files/.config/nvim/fnl/macros.fnl b/files/.config/nvim/fnl/macros.fnl index 2d6d553..dc4f680 100644 --- a/files/.config/nvim/fnl/macros.fnl +++ b/files/.config/nvim/fnl/macros.fnl @@ -16,4 +16,11 @@ :viml->fn (fn [name] - `(.. "lua require('" *module-name* "')['" ,(tostring name) "']()"))} + `(.. "lua require('" *module-name* "')['" ,(tostring name) "']()")) + + :dbg-call + (fn [x ...] + `(do + (a.println ,...) + (,x ,...)))} + diff --git a/files/.config/nvim/fnl/plugins/galaxyline.fnl b/files/.config/nvim/fnl/plugins/galaxyline.fnl index 86685bc..41480e0 100644 --- a/files/.config/nvim/fnl/plugins/galaxyline.fnl +++ b/files/.config/nvim/fnl/plugins/galaxyline.fnl @@ -34,13 +34,13 @@ "" { :text "VISUAL BLOCK" :colors { :bg colors.neutral_blue :fg colors.dark0}}}) -(fn buf-empty? [] - (= 1 (nvim.fn.empty (nvim.fn.expand "%:t")))) +(fn buf-name-empty? [] + (a.empty? (nvim.fn.expand "%:t"))) (fn get-current-file-name [] (let [file (nvim.fn.expand "%:t")] (if - (= 1 (nvim.fn.empty file)) "" + (a.empty? file) "" nvim.bo.readonly (.. "RO " file) (and nvim.bo.modifiable nvim.bo.modified) (.. file " ") file))) diff --git a/files/.config/nvim/fnl/utils.fnl b/files/.config/nvim/fnl/utils.fnl index 6a7928e..eb23e5d 100644 --- a/files/.config/nvim/fnl/utils.fnl +++ b/files/.config/nvim/fnl/utils.fnl @@ -1,19 +1,25 @@ (module utils {require {a aniseed.core - nvim aniseed.nvim - fun fun} + fennel aniseed.fennel + nvim aniseed.nvim} require-macros [macros]}) (defn dbg [x] - (a.pr x) + (a.println (fennel.view x)) x) + (defn contains? [list elem] - (fun.any #(= elem $1) list)) + (or (a.some #(= elem $1) list)) false) + +(defn filter-table [f t] + (collect [k v (pairs t)] + (when (f k v) + (values k v)))) (defn without-keys [keys t] - (fun.filter #(not (contains? keys $1)) t)) + (filter-table #(not (contains? keys $1)) t)) (defn keymap [mode from to ?opts] "Set a mapping in the given mode, and some optional parameters, defaulting to {:noremap true :silent true}. @@ -21,8 +27,7 @@ (local full-opts (->> (or ?opts {}) (a.merge {:noremap true :silent true}) - (without-keys [:buffer]) - fun.tomap)) + (without-keys [:buffer]))) (if (and ?opts (?. ?opts :buffer)) (nvim.buf_set_keymap 0 mode from to full-opts) (nvim.set_keymap mode from to full-opts))) diff --git a/files/.config/nvim/init.vim b/files/.config/nvim/init.vim index b24b6c5..fae9748 100644 --- a/files/.config/nvim/init.vim +++ b/files/.config/nvim/init.vim @@ -140,6 +140,29 @@ endfunction autocmd BufCreate * execute 'call CleanNoNameEmptyBuffers()' +" this nearly works, and does the same + +" ; autoclose empty unedited buffers +" (fn _G.clean_no_name_empty_buffers [] +" (local bufs +" (a.filter +" #(and +" (vim.api.nvim_buf_get_option $1 "buflisted") +" (a.empty? (vim.fn.bufname $1)) +" (< (vim.fn.bufwinnr $1) 0) +" (vim.api.nvim_buf_is_loaded $1)) +" ;(do (utils.dbg (.. (fennel.view $1) " -> " (fennel.view (vim.api.nvim_buf_is_loaded $1))) true))) +" ;(a.empty? (vim.api.nvim_buf_get_lines $1 1 (vim.api.nvim_buf_line_count $1) false))) +" (vim.fn.range 1 (vim.fn.bufnr "$")))) +" (when (not (a.empty? bufs)) +" (nvim.command (.. "bd " (str.join " " bufs))))) +" +" (nvim.command "autocmd! BufCreate * :call v:lua.clean_no_name_empty_buffers()") +" +" ; autocmd BufCreate * execute 'call CleanNoNameEmptyBuffers()' + + + " =============== @@ -174,7 +197,7 @@ let g:detectindent_preferred_indent = 2 autocmd BufReadPost *.hs :set shiftwidth=2 -let g:vim_parinfer_filetypes = ['carp'] +let g:vim_parinfer_filetypes = ['carp', 'fennel'] let g:sneak#label = 1 diff --git a/files/.config/nvim/plugins.lua b/files/.config/nvim/plugins.lua index 7fe5c39..943ac57 100644 --- a/files/.config/nvim/plugins.lua +++ b/files/.config/nvim/plugins.lua @@ -13,7 +13,7 @@ vim.cmd [[packadd packer.nvim]] require("packer").startup(function(use) - use_rocks "rtsisyk/fun" + --use_rocks "rtsisyk/fun" use 'pwntester/octo.nvim' @@ -59,7 +59,7 @@ require("packer").startup(function(use) cmd = "Goyo", } - use "mhinz/vim-signify" + --use "mhinz/vim-signify" use "lewis6991/gitsigns.nvim" use "tpope/vim-fugitive"