+-- open help windows in a vertical split
vim.api.nvim_create_autocmd("BufWinEnter", {
pattern = { "*.txt" },
- callback = function()
+ callback = function()
if vim.o.filetype == 'help' then vim.cmd.wincmd("L") end
end
})
+
+-- check template folder and if a template.[filetype] exists use it
+vim.api.nvim_create_autocmd("BufNewFile", {
+ pattern = { "*" },
+ callback = function()
+ local ext = vim.fn.expand('%:e')
+ local filename = vim.fn.expand('%:t')
+ local dir = '/home/huck/repos/templates/'
+
+ local copy = function(name)
+ local path = dir .. name .. ext
+ print(path)
+ print(ext)
+ if vim.fn.filereadable(path) == 1 then
+ vim.cmd('0r ' .. path)
+ end
+ end
+
+ if ext ~= '' then
+ copy('template.')
+ elseif filename == 'Makefile' or 'LICENSE' then
+ copy(filename)
+ end
+ end
+})
vim.keymap.set( 'n', '<leader>h', ":vsplit " )
vim.keymap.set( 'n', '<leader>v', ":split " )
vim.keymap.set( 'n', '<leader>t', ':tabnew ' )
-vim.keymap.set( 'n', '<leader>b', '<CMD>bnext<CR>' )
+vim.keymap.set( 'n', '<leader>b', '<CMD>bprev<CR>' )
-- move through virtual lines
vim.keymap.set( 'n', 'j', 'gj' )
vim.diagnostic.enable()
vim.g.visible_diagnostics = true
end
- end,
-opts)
+ end
+)
{
'folke/trouble.nvim',
keys = {
- { '<leader>l', '<CMD>TroubleToggle<CR>' },
+ { '<leader>l', '<CMD>TroubleToggle document_diagnostics<CR>' },
+ { '<leader>L', '<CMD>TroubleToggle workspace_diagnostics<CR>' },
+ { '<leader>r', '<CMD>TroubleToggle lsp_references<CR>' },
},
opts = {
icons = false,
- mode = 'workspace_diagnostics',
use_diagnostic_signs = true
}
}
'williamboman/mason-lspconfig',
},
config = function()
- vim.lsp.diagnostics = {
- virtual_text = false,
- virtual_lines = true,
- signs = true,
- underline = true,
- update_in_insert = false,
- severity_sort = true,
- }
-
local lspconfig = require('lspconfig')
require('mason').setup()
})
local border = {
- {"â\94\8c", "FloatBorder"},
- {"â\94\80", "FloatBorder"},
- {"â\94\90", "FloatBorder"},
- {"â\94\82", "FloatBorder"},
- {"â\94\98", "FloatBorder"},
- {"â\94\80", "FloatBorder"},
- {"â\94\94", "FloatBorder"},
- {"â\94\82", "FloatBorder"},
+ {"â\94\8f", "FloatBorder"},
+ {"â\94\81", "FloatBorder"},
+ {"â\94\93", "FloatBorder"},
+ {"â\94\83", "FloatBorder"},
+ {"â\94\9b", "FloatBorder"},
+ {"â\94\81", "FloatBorder"},
+ {"â\94\97", "FloatBorder"},
+ {"â\94\83", "FloatBorder"},
}
- -- To instead override globally
+ local signs = { Error = ">>", Warn = "> ", Hint = "- ", Info = " " }
+
+ vim.lsp.diagnostics = {
+ signs = true,
+ underline = true,
+ update_in_insert = false,
+ severity_sort = { reverse = true },
+ }
+
+ for type, icon in pairs(signs) do
+ local hl = "DiagnosticSign" .. type
+ vim.fn.sign_define(hl, { text = icon, texthl = hl, numhl = hl })
+ end
+
local orig_util_open_floating_preview = vim.lsp.util.open_floating_preview
function vim.lsp.util.open_floating_preview(contents, syntax, opts, ...)
opts = opts or {}
-- UI
highlight("WildMenu", grey, black, c_grey, c_black, nil, nil)
highlight("Title", green, black, c_green, c_black, bold, nil)
-highlight("ToolBarLine", black, dark_grey, c_black, c_grey, nil, nil)
+highlight("ToolBarLine", dark_grey, black, c_grey, c_black, nil, nil)
highlight("Pmenu", white, black, nil, c_black, nil, nil)
highlight("PmenuSbar", white, black, nil, c_black, nil, nil)
highlight("PmenuThumb", grey, black, nil, c_black, nil, nil)