mirror of
https://github.com/cole-maxwell1/dotfiles.git
synced 2026-06-03 11:10:20 -04:00
Add: moonfly theme. Upgrade lsp-zero too v4
This commit is contained in:
@@ -1,26 +1,46 @@
|
|||||||
local lsp_zero = require('lsp-zero')
|
local lsp_zero = require('lsp-zero')
|
||||||
|
|
||||||
lsp_zero.on_attach(function(client, bufnr)
|
-- Attach keybindings on LSP connection
|
||||||
-- see :help lsp-zero-keybindings
|
local lsp_attach = function(client, bufnr)
|
||||||
-- to learn the available actions
|
|
||||||
lsp_zero.default_keymaps({
|
lsp_zero.default_keymaps({
|
||||||
buffer = bufnr
|
buffer = bufnr
|
||||||
})
|
})
|
||||||
end)
|
end
|
||||||
|
|
||||||
lsp_zero.set_sign_icons({
|
lsp_zero.extend_lspconfig({
|
||||||
error = '✘',
|
lsp_attach = lsp_attach,
|
||||||
warn = '▲',
|
capabilities = require('cmp_nvim_lsp').default_capabilities()
|
||||||
hint = '⚑',
|
})
|
||||||
info = '»'
|
|
||||||
|
-- Configure diagnostic signs natively for Neovim v0.11+
|
||||||
|
vim.diagnostic.config({
|
||||||
|
signs = {
|
||||||
|
text = {
|
||||||
|
[vim.diagnostic.severity.ERROR] = '✘',
|
||||||
|
[vim.diagnostic.severity.WARN] = '▲',
|
||||||
|
[vim.diagnostic.severity.HINT] = '⚑',
|
||||||
|
[vim.diagnostic.severity.INFO] = '»'
|
||||||
|
}
|
||||||
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
-- to learn how to use mason.nvim
|
|
||||||
-- read this: https://github.com/VonHeikemen/lsp-zero.nvim/blob/v3.x/doc/md/guide/integrate-with-mason-nvim.md
|
|
||||||
require('mason').setup({})
|
require('mason').setup({})
|
||||||
require('mason-lspconfig').setup({
|
require('mason-lspconfig').setup({
|
||||||
ensure_installed = {'lua_ls', 'ts_ls', 'eslint', 'gopls', 'rust_analyzer'},
|
ensure_installed = {'lua_ls', 'ts_ls', 'eslint', 'gopls', 'rust_analyzer'},
|
||||||
handlers = {function(server_name)
|
handlers = {function(server_name)
|
||||||
require('lspconfig')[server_name].setup({})
|
-- Map legacy server names to their modern equivalents
|
||||||
|
if server_name == 'tsserver' then
|
||||||
|
server_name = 'ts_ls'
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Verify the server configuration is accessible to prevent indexing errors
|
||||||
|
local has_config, _ = pcall(function()
|
||||||
|
return require('lspconfig')[server_name]
|
||||||
|
end)
|
||||||
|
if has_config then
|
||||||
|
require('lspconfig')[server_name].setup({})
|
||||||
|
else
|
||||||
|
vim.notify("LSP configuration not accessible for: " .. server_name, vim.log.levels.WARN)
|
||||||
|
end
|
||||||
end}
|
end}
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
{
|
{
|
||||||
"LuaSnip": { "branch": "master", "commit": "a62e1083a3cfe8b6b206e7d3d33a51091df25357" },
|
"LuaSnip": { "branch": "master", "commit": "a62e1083a3cfe8b6b206e7d3d33a51091df25357" },
|
||||||
"cmp-nvim-lsp": { "branch": "main", "commit": "cbc7b02bb99fae35cb42f514762b89b5126651ef" },
|
"cmp-nvim-lsp": { "branch": "main", "commit": "cbc7b02bb99fae35cb42f514762b89b5126651ef" },
|
||||||
|
"flexoki": { "branch": "main", "commit": "c3e2251e813d29d885a7cbbe9808a7af234d845d" },
|
||||||
"lazy.nvim": { "branch": "main", "commit": "85c7ff3711b730b4030d03144f6db6375044ae82" },
|
"lazy.nvim": { "branch": "main", "commit": "85c7ff3711b730b4030d03144f6db6375044ae82" },
|
||||||
"lsp-zero.nvim": { "branch": "v3.x", "commit": "77550f2f6cbf0959ef1583d845661af075f3442b" },
|
"lsp-zero.nvim": { "branch": "v3.x", "commit": "77550f2f6cbf0959ef1583d845661af075f3442b" },
|
||||||
"mason-lspconfig.nvim": { "branch": "main", "commit": "0a3b42c3e503df87aef6d6513e13148381495c3a" },
|
"mason-lspconfig.nvim": { "branch": "main", "commit": "0a3b42c3e503df87aef6d6513e13148381495c3a" },
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
require("cole.remap")
|
require("cole.remap")
|
||||||
|
require("cole.lazy")
|
||||||
require("cole.set")
|
require("cole.set")
|
||||||
require("cole.filetype")
|
require("cole.filetype")
|
||||||
require("cole.lazy")
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,16 +1,20 @@
|
|||||||
require("lazy").setup({ -- Fuzzy finder
|
require("lazy").setup({{
|
||||||
{
|
"bluz71/vim-moonfly-colors",
|
||||||
|
name = "moonfly",
|
||||||
|
lazy = false,
|
||||||
|
priority = 1000
|
||||||
|
}, {
|
||||||
'nvim-telescope/telescope.nvim',
|
'nvim-telescope/telescope.nvim',
|
||||||
tag = '0.1.5',
|
tag = '0.1.5',
|
||||||
dependencies = {'nvim-lua/plenary.nvim'}
|
dependencies = {'nvim-lua/plenary.nvim'}
|
||||||
}, -- syntax highlighting
|
}, -- Fuzzy finder
|
||||||
{
|
{
|
||||||
'nvim-treesitter/nvim-treesitter',
|
'nvim-treesitter/nvim-treesitter',
|
||||||
build = ':TSUpdate'
|
build = ':TSUpdate'
|
||||||
}, -- LSP support
|
}, -- syntax highlighting
|
||||||
{
|
{
|
||||||
'VonHeikemen/lsp-zero.nvim',
|
'VonHeikemen/lsp-zero.nvim',
|
||||||
branch = 'v3.x',
|
branch = 'v4.x',
|
||||||
dependencies = {{'williamboman/mason.nvim'}, {'williamboman/mason-lspconfig.nvim'}, {'neovim/nvim-lspconfig'},
|
dependencies = {{'williamboman/mason.nvim'}, {'williamboman/mason-lspconfig.nvim'}, {'neovim/nvim-lspconfig'},
|
||||||
{'hrsh7th/nvim-cmp'}, {'hrsh7th/cmp-nvim-lsp'}, {'L3MON4D3/LuaSnip'}}
|
{'hrsh7th/nvim-cmp'}, {'hrsh7th/cmp-nvim-lsp'}, {'L3MON4D3/LuaSnip'}} -- LSP support
|
||||||
}})
|
}})
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ vim.opt.incsearch = true
|
|||||||
vim.opt.scrolloff = 8 -- Always 8 lines above
|
vim.opt.scrolloff = 8 -- Always 8 lines above
|
||||||
|
|
||||||
-- Color scheme
|
-- Color scheme
|
||||||
vim.cmd.colorscheme("habamax")
|
vim.cmd.colorscheme("moonfly")
|
||||||
|
|
||||||
-- Diff: Muted Red on Crimson
|
-- Diff: Muted Red on Crimson
|
||||||
vim.api.nvim_set_hl(0, "DiffAdd", {
|
vim.api.nvim_set_hl(0, "DiffAdd", {
|
||||||
@@ -45,32 +45,41 @@ vim.api.nvim_create_autocmd("VimEnter", {
|
|||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Calculate the longest display-width line in the left (current) buffer.
|
-- Defer execution to unblock the initial UI render
|
||||||
local lines = vim.api.nvim_buf_get_lines(0, 0, -1, false)
|
vim.schedule(function()
|
||||||
local max_len = 0
|
-- Limit the line check to the first 2000 lines to prevent long startup times on large files
|
||||||
for _, line in ipairs(lines) do
|
local max_lines_to_check = 2000
|
||||||
local len = vim.fn.strdisplaywidth(line)
|
local line_count = vim.api.nvim_buf_line_count(0)
|
||||||
if len > max_len then
|
local limit = math.min(line_count, max_lines_to_check)
|
||||||
max_len = len
|
local lines = vim.api.nvim_buf_get_lines(0, 0, limit, false)
|
||||||
|
local max_len = 0
|
||||||
|
|
||||||
|
for _, line in ipairs(lines) do
|
||||||
|
local len = vim.api.nvim_strwidth(line)
|
||||||
|
if len > max_len then
|
||||||
|
max_len = len
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
|
||||||
|
|
||||||
-- Account for gutter columns (line numbers, sign column, fold column).
|
-- Account for gutter columns (line numbers, sign column, fold column).
|
||||||
local gutter = 0
|
local gutter = 0
|
||||||
if vim.wo.number or vim.wo.relativenumber then
|
if vim.wo.number or vim.wo.relativenumber then
|
||||||
gutter = gutter + vim.wo.numberwidth
|
gutter = gutter + vim.wo.numberwidth
|
||||||
end
|
end
|
||||||
if vim.wo.signcolumn ~= "no" then
|
if vim.wo.signcolumn ~= "no" then
|
||||||
gutter = gutter + 2
|
gutter = gutter + 2
|
||||||
end
|
end
|
||||||
gutter = gutter + vim.wo.foldcolumn
|
|
||||||
|
|
||||||
local desired = max_len + gutter + 1 -- +1 for the right edge padding
|
local fold_col = tonumber(vim.wo.foldcolumn) or 0
|
||||||
|
gutter = gutter + fold_col
|
||||||
|
|
||||||
-- Cap at exactly half the terminal width.
|
local desired = max_len + gutter + 1 -- +1 for the right edge padding
|
||||||
local half = math.floor(vim.o.columns / 2)
|
|
||||||
local width = math.min(desired, half)
|
|
||||||
|
|
||||||
vim.api.nvim_win_set_width(0, width)
|
-- Cap at exactly half the terminal width.
|
||||||
|
local half = math.floor(vim.o.columns / 2)
|
||||||
|
local width = math.min(desired, half)
|
||||||
|
|
||||||
|
vim.api.nvim_win_set_width(0, width)
|
||||||
|
end)
|
||||||
end
|
end
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -0,0 +1 @@
|
|||||||
|
.DS_Store
|
||||||
Reference in New Issue
Block a user