dotfiles-ansible/roles/nvim/files/nvim/lua/user/modules/core/config.lua

116 lines
3.4 KiB
Lua

local M = {}
function M.notify()
require('notify').setup {
-- Animation style
stages = 'slide',
-- Function called when a new window is opened, use for changing win settings/config
on_open = function(win)
vim.api.nvim_win_set_config(win, { border = vim.g.border_style })
end,
-- Render function for notifications. See notify-render()
render = 'default',
-- Default timeout for notifications
timeout = 2000,
-- For stages that change opacity this is treated as the highlight behind the window
-- Set this to either a highlight group or an RGB hex value e.g. '#000000'
background_colour = 'NormalFloat',
-- Minimum width for notification windows
minimum_width = 40,
-- Icons for the different levels
icons = {
ERROR = '',
WARN = '',
INFO = '',
DEBUG = '',
TRACE = '',
},
}
vim.notify = require('notify')
end
function M.whichkey()
require('which-key').setup {
plugins = {
marks = true,
registers = true,
spelling = {
enabled = true,
suggestions = 30,
},
presets = {
operators = true,
motions = true,
text_objects = true,
windows = true,
nav = true,
z = true,
g = true,
},
},
icons = {
breadcrumb = '»',
separator = '',
group = '+',
},
window = {
border = vim.g.border_style,
position = 'bottom',
winblend = 0,
},
layout = {
spacing = 10,
align = 'center',
},
ignore_missing = true,
hidden = { '<silent>', '<cmd>', '<Cmd>', '<CR>', 'call', 'lua', '^:', '^ ' },
show_help = true,
triggers = 'auto',
}
end
function M.filetype()
require('filetype').setup {
overrides = {
extensions = {
gmi = 'gemtext',
gemini = 'gemtext',
mm = 'mermaid',
mmd = 'mermaid',
mermaid = 'mermaid',
j2 = 'jinja',
jinja2 = 'jinja',
log = 'log',
LOG = 'log',
nft = 'nftables',
vifm = 'vim',
},
literal = {
log = 'log',
vifmrc = 'vim',
Vagrantfile = 'ruby',
['nftables.conf'] = 'nftables',
},
complex = {
['.*_log$'] = 'log',
['.*_LOG$'] = 'log',
['.*%.config/waybar/config$'] = 'jsonc',
['.*%.config/sway/config$'] = 'config',
['.*%.config/fontconfig/fonts.conf$'] = 'xml',
-- ['.*tasks/.*%.ya?ml$'] = 'yaml.ansible',
-- ['.*roles/.*%.ya?ml$'] = 'yaml.ansible',
-- ['.*playbooks/.*%.ya?ml$'] = 'yaml.ansible',
-- ['.*handlers/.*%.ya?ml$'] = 'yaml.ansible',
-- ['.*group_vars/.*%.ya?ml$'] = 'yaml.ansible',
-- ['.*host_vars/.*%.ya?ml$'] = 'yaml.ansible'
},
shebang = {
nft = 'nftables',
},
},
}
end
return M