Compare commits
No commits in common. "87e396ff156e7b02309db063187ee7005e55837b" and "3633ac65657a4f6d1a0e3ef4fcc9d6f2d3354f6a" have entirely different histories.
87e396ff15
...
3633ac6565
9 changed files with 27 additions and 52 deletions
8
.markdownlint.yaml
Normal file
8
.markdownlint.yaml
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
MD033:
|
||||||
|
# Allowed elements
|
||||||
|
allowed_elements: [p, details, summary, a, img, h1]
|
||||||
|
|
||||||
|
# MD013/line-length - Line length
|
||||||
|
MD013:
|
||||||
|
# Number of characters
|
||||||
|
line_length: 120
|
|
@ -1,15 +1,9 @@
|
||||||
return {
|
return {
|
||||||
rust_analyzer = true,
|
'rust_analyzer',
|
||||||
erlangls = true,
|
'erlangls',
|
||||||
lua_ls = {
|
'lua_ls',
|
||||||
format_on_save = false,
|
'cssls',
|
||||||
},
|
'eslint',
|
||||||
cssls = {
|
'ts_ls',
|
||||||
format_on_save = false,
|
'svelte',
|
||||||
},
|
|
||||||
eslint = true,
|
|
||||||
ts_ls = {
|
|
||||||
format_on_save = false,
|
|
||||||
},
|
|
||||||
svelte = true,
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,6 @@ local M = {}
|
||||||
local augroup_name = 'CosmicNvimLspFormat'
|
local augroup_name = 'CosmicNvimLspFormat'
|
||||||
local config = require('config')
|
local config = require('config')
|
||||||
local u = require('utils')
|
local u = require('utils')
|
||||||
local lsp_utils = require('utils.lsp')
|
|
||||||
local lsp_mappings = require('lsp.mappings')
|
local lsp_mappings = require('lsp.mappings')
|
||||||
|
|
||||||
M.augroup = vim.api.nvim_create_augroup(augroup_name, { clear = true })
|
M.augroup = vim.api.nvim_create_augroup(augroup_name, { clear = true })
|
||||||
|
@ -32,15 +31,10 @@ function M.on_attach(client, bufnr)
|
||||||
})
|
})
|
||||||
vim.api.nvim_create_autocmd('BufWritePre', {
|
vim.api.nvim_create_autocmd('BufWritePre', {
|
||||||
callback = function()
|
callback = function()
|
||||||
if lsp_utils.format_on_save_enabled then
|
vim.lsp.buf.format({
|
||||||
vim.lsp.buf.format({
|
timeout_ms = config.lsp.format_timeout,
|
||||||
timeout_ms = config.lsp.format_timeout,
|
bufnr = bufnr,
|
||||||
bufnr = bufnr,
|
})
|
||||||
filter = function(cl)
|
|
||||||
return lsp_utils.can_client_format_on_save(cl)
|
|
||||||
end,
|
|
||||||
})
|
|
||||||
end
|
|
||||||
end,
|
end,
|
||||||
buffer = bufnr,
|
buffer = bufnr,
|
||||||
group = M.augroup,
|
group = M.augroup,
|
||||||
|
|
|
@ -38,4 +38,4 @@ map('n', '<C-Right>', ':vertical resize +2<CR>', { desc = 'Vertical Resize +2' }
|
||||||
|
|
||||||
-- easy insertion of trailing ; and , from insert mode.
|
-- easy insertion of trailing ; and , from insert mode.
|
||||||
map('i', ';;', '<Esc>A;<Esc>')
|
map('i', ';;', '<Esc>A;<Esc>')
|
||||||
map('i', ',,', '<Esc>A,<Esc>')
|
map('i', ',,', '<Esc>A;<Esc>')
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
local config = {
|
local config = {
|
||||||
auto_restore = true,
|
|
||||||
auto_session = true,
|
|
||||||
enabled = true,
|
|
||||||
pre_save_cmds = { 'cclose', 'lua vim.notify.dismiss()' },
|
pre_save_cmds = { 'cclose', 'lua vim.notify.dismiss()' },
|
||||||
|
auto_session_enabled = true,
|
||||||
|
auto_restore_enabled = true,
|
||||||
|
auto_save_enabled = true,
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|
|
@ -13,6 +13,7 @@ return {
|
||||||
local config_opts = {
|
local config_opts = {
|
||||||
sources = {
|
sources = {
|
||||||
null_ls.builtins.code_actions.gitsigns,
|
null_ls.builtins.code_actions.gitsigns,
|
||||||
|
null_ls.builtins.diagnostics.markdownlint,
|
||||||
null_ls.builtins.formatting.prettierd.with({
|
null_ls.builtins.formatting.prettierd.with({
|
||||||
env = {
|
env = {
|
||||||
PRETTIERD_LOCAL_PRETTIER_ONLY = 1,
|
PRETTIERD_LOCAL_PRETTIER_ONLY = 1,
|
||||||
|
@ -20,7 +21,7 @@ return {
|
||||||
extra_filetypes = { 'astro' },
|
extra_filetypes = { 'astro' },
|
||||||
}),
|
}),
|
||||||
null_ls.builtins.formatting.stylua,
|
null_ls.builtins.formatting.stylua,
|
||||||
},
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
null_ls.setup(u.merge(defaults, config_opts))
|
null_ls.setup(u.merge(defaults, config_opts))
|
||||||
|
|
|
@ -18,7 +18,7 @@ return {
|
||||||
lspconfig[server].setup(server_config)
|
lspconfig[server].setup(server_config)
|
||||||
end
|
end
|
||||||
|
|
||||||
for server, _ in pairs(require('lsp.servers')) do
|
for _, server in pairs(require('lsp.servers')) do
|
||||||
start_server(server)
|
start_server(server)
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
local config = require('config')
|
local config = require('config')
|
||||||
local servers = require('lsp.servers')
|
|
||||||
local M = {}
|
local M = {}
|
||||||
|
|
||||||
M.format_on_save_enabled = true
|
M.format_on_save_enabled = true
|
||||||
|
@ -9,24 +8,6 @@ function M.toggle_format_on_save()
|
||||||
vim.notify(string.format('Format on save: %s', M.format_on_save_enabled))
|
vim.notify(string.format('Format on save: %s', M.format_on_save_enabled))
|
||||||
end
|
end
|
||||||
|
|
||||||
function M.can_client_format_on_save(client)
|
|
||||||
local server_config = servers[client.name]
|
|
||||||
|
|
||||||
if server_config == true then
|
|
||||||
return true
|
|
||||||
end
|
|
||||||
|
|
||||||
if server_config then
|
|
||||||
if server_config.format_on_save == nil then
|
|
||||||
return true
|
|
||||||
end
|
|
||||||
|
|
||||||
return server_config.format_on_save == true
|
|
||||||
end
|
|
||||||
|
|
||||||
return true
|
|
||||||
end
|
|
||||||
|
|
||||||
function M.buf_format(bufnr, timeout)
|
function M.buf_format(bufnr, timeout)
|
||||||
if timeout == '' or timeout == nil then
|
if timeout == '' or timeout == nil then
|
||||||
timeout = config.lsp.format_timeout
|
timeout = config.lsp.format_timeout
|
||||||
|
|
|
@ -1,6 +1,3 @@
|
||||||
# wires nvim
|
# wires nvim
|
||||||
|
|
||||||
this is my current neovim config, based on [CosmicNvim][1] but with a
|
this is my current neovim config, based on [CosmicNvim](https://github.com/CosmicNvim/CosmicNvim), but with a substantial amount of reorganization and functionality I don't use stripped out.
|
||||||
substantial amount of reorganization and functionality I don't use stripped out.
|
|
||||||
|
|
||||||
[1]: https://github.com/CosmicNvim/CosmicNvim
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue