1
0
Fork 0

nvim: Macros!

This commit is contained in:
Daniel Kempkens 2022-05-12 21:49:19 +02:00
parent dd34dc2c87
commit 5df13cf7c8
3 changed files with 34 additions and 17 deletions

View file

@ -0,0 +1,12 @@
(let [mod {}]
(fn mod.colorscheme [name]
`(vim.api.nvim_cmd {:cmd :colorscheme :args [,name]} []))
(fn mod.highlight [name value]
`(vim.api.nvim_set_hl 0 ,name ,value))
(fn mod.highlight-link [src dst]
`(vim.api.nvim_cmd {:cmd :highlight :args [:link ,src ,dst]} []))
mod)

View file

@ -1,19 +1,15 @@
(import-macros {: colorscheme : highlight : highlight-link} :../macros/cmd)
(let [mod {}
o vim.opt
g vim.g
cmd vim.cmd
dracula (require :dracula)
dracula-colors (dracula.colors)
highlight (partial vim.api.nvim_set_hl 0)]
(fn highlight-link [src dst]
(let [cmd-str (.. "highlight link " src " " dst)]
(cmd cmd-str)))
dracula-colors (dracula.colors)]
(fn mod.setup []
(set g.dracula_show_end_of_buffer false)
(set g.dracula_italic_comment true)
(set o.background :dark)
(cmd "colorscheme dracula")
(colorscheme :dracula)
;; vim-matchup
(highlight :MatchParen {:fg dracula-colors.orange :bold true :italic true})
(highlight :MatchWord {:italic true})

View file

@ -315,10 +315,16 @@ in
mkdir -p $out/lua/nifoc/utils
mkdir -p $out/after/ftplugin
fennel="fennel --use-bit-lib --compile"
config_store_path="${../../config/nvim}"
fennel="fennel --use-bit-lib --compile"
echo "Using fennel command: $fennel"
# Change PWD to config directory
cd "$config_store_path"
# Init
echo "Compiling init.fnl ..."
$fennel "$config_store_path/init.fnl" > "$out/lua/configuration/init.lua"
# Utils
@ -332,14 +338,6 @@ in
$fennel "$fnlfile" > "$out/lua/nifoc/$file_out_path"
done
# Plugins
cat <<EOF >>plugins.fnl
${config.programs.neovim.generatedConfigs.fennel}
nil
EOF
$fennel "./plugins.fnl" > "$out/lua/configuration/plugins.lua"
# After
after_store_path="$config_store_path/after"
after_store_fnl="$(find "$after_store_path" -type f -name '*.fnl')"
@ -351,6 +349,17 @@ in
$fennel "$fnlfile" > "$out/after/$file_out_path"
done
# Plugins
echo "Compiling plugin configuration ..."
{
cat <<EOF
${config.programs.neovim.generatedConfigs.fennel}
nil
EOF
} | $fennel - > "$out/lua/configuration/plugins.lua"
# Other
echo "Copying tree-sitter queries ..."
cp -r "$after_store_path/queries" "$out/after/"
stylua "$out/"