mirror of
https://github.com/elkowar/dots-of-war.git
synced 2024-12-25 13:42:23 +00:00
Epic use macro
This commit is contained in:
parent
c4e7ed4ee6
commit
5a5de804e3
6 changed files with 132 additions and 91 deletions
|
@ -1,4 +1,10 @@
|
||||||
{
|
{
|
||||||
"optOut": false,
|
"optOut": false,
|
||||||
"lastUpdateCheck": 1619802461034
|
"lastUpdateCheck": 1620514416532,
|
||||||
|
"update": {
|
||||||
|
"latest": "7.12.0",
|
||||||
|
"current": "6.14.12",
|
||||||
|
"type": "major",
|
||||||
|
"name": "npm"
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -23,47 +23,44 @@
|
||||||
(vim.cmd "filetype plugin indent on")
|
(vim.cmd "filetype plugin indent on")
|
||||||
(vim.cmd "syntax on")
|
(vim.cmd "syntax on")
|
||||||
|
|
||||||
(set vim.o.showmode false)
|
(se foldmethod "marker")
|
||||||
(set vim.o.foldmethod "marker")
|
(se showmode false)
|
||||||
(set vim.o.undodir (.. vim.env.HOME "/.vim/undo-dir"))
|
(se undodir (.. vim.env.HOME "/.vim/undo-dir"))
|
||||||
(set vim.o.undofile true)
|
(se undofile true)
|
||||||
(set vim.o.shortmess (.. vim.o.shortmess "c")) ; Don't give completion messages like 'match 1 of 2' or 'The only match'
|
(se shortmess (.. vim.o.shortmess "c")) ; Don't give completion messages like 'match 1 of 2' or 'The only match'
|
||||||
(set vim.o.hidden true)
|
(se hidden true)
|
||||||
(set vim.o.encoding "utf-8")
|
(se encoding "utf-8")
|
||||||
(set vim.o.number false)
|
(se number false)
|
||||||
(set vim.o.relativenumber false)
|
(se relativenumber false)
|
||||||
(set vim.o.compatible false)
|
(se compatible false)
|
||||||
(set vim.o.cursorline true)
|
(se cursorline true)
|
||||||
(set vim.o.incsearch true)
|
(se incsearch true)
|
||||||
(set vim.o.hlsearch true)
|
(se hlsearch true)
|
||||||
(set vim.o.inccommand "nosplit")
|
(se inccommand "nosplit")
|
||||||
(set vim.o.signcolumn "yes")
|
(se signcolumn "yes")
|
||||||
(set vim.o.shiftwidth 2)
|
(se shiftwidth 2)
|
||||||
(set vim.o.tabstop 2)
|
(se tabstop 2)
|
||||||
(set vim.o.backspace "indent,eol,start")
|
(se backspace "indent,eol,start")
|
||||||
(set vim.o.autoindent true)
|
(se autoindent true)
|
||||||
(set vim.o.smartindent true)
|
(se smartindent true)
|
||||||
(set vim.o.expandtab true)
|
(se expandtab true)
|
||||||
(set vim.o.wrap false)
|
(se wrap false)
|
||||||
(set vim.o.completeopt "longest,menuone,noselect")
|
(se completeopt "longest,menuone,noselect")
|
||||||
(set vim.o.laststatus 2)
|
(se laststatus 2)
|
||||||
(set vim.o.showmode true)
|
(se showmode true)
|
||||||
(set vim.o.splitbelow true)
|
(se splitbelow true)
|
||||||
(set vim.o.splitright true)
|
(se splitright true)
|
||||||
(set vim.o.mouse "a")
|
(se mouse "a")
|
||||||
(set vim.o.shell "bash")
|
(se shell "bash")
|
||||||
(set vim.o.background "dark")
|
(se background "dark")
|
||||||
|
|
||||||
(when (vim.fn.has "termguicolors")
|
(when (vim.fn.has "termguicolors")
|
||||||
(set vim.o.termguicolors true))
|
(se termguicolors true))
|
||||||
|
|
||||||
(when (not (vim.fn.has "gui_running"))
|
|
||||||
(set vim.o.t_Co 256))
|
|
||||||
|
|
||||||
(vim.cmd "colorscheme gruvbox")
|
(vim.cmd "colorscheme gruvbox")
|
||||||
(vim-let &t_ut "")
|
(vim-let &t_ut "")
|
||||||
|
|
||||||
(vim.cmd "autocmd! BufReadPost *.hs :set shiftwidth=2)")
|
(vim.cmd "autocmd! BufReadPost *.hs :set shiftwidth=2")
|
||||||
(vim.cmd "autocmd! FileType vim setlocal foldmethod=marker")
|
(vim.cmd "autocmd! FileType vim setlocal foldmethod=marker")
|
||||||
|
|
||||||
;Disables automatic commenting on newline)
|
;Disables automatic commenting on newline)
|
||||||
|
|
|
@ -1,59 +1,87 @@
|
||||||
{:augroup
|
{:augroup
|
||||||
(fn [name ...]
|
(fn [name ...]
|
||||||
`(do
|
`(do
|
||||||
(nvim.ex.augroup ,(tostring name))
|
(nvim.ex.augroup ,(tostring name))
|
||||||
(nvim.ex.autocmd_)
|
(nvim.ex.autocmd_)
|
||||||
,...
|
,...
|
||||||
(nvim.ex.augroup :END)))
|
(nvim.ex.augroup :END)))
|
||||||
|
|
||||||
:autocmd
|
:autocmd
|
||||||
(fn [...]
|
(fn [...]
|
||||||
`(nvim.ex.autocmd ,...))
|
`(nvim.ex.autocmd ,...))
|
||||||
|
|
||||||
:_:
|
:_:
|
||||||
(fn [name ...]
|
(fn [name ...]
|
||||||
`((. nvim.ex ,(tostring name)) ,...))
|
`((. nvim.ex ,(tostring name)) ,...))
|
||||||
|
|
||||||
:viml->fn
|
|
||||||
(fn [name]
|
|
||||||
`(.. "lua require('" *module-name* "')['" ,(tostring name) "']()"))
|
|
||||||
|
|
||||||
:dbg
|
|
||||||
(fn [x]
|
|
||||||
`(let [view# (. (require "aniseed.fennel") :view)]
|
|
||||||
(print (.. `,(tostring x) " => " (view# ,x)))
|
|
||||||
,x))
|
|
||||||
|
|
||||||
:dbg-call
|
|
||||||
(fn [x ...]
|
|
||||||
`(do
|
|
||||||
(a.println ,...)
|
|
||||||
(,x ,...)))
|
|
||||||
|
|
||||||
:pkg
|
|
||||||
(fn [name mappings ...]
|
|
||||||
`(if (~= nil (. packer_plugins `,(tostring name)))
|
|
||||||
(let ,mappings ,...)
|
|
||||||
(print (.. "plugin disabled " `,(tostring name)))))
|
|
||||||
|
|
||||||
:vim-let
|
|
||||||
(fn [field value]
|
|
||||||
(let [text (.. "let " `,(tostring field) "=\"" value "\"")]
|
|
||||||
`(vim.cmd ,text)))
|
|
||||||
|
|
||||||
:each-pair
|
|
||||||
(fn [args ...]
|
|
||||||
(let [[l# r# d#] args]
|
|
||||||
`(let [data# ,d#]
|
|
||||||
(for [i# 1 (a.count data#) 2]
|
|
||||||
(let [,l# (. data# i#)
|
|
||||||
,r# (. data# (+ i# 1))]
|
|
||||||
,...)))))}
|
|
||||||
|
|
||||||
|
:viml->fn
|
||||||
|
(fn [name]
|
||||||
|
`(.. "lua require('" *module-name* "')['" ,(tostring name) "']()"))
|
||||||
|
|
||||||
|
:dbg
|
||||||
|
(fn [x]
|
||||||
|
`(let [view# (. (require "aniseed.fennel") :view)]
|
||||||
|
(print (.. `,(tostring x) " => " (view# ,x)))
|
||||||
|
,x))
|
||||||
|
|
||||||
|
:dbg-call
|
||||||
|
(fn [x ...]
|
||||||
|
`(do
|
||||||
|
(a.println ,...)
|
||||||
|
(,x ,...)))
|
||||||
|
|
||||||
|
:pkg
|
||||||
|
(fn [name mappings ...]
|
||||||
|
`(if (~= nil (. packer_plugins `,(tostring name)))
|
||||||
|
(let ,mappings ,...)
|
||||||
|
(print (.. "plugin disabled " `,(tostring name)))))
|
||||||
|
|
||||||
|
:vim-let
|
||||||
|
(fn [field value]
|
||||||
|
(let [text (.. "let " `,(tostring field) "=\"" value "\"")]
|
||||||
|
`(vim.cmd ,text)))
|
||||||
|
|
||||||
|
:each-pair
|
||||||
|
(fn [args ...]
|
||||||
|
(let [[l# r# d#] args]
|
||||||
|
`(let [data# ,d#]
|
||||||
|
(for [i# 1 (a.count data#) 2]
|
||||||
|
(let [,l# (. data# i#)
|
||||||
|
,r# (. data# (+ i# 1))]
|
||||||
|
,...)))))
|
||||||
|
|
||||||
|
:use-macro
|
||||||
|
(fn [...]
|
||||||
|
(let [a (require "aniseed.core")
|
||||||
|
fennel (require "aniseed.fennel")
|
||||||
|
args [...]
|
||||||
|
use-statements []]
|
||||||
|
(for [i 1 (a.count args) 2]
|
||||||
|
(let [name (. args i)
|
||||||
|
block (. args (+ i 1))]
|
||||||
|
(a.assoc block 1 name)
|
||||||
|
(when (. block :mod)
|
||||||
|
(a.assoc block :config `#(require ,(. block :mod))))
|
||||||
|
(a.assoc block :mod nil)
|
||||||
|
(table.insert use-statements block)))
|
||||||
|
|
||||||
|
(let [use-sym (gensym)]
|
||||||
|
`(let [packer# (require "packer")]
|
||||||
|
(packer#.startup
|
||||||
|
(fn [,use-sym]
|
||||||
|
,(unpack
|
||||||
|
(icollect [_# v# (ipairs use-statements)]
|
||||||
|
`(,use-sym ,v#)))))))))
|
||||||
|
|
||||||
|
|
||||||
|
:se
|
||||||
|
(fn [name value]
|
||||||
|
(let [str-name (tostring name)
|
||||||
|
(info-ok scope) (pcall #(. (vim.api.nvim_get_option_info str-name) :scope))]
|
||||||
|
(if info-ok
|
||||||
|
(match scope
|
||||||
|
:global `(tset vim.o ,str-name ,value)
|
||||||
|
:win `(tset vim.wo ,str-name ,value)
|
||||||
|
:buf `(tset vim.bo ,str-name ,value)
|
||||||
|
_ (print (.. "option " str-name " has unhandled scope " scope)))
|
||||||
|
(print (.. "Unknown vim-option: " str-name)))))}
|
||||||
|
|
|
@ -1,8 +1,10 @@
|
||||||
(module plugins
|
(module plugins
|
||||||
{require {utils utils}})
|
{require {utils utils}
|
||||||
|
require-macros [macros]})
|
||||||
|
|
||||||
(utils.use
|
(use-macro
|
||||||
:nvim-telescope/telescope.nvim {:mod "plugins.telescope"
|
:nvim-telescope/telescope.nvim {:mod "plugins.telescope"
|
||||||
|
:cmd ["Telescope"]
|
||||||
:requires [:nvim-lua/popup.nvim :nvim-lua/plenary.nvim]}
|
:requires [:nvim-lua/popup.nvim :nvim-lua/plenary.nvim]}
|
||||||
|
|
||||||
:p00f/nvim-ts-rainbow {}
|
:p00f/nvim-ts-rainbow {}
|
||||||
|
|
|
@ -3,6 +3,8 @@
|
||||||
telescope telescope
|
telescope telescope
|
||||||
actions telescope.actions}})
|
actions telescope.actions}})
|
||||||
|
|
||||||
|
(print "initializing telescope")
|
||||||
|
|
||||||
(telescope.setup {})
|
(telescope.setup {})
|
||||||
|
|
||||||
(utils.keymap :n :<C-p> ":Telescope find_files<CR>")
|
(utils.keymap :n :<C-p> ":Telescope find_files<CR>")
|
||||||
|
|
|
@ -42,6 +42,12 @@
|
||||||
(nvim.buf_del_keymap 0 mode from)
|
(nvim.buf_del_keymap 0 mode from)
|
||||||
(nvim.del_keymap mode from)))
|
(nvim.del_keymap mode from)))
|
||||||
|
|
||||||
|
(defn pairs->tuples [xs]
|
||||||
|
(let [result []]
|
||||||
|
(each-pair [l r xs]
|
||||||
|
(table.insert result (values l r)))
|
||||||
|
result))
|
||||||
|
|
||||||
(defn- safe-require-plugin-config [name]
|
(defn- safe-require-plugin-config [name]
|
||||||
(xpcall
|
(xpcall
|
||||||
#(require name)
|
#(require name)
|
||||||
|
|
Loading…
Reference in a new issue