feat/pack (#1)
Reviewed-on: #1 Co-authored-by: Tomas Mirchev <contact@tomastm.com> Co-committed-by: Tomas Mirchev <contact@tomastm.com>
This commit was merged in pull request #1.
This commit is contained in:
42
lua/modules/diagnostics.lua
Normal file
42
lua/modules/diagnostics.lua
Normal file
@@ -0,0 +1,42 @@
|
||||
-- Diagnostics
|
||||
local special_sources = {
|
||||
lua_ls = 'lua',
|
||||
}
|
||||
vim.diagnostic.config({
|
||||
underline = true,
|
||||
severity_sort = true,
|
||||
virtual_text = {
|
||||
format = function(diagnostic)
|
||||
local src = diagnostic.source and (special_sources[diagnostic.source] or diagnostic.source)
|
||||
if src then
|
||||
return string.format('%s: %s', src, diagnostic.message)
|
||||
end
|
||||
return diagnostic.message
|
||||
end,
|
||||
},
|
||||
float = {
|
||||
border = 'rounded',
|
||||
header = '',
|
||||
format = function(diagnostic)
|
||||
local src = diagnostic.source and (special_sources[diagnostic.source] or diagnostic.source)
|
||||
if src then
|
||||
return string.format('%s: %s', src, diagnostic.message)
|
||||
end
|
||||
return diagnostic.message
|
||||
end,
|
||||
},
|
||||
})
|
||||
|
||||
-- Override the virtual text diagnostic handler so that the most severe diagnostic is shown first.
|
||||
local show_handler = vim.diagnostic.handlers.virtual_text.show
|
||||
assert(show_handler)
|
||||
local hide_handler = vim.diagnostic.handlers.virtual_text.hide
|
||||
vim.diagnostic.handlers.virtual_text = {
|
||||
show = function(ns, bufnr, diagnostics, opts)
|
||||
table.sort(diagnostics, function(diag1, diag2)
|
||||
return diag1.severity > diag2.severity
|
||||
end)
|
||||
return show_handler(ns, bufnr, diagnostics, opts)
|
||||
end,
|
||||
hide = hide_handler,
|
||||
}
|
||||
23
lua/modules/language-specs.lua
Normal file
23
lua/modules/language-specs.lua
Normal file
@@ -0,0 +1,23 @@
|
||||
local M = {}
|
||||
|
||||
function M.get()
|
||||
return {
|
||||
{ ts = { 'yaml', 'toml', 'sql', 'diff', 'dockerfile', 'gitcommit', 'gitignore' } },
|
||||
{ ts = { 'c', 'cpp', 'go', 'rust', 'python' } },
|
||||
|
||||
{ ft = 'markdown', ts = { 'markdown', 'markdown_inline' }, format = 'prettier' },
|
||||
{ ft = 'bash', lsp = 'bash-language-server', lint = 'shellcheck', format = 'shfmt' },
|
||||
{ ft = 'lua', lsp = 'lua-language-server', lint = 'luacheck', format = 'stylua' },
|
||||
{ ft = { 'json', 'jsonc' }, lsp = 'json-lsp' },
|
||||
{ ft = 'html', lsp = 'html-lsp' },
|
||||
{ ft = 'css', lsp = { 'css-lsp', 'tailwindcss-language-server' } },
|
||||
{
|
||||
ft = { 'javascript', 'typescript', 'javascriptreact', 'typescriptreact' },
|
||||
ts = { 'javascript', 'typescript', 'tsx' },
|
||||
lsp = { 'vtsls', 'eslint-lsp' },
|
||||
format = { 'prettierd', 'prettier' },
|
||||
},
|
||||
}
|
||||
end
|
||||
|
||||
return M
|
||||
2
lua/modules/navigation.lua
Normal file
2
lua/modules/navigation.lua
Normal file
@@ -0,0 +1,2 @@
|
||||
require('plugins.finder')
|
||||
require('plugins.filetree')
|
||||
67
lua/modules/terminal.lua
Normal file
67
lua/modules/terminal.lua
Normal file
@@ -0,0 +1,67 @@
|
||||
local api = vim.api
|
||||
local au = api.nvim_create_autocmd
|
||||
local group = api.nvim_create_augroup('triimd.term', { clear = true })
|
||||
|
||||
-- Custom terminal
|
||||
au('TermOpen', {
|
||||
group = group,
|
||||
callback = function()
|
||||
vim.opt_local.number = false
|
||||
vim.opt_local.relativenumber = false
|
||||
vim.opt_local.scrolloff = 0
|
||||
vim.bo.filetype = 'terminal'
|
||||
vim.cmd.startinsert()
|
||||
end,
|
||||
})
|
||||
|
||||
-- Insert when re-entering a terminal window (after switching back)
|
||||
au('BufEnter', {
|
||||
group = group,
|
||||
pattern = 'term://*',
|
||||
callback = function()
|
||||
if vim.bo.buftype == 'terminal' and vim.fn.mode() ~= 'i' then
|
||||
vim.cmd.startinsert()
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
||||
-- Close all terminal buffers before quitting
|
||||
au('QuitPre', {
|
||||
group = group,
|
||||
callback = function()
|
||||
for _, buf in ipairs(vim.api.nvim_list_bufs()) do
|
||||
if vim.api.nvim_buf_is_loaded(buf) and vim.bo[buf].buftype == 'terminal' then
|
||||
vim.api.nvim_buf_delete(buf, { force = true })
|
||||
end
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
||||
local commands = {
|
||||
TermDefault = function()
|
||||
vim.cmd('terminal')
|
||||
end,
|
||||
|
||||
TermRelative = function()
|
||||
local shell = vim.o.shell or 'zsh'
|
||||
local dir = vim.fn.expand('%:p:h')
|
||||
vim.cmd(string.format('edit term://%s//%s', dir, shell))
|
||||
end,
|
||||
|
||||
TermSplit = function()
|
||||
vim.cmd('new')
|
||||
vim.cmd('wincmd J')
|
||||
vim.api.nvim_win_set_height(0, 12)
|
||||
vim.wo.winfixheight = true
|
||||
vim.cmd('term')
|
||||
end,
|
||||
|
||||
TermVSplit = function()
|
||||
vim.cmd('vsplit')
|
||||
vim.cmd('term')
|
||||
end,
|
||||
}
|
||||
|
||||
for name, fn in pairs(commands) do
|
||||
vim.api.nvim_create_user_command(name, fn, {})
|
||||
end
|
||||
32
lua/modules/theme.lua
Normal file
32
lua/modules/theme.lua
Normal file
@@ -0,0 +1,32 @@
|
||||
|
||||
local function load_theme()
|
||||
require('invero').setup({
|
||||
highlights = function(c, tool)
|
||||
c.bg_float = tool(152)
|
||||
return {
|
||||
ModeMsg = { fg = c.yellow, bg = c.none, bold = true },
|
||||
WinSeparator = { fg = c.outline, bg = c.base },
|
||||
StatusLine = { fg = c.outline, bg = c.base },
|
||||
StatusLineNC = { fg = c.text, bg = c.base, bold = true },
|
||||
TabLine = { fg = c.muted, bg = c.none },
|
||||
TabLineSel = { fg = c.text, bg = c.none, bold = true },
|
||||
TabLineFill = { fg = c.outline_light, bg = c.none },
|
||||
Pmenu = { fg = c.text, bg = c.surface },
|
||||
PmenuSel = { fg = c.text, bg = c.accent_light },
|
||||
QuickFixLine = { fg = c.accent, bg = c.none, bold = true },
|
||||
}
|
||||
end,
|
||||
})
|
||||
|
||||
vim.o.background = 'light'
|
||||
vim.cmd.colorscheme('invero')
|
||||
end
|
||||
|
||||
vim.api.nvim_create_user_command('ReloadInvero', function()
|
||||
require('invero').invalidate_cache()
|
||||
load_theme()
|
||||
end, {})
|
||||
|
||||
load_theme()
|
||||
|
||||
require('plugins.tabline').setup()
|
||||
Reference in New Issue
Block a user