paulbsd-salt/states/neovim/templates/init.lua.j2
Paul 0140dbab6a
All checks were successful
continuous-integration/drone/push Build is passing
updated neovim state
2025-03-09 19:15:36 +01:00

66 lines
1.6 KiB
Django/Jinja

--{{ salt['pillar.get']('salt_managed', default='Salt Managed') }}
{%- from "neovim/map.jinja" import neovim with context %}
-- NeoVIM global configs
vim.cmd.colorscheme('{{ neovim.config.use_theme }}')
vim.cmd.filetype('plugin on')
{%- if neovim.config.use_syntax %}
vim.cmd.syntax('on')
{%- endif %}
{% macro cfg(command, settings) -%}
{%- if command == "globals" %}{% set t = "g" %}{% endif %}
{%- if command == "options" %}{% set t = "o" %}{% endif %}
{% for k, v in settings.items() %}
vim.{{ t }}["{{ k }}"]{% if v is defined %}={% if v is integer or v is boolean %}{{ v|lower }}{% else %}"{{ v }}"{% endif %}{% endif %}
{%- endfor %}
{% endmacro -%}
-- NeoVIM globals
{{- cfg("globals", neovim.config.globals) }}
-- NeoVIM options
{{- cfg("options", neovim.config.options) }}
function RemoveComments()
vim.cmd.normal("g/^#/d")
vim.cmd.normal("g/^$/d")
end
function Reformat()
vim.cmd.normal('gg=G')
end
vim.api.nvim_command("command! Reformat call luaeval('Reformat()')")
vim.api.nvim_command("command! RemoveComments call luaeval('RemoveComments()')")
vim.keymap.set("n", "<F9>", ":!%:p")
vim.keymap.set("n", "<C-s>", ":FzfLua<CR>")
vim.keymap.set("v", "<C-a>", "g<C-a>")
vim.keymap.set("v", "<C-x>", "g<C-x>")
vim.keymap.set("v", "g<C-a>", "<C-a>")
vim.keymap.set("v", "g<C-x>", "<C-x>")
{% if "nvim-tree" in neovim.plugins.keys() -%}
vim.g.loaded_netrw = 1
vim.g.loaded_netrwPlugin = 1
vim.opt.termguicolors = true
require("nvim-tree").setup({
sort = {
sorter = "case_sensitive",
},
view = {
width = 30,
},
renderer = {
group_empty = true,
},
filters = {
dotfiles = true,
},
})
{% endif -%}