pattern = { "*" },
callback = function()
local filetype = vim.o.filetype
- if filetype == 'help' or filetype == 'fugitive' or filetype == 'gitcommit' then
+ if filetype == "help" or filetype == "fugitive" or filetype == "gitcommit" then
vim.cmd.wincmd("L")
end
- 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 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
if vim.fn.filereadable(path) == 1 then
- vim.cmd('0r ' .. path)
+ vim.cmd("0r " .. path)
end
end
- if ext ~= '' then
- copy('template.')
- elseif filename == 'Makefile' or 'LICENSE' then
+ if ext ~= "" then
+ copy("template.")
+ elseif filename == "Makefile" or "LICENSE" then
copy(filename)
end
- end
+ end,
})
-- auto format code on save
-vim.api.nvim_create_autocmd('BufWritePre', {
+vim.api.nvim_create_autocmd("BufWritePre", {
pattern = { "*" },
callback = function()
vim.lsp.buf.format()
- end
+ end,
})
return {
{
- 'neovim/nvim-lspconfig',
- -- event = { 'BufReadPre', 'BufNewFile' },
- lazy = false,
+ "jose-elias-alvarez/null-ls.nvim",
dependencies = {
- 'nvim-cmp',
- 'nvim-treesitter',
- 'Maan2003/lsp_lines.nvim',
- { 'williamboman/mason.nvim', build = ':MasonUpdate' },
- { 'williamboman/mason-lspconfig', version = '1.3.0' },
+ "plenary.nvim",
+ {
+ "jay-babu/mason-null-ls.nvim",
+ dependencies = { "mason.nvim" },
+ config = function()
+ local mason_null = function(source_name, methods)
+ require("mason-null-ls").default_setup(source_name, methods)
+ end
+
+ require("mason-null-ls").setup({
+ automatic_installation = true,
+ handlers = {
+ function()
+ end,
+ proselint = mason_null,
+ codespell = mason_null,
+ shellcheck = mason_null,
+ write_good = mason_null,
+ shellharden = mason_null,
+ },
+ })
+ end,
+ },
},
config = function()
- require('mason').setup()
+ local null_ls = require("null-ls")
+ local diagnostics = null_ls.builtins.diagnostics
+ local formatting = null_ls.builtins.formatting
+ local hover = null_ls.builtins.hover
+ local completion = null_ls.builtins.completion
- require('mason-lspconfig').setup({
- automatic_installation = true,
- ensure_installed = { 'rust_analyzer' }
+ require("null-ls").setup({
+ sources = {
+ completion.spell,
+ diagnostics.todo_comments,
+ diagnostics.trail_space,
+ formatting.trim_whitespace,
+ formatting.trim_newlines,
+ hover.dictionary,
+ hover.printenv,
+ },
})
+ end,
+ },
- local handlers = {
- function(server_name)
- require("lspconfig")[server_name].setup({})
+ {
+ "williamboman/mason-lspconfig",
+ dependencies = {
+ {
+ "williamboman/mason.nvim",
+ build = ":MasonUpdate",
+ config = function()
+ require("mason").setup()
end,
- }
-
- require('mason-lspconfig').setup_handlers(handlers)
-
- -- docker_compose_language_service, jsonls, marksman, yamlls, awk_ls, solargraph, bashls, dockerls, clangd, lua_ls, vimls, rust_analyzer, html, cssls
+ },
+ },
+ version = "1.3.0",
+ config = function()
+ require("mason-lspconfig").setup({
+ automatic_installation = true,
+ ensure_installed = { "rust_analyzer", "clangd", "lua_ls", "solargraph" },
+ })
+ end,
+ },
- -- require('lspconfig').docker_compose_language_service.setup({})
- -- require('lspconfig').jsonls.setup({})
- -- require('lspconfig').marksman.setup({})
- -- require('lspconfig').yamlls.setup({})
- -- require('lspconfig').awk_ls.setup({})
- -- require('lspconfig').solargraph.setup({})
- -- require('lspconfig').bashls.setup({})
- -- require('lspconfig').dockerls.setup({})
- -- require('lspconfig').clangd.setup({})
- -- require('lspconfig').lua_ls.setup({})
- -- require('lspconfig').vimls.setup({})
- -- require('lspconfig').rust_analyzer.setup({})
- -- require('lspconfig').html.setup({})
- -- require('lspconfig').cssls.setup({})
+ {
+ "neovim/nvim-lspconfig",
+ event = { "BufReadPre", "BufNewFile" },
+ lazy = false,
+ dependencies = {
+ "mason-lspconfig",
+ "nvim-cmp",
+ "nvim-treesitter",
+ "null-ls.nvim",
+ "Maan2003/lsp_lines.nvim",
+ },
+ config = function()
+ local lsp = require("lspconfig")
+ lsp.awk_ls.setup({})
+ lsp.bashls.setup({})
+ lsp.clangd.setup({})
+ lsp.cssls.setup({})
+ lsp.dockerls.setup({})
+ lsp.docker_compose_language_service.setup({})
+ lsp.html.setup({})
+ lsp.jsonls.setup({})
+ lsp.lua_ls.setup({})
+ lsp.marksman.setup({})
+ lsp.solargraph.setup({})
+ -- lsp.sorbet.setup({})
+ lsp.rust_analyzer.setup({})
+ lsp.taplo.setup({})
+ lsp.yamlls.setup({})
local border = {
{ "┏", "FloatBorder" },
signs = true,
underline = true,
update_in_insert = false,
- severity_sort = { reverse = true },
+ severity_sort = { reverse = false },
}
local signs = { Error = ">>", Warn = "> ", Hint = "- ", Info = " " }
opts.border = opts.border or border
return orig_util_open_floating_preview(contents, syntax, opts, ...)
end
- end
- },
-
- {
- 'jay-babu/mason-null-ls.nvim',
- lazy = { 'BufReadPre', 'BufNewFile' },
- dependencies = {
- 'mason.nvim',
- {
- 'jose-elias-alvarez/null-ls.nvim',
- dependencies = { 'plenary.nvim' },
- }
- },
- config = function()
- require('mason-null-ls').setup({
- automatic_setup = true,
- })
- end
+ end,
},
-
}
return {
- 'nvim-lualine/lualine.nvim',
+ "nvim-lualine/lualine.nvim",
lazy = false,
opts = {
options = {
icons_enabled = true,
- theme = 'auto',
- component_separators = { left = '|', right = '|' },
- section_separators = { left = '', right = '' },
+ theme = "auto",
+ component_separators = { left = "|", right = "|" },
+ section_separators = { left = "", right = "" },
disabled_filetypes = {
statusline = {},
winbar = {},
statusline = 1000,
tabline = 1000,
winbar = 1000,
- }
+ },
},
sections = {
- lualine_a = { 'mode' },
- lualine_b = { { 'filename', path = 3 } },
- lualine_c = { 'git', 'branch', 'diff' },
- lualine_x = { 'encoding' },
- lualine_y = { 'diagnostics' },
- lualine_z = { 'location', 'progress' }
+ lualine_a = { "mode" },
+ lualine_b = { { "filename", path = 3 } },
+ lualine_c = { "git", "branch", "diff" },
+ lualine_x = { "encoding" },
+ lualine_y = { "diagnostics" },
+ lualine_z = { "location", "progress" },
},
inactive_sections = {
- lualine_a = { 'filename' },
- lualine_b = { { 'filename', path = 3 } },
+ lualine_a = { "filename" },
+ lualine_b = { { "filename", path = 3 } },
lualine_c = {},
lualine_x = {},
lualine_y = {},
- lualine_z = { 'location' }
+ lualine_z = { "location" },
},
winbar = {
- lualine_a = { 'filename', 'filesize', 'filetype' },
+ lualine_a = { "filename", "filesize", "filetype" },
lualine_b = {},
lualine_c = {},
lualine_x = {},
lualine_y = {},
lualine_z = {
{
- 'tabs',
+ "tabs",
tabs_color = {
- active = 'StatusLine',
- inactive = 'StatusLineNC',
+ active = "StatusLine",
+ inactive = "StatusLineNC",
},
- }
- }
+ },
+ },
},
inactive_winbar = {
- lualine_a = { 'filename' },
+ lualine_a = { "filename" },
lualine_b = {},
lualine_c = {},
lualine_x = {},
lualine_y = {},
- lualine_z = { 'ObsessionStatus' }
+ lualine_z = { "ObsessionStatus" },
},
- extensions = {}
- }
+ extensions = {},
+ },
}