This commit is contained in:
elkowar 2021-05-01 15:20:02 +02:00
parent bfd8def726
commit 8a70637173
7 changed files with 65 additions and 25 deletions

View file

@ -2,6 +2,7 @@
{require {a aniseed.core
fennel aniseed.fennel
nvim aniseed.nvim
str aniseed.string
kb keybinds
utils utils
nvim-treesitter-configs nvim-treesitter.configs
@ -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 :<Space> :i)

View file

@ -8,7 +8,7 @@
require-macros [macros]})
(utils.keymap :i :<C-Space> "compe#complete()" {:expr true})
(utils.keymap :i :<C-Space> "call compe#complete()" {:expr true})
(utils.keymap :i :<esc> "compe#close('<esc>')" {:expr true})

View file

@ -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 ,...)))}

View file

@ -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)))

View file

@ -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)))

View file

@ -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

View file

@ -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"