mirror of
https://github.com/cole-maxwell1/dotfiles.git
synced 2026-06-03 11:10:20 -04:00
Compare commits
4 Commits
92e6109ab6
..
main
| Author | SHA1 | Date | |
|---|---|---|---|
| dd91da6b00 | |||
| f18f750962 | |||
| 32832a8260 | |||
| 3d16375b54 |
@@ -1,13 +0,0 @@
|
|||||||
{
|
|
||||||
"runtime.version": "LuaJIT",
|
|
||||||
"runtime.path": [
|
|
||||||
"lua/?.lua",
|
|
||||||
"lua/?/init.lua"
|
|
||||||
],
|
|
||||||
"diagnostics.globals": ["vim"],
|
|
||||||
"workspace.checkThirdParty": false,
|
|
||||||
"workspace.library": [
|
|
||||||
"$VIMRUNTIME",
|
|
||||||
"./lua"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
@@ -1,26 +0,0 @@
|
|||||||
local lsp_zero = require('lsp-zero')
|
|
||||||
|
|
||||||
lsp_zero.on_attach(function(client, bufnr)
|
|
||||||
-- see :help lsp-zero-keybindings
|
|
||||||
-- to learn the available actions
|
|
||||||
lsp_zero.default_keymaps({
|
|
||||||
buffer = bufnr
|
|
||||||
})
|
|
||||||
end)
|
|
||||||
|
|
||||||
lsp_zero.set_sign_icons({
|
|
||||||
error = '✘',
|
|
||||||
warn = '▲',
|
|
||||||
hint = '⚑',
|
|
||||||
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-lspconfig').setup({
|
|
||||||
ensure_installed = {'lua_ls', 'ts_ls', 'eslint', 'gopls', 'rust_analyzer'},
|
|
||||||
handlers = {function(server_name)
|
|
||||||
require('lspconfig')[server_name].setup({})
|
|
||||||
end}
|
|
||||||
})
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
local cmp = require('cmp')
|
|
||||||
|
|
||||||
cmp.setup({
|
|
||||||
mapping = cmp.mapping.preset.insert({
|
|
||||||
['<CR>'] = cmp.mapping.confirm({select = false}),
|
|
||||||
}),
|
|
||||||
preselect = 'item',
|
|
||||||
completion = {
|
|
||||||
completeopt = 'menu,menuone,noinsert'
|
|
||||||
},
|
|
||||||
})
|
|
||||||
@@ -1,8 +1 @@
|
|||||||
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
|
|
||||||
if not vim.loop.fs_stat(lazypath) then
|
|
||||||
vim.fn.system({"git", "clone", "--filter=blob:none", "https://github.com/folke/lazy.nvim.git", "--branch=stable",
|
|
||||||
lazypath})
|
|
||||||
end
|
|
||||||
vim.opt.rtp:prepend(lazypath)
|
|
||||||
|
|
||||||
require("cole")
|
require("cole")
|
||||||
|
|||||||
@@ -1,13 +0,0 @@
|
|||||||
{
|
|
||||||
"LuaSnip": { "branch": "master", "commit": "a62e1083a3cfe8b6b206e7d3d33a51091df25357" },
|
|
||||||
"cmp-nvim-lsp": { "branch": "main", "commit": "cbc7b02bb99fae35cb42f514762b89b5126651ef" },
|
|
||||||
"lazy.nvim": { "branch": "main", "commit": "85c7ff3711b730b4030d03144f6db6375044ae82" },
|
|
||||||
"lsp-zero.nvim": { "branch": "v3.x", "commit": "77550f2f6cbf0959ef1583d845661af075f3442b" },
|
|
||||||
"mason-lspconfig.nvim": { "branch": "main", "commit": "0a3b42c3e503df87aef6d6513e13148381495c3a" },
|
|
||||||
"mason.nvim": { "branch": "main", "commit": "12ddd182d9efbdc848b540f16484a583d52da0fb" },
|
|
||||||
"nvim-cmp": { "branch": "main", "commit": "a1d504892f2bc56c2e79b65c6faded2fd21f3eca" },
|
|
||||||
"nvim-lspconfig": { "branch": "master", "commit": "e146efacbafed3789ac568abcc5a981c5decaa58" },
|
|
||||||
"nvim-treesitter": { "branch": "main", "commit": "4916d6592ede8c07973490d9322f187e07dfefac" },
|
|
||||||
"plenary.nvim": { "branch": "master", "commit": "74b06c6c75e4eeb3108ec01852001636d85a932b" },
|
|
||||||
"telescope.nvim": { "branch": "master", "commit": "d90956833d7c27e73c621a61f20b29fdb7122709" }
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,44 @@
|
|||||||
|
local cmp = require("cmp")
|
||||||
|
local luasnip = require("luasnip")
|
||||||
|
|
||||||
|
cmp.setup({
|
||||||
|
snippet = {
|
||||||
|
expand = function(args)
|
||||||
|
luasnip.lsp_expand(args.body)
|
||||||
|
end
|
||||||
|
},
|
||||||
|
|
||||||
|
mapping = cmp.mapping.preset.insert({
|
||||||
|
["<C-b>"] = cmp.mapping.scroll_docs(-4),
|
||||||
|
["<C-f>"] = cmp.mapping.scroll_docs(4),
|
||||||
|
["<C-p>"] = cmp.mapping.select_prev_item(),
|
||||||
|
["<C-n>"] = cmp.mapping.select_next_item(),
|
||||||
|
["<C-Space>"] = cmp.mapping.complete(),
|
||||||
|
["<C-e>"] = cmp.mapping.abort(),
|
||||||
|
|
||||||
|
["<CR>"] = cmp.mapping.confirm({
|
||||||
|
select = false
|
||||||
|
})
|
||||||
|
}),
|
||||||
|
|
||||||
|
preselect = cmp.PreselectMode.None,
|
||||||
|
|
||||||
|
completion = {
|
||||||
|
completeopt = "menu,menuone,noinsert,noselect"
|
||||||
|
},
|
||||||
|
|
||||||
|
window = {
|
||||||
|
completion = cmp.config.window.bordered(),
|
||||||
|
documentation = cmp.config.window.bordered()
|
||||||
|
},
|
||||||
|
|
||||||
|
sources = cmp.config.sources({{
|
||||||
|
name = "nvim_lsp"
|
||||||
|
}, {
|
||||||
|
name = "luasnip"
|
||||||
|
}, {
|
||||||
|
name = "path"
|
||||||
|
}}, {{
|
||||||
|
name = "buffer"
|
||||||
|
}})
|
||||||
|
})
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
require("cole.remap")
|
require("cole.remap")
|
||||||
require("cole.set")
|
require("cole.plugins")
|
||||||
require("cole.filetype")
|
require("cole.filetype")
|
||||||
require("cole.lazy")
|
require("cole.set")
|
||||||
|
require("cole.cmp")
|
||||||
|
require("cole.lsp")
|
||||||
@@ -1,16 +0,0 @@
|
|||||||
require("lazy").setup({ -- Fuzzy finder
|
|
||||||
{
|
|
||||||
'nvim-telescope/telescope.nvim',
|
|
||||||
tag = '0.1.5',
|
|
||||||
dependencies = {'nvim-lua/plenary.nvim'}
|
|
||||||
}, -- syntax highlighting
|
|
||||||
{
|
|
||||||
'nvim-treesitter/nvim-treesitter',
|
|
||||||
build = ':TSUpdate'
|
|
||||||
}, -- LSP support
|
|
||||||
{
|
|
||||||
'VonHeikemen/lsp-zero.nvim',
|
|
||||||
branch = 'v3.x',
|
|
||||||
dependencies = {{'williamboman/mason.nvim'}, {'williamboman/mason-lspconfig.nvim'}, {'neovim/nvim-lspconfig'},
|
|
||||||
{'hrsh7th/nvim-cmp'}, {'hrsh7th/cmp-nvim-lsp'}, {'L3MON4D3/LuaSnip'}}
|
|
||||||
}})
|
|
||||||
@@ -0,0 +1,137 @@
|
|||||||
|
require("mason").setup()
|
||||||
|
|
||||||
|
require("mason-tool-installer").setup({
|
||||||
|
ensure_installed = {"lua_ls", "gopls", "ts_ls", "eslint", "rust_analyzer", "jsonls", "bashls", "stylua", "prettier",
|
||||||
|
"goimports", "shfmt"}
|
||||||
|
})
|
||||||
|
|
||||||
|
local capabilities = require("cmp_nvim_lsp").default_capabilities()
|
||||||
|
|
||||||
|
vim.lsp.config("*", {
|
||||||
|
capabilities = capabilities
|
||||||
|
})
|
||||||
|
|
||||||
|
vim.lsp.config("lua_ls", {
|
||||||
|
settings = {
|
||||||
|
Lua = {
|
||||||
|
runtime = {
|
||||||
|
version = "LuaJIT"
|
||||||
|
},
|
||||||
|
diagnostics = {
|
||||||
|
globals = {"vim"}
|
||||||
|
},
|
||||||
|
workspace = {
|
||||||
|
checkThirdParty = false,
|
||||||
|
library = {vim.env.VIMRUNTIME, "${3rd}/luv/library"}
|
||||||
|
},
|
||||||
|
telemetry = {
|
||||||
|
enable = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
vim.lsp.config("gopls", {
|
||||||
|
settings = {
|
||||||
|
gopls = {
|
||||||
|
staticcheck = true,
|
||||||
|
gofumpt = true,
|
||||||
|
usePlaceholders = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
vim.lsp.config("ts_ls", {
|
||||||
|
settings = {
|
||||||
|
typescript = {
|
||||||
|
inlayHints = {
|
||||||
|
includeInlayParameterNameHints = "all",
|
||||||
|
includeInlayFunctionParameterTypeHints = true,
|
||||||
|
includeInlayVariableTypeHints = true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
javascript = {
|
||||||
|
inlayHints = {
|
||||||
|
includeInlayParameterNameHints = "all",
|
||||||
|
includeInlayFunctionParameterTypeHints = true,
|
||||||
|
includeInlayVariableTypeHints = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
vim.lsp.config("rust_analyzer", {
|
||||||
|
settings = {
|
||||||
|
["rust-analyzer"] = {
|
||||||
|
cargo = {
|
||||||
|
allFeatures = true
|
||||||
|
},
|
||||||
|
check = {
|
||||||
|
command = "clippy"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
require("mason-lspconfig").setup({
|
||||||
|
automatic_enable = {
|
||||||
|
exclude = {"ts_ls"}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
vim.lsp.enable("ts_ls")
|
||||||
|
|
||||||
|
vim.diagnostic.config({
|
||||||
|
severity_sort = true,
|
||||||
|
update_in_insert = false,
|
||||||
|
|
||||||
|
float = {
|
||||||
|
border = "rounded",
|
||||||
|
source = "if_many"
|
||||||
|
},
|
||||||
|
|
||||||
|
underline = true,
|
||||||
|
|
||||||
|
virtual_text = {
|
||||||
|
spacing = 2,
|
||||||
|
source = "if_many",
|
||||||
|
prefix = "●"
|
||||||
|
},
|
||||||
|
|
||||||
|
signs = {
|
||||||
|
text = {
|
||||||
|
[vim.diagnostic.severity.ERROR] = "E",
|
||||||
|
[vim.diagnostic.severity.WARN] = "W",
|
||||||
|
[vim.diagnostic.severity.INFO] = "I",
|
||||||
|
[vim.diagnostic.severity.HINT] = "H"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
vim.api.nvim_create_autocmd("LspAttach", {
|
||||||
|
callback = function(args)
|
||||||
|
local bufnr = args.buf
|
||||||
|
|
||||||
|
local map = function(mode, lhs, rhs, desc)
|
||||||
|
vim.keymap.set(mode, lhs, rhs, {
|
||||||
|
buffer = bufnr,
|
||||||
|
silent = true,
|
||||||
|
desc = desc
|
||||||
|
})
|
||||||
|
end
|
||||||
|
|
||||||
|
map("n", "K", vim.lsp.buf.hover, "LSP hover")
|
||||||
|
map("n", "gd", vim.lsp.buf.definition, "Go to definition")
|
||||||
|
map("n", "gD", vim.lsp.buf.declaration, "Go to declaration")
|
||||||
|
map("n", "gi", vim.lsp.buf.implementation, "Go to implementation")
|
||||||
|
map("n", "gr", vim.lsp.buf.references, "References")
|
||||||
|
map("n", "<leader>rn", vim.lsp.buf.rename, "Rename symbol")
|
||||||
|
map({"n", "v"}, "<leader>ca", vim.lsp.buf.code_action, "Code action")
|
||||||
|
|
||||||
|
map("n", "<leader>f", function()
|
||||||
|
vim.lsp.buf.format({
|
||||||
|
async = true
|
||||||
|
})
|
||||||
|
end, "Format buffer")
|
||||||
|
end
|
||||||
|
})
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
-- Define plugins for Neovim 0.12 native package manager.
|
||||||
|
vim.pack.add({
|
||||||
|
--Theme
|
||||||
|
"https://github.com/bluz71/vim-moonfly-colors",
|
||||||
|
--File switch
|
||||||
|
{ src = "https://github.com/nvim-telescope/telescope.nvim", version = "0.1.5" },
|
||||||
|
--Syntax
|
||||||
|
"https://github.com/nvim-treesitter/nvim-treesitter",
|
||||||
|
--LSP
|
||||||
|
"https://github.com/mason-org/mason.nvim",
|
||||||
|
"https://github.com/mason-org/mason-lspconfig.nvim",
|
||||||
|
"https://github.com/WhoIsSethDaniel/mason-tool-installer.nvim",
|
||||||
|
"https://github.com/neovim/nvim-lspconfig",
|
||||||
|
--Auto complete
|
||||||
|
"https://github.com/hrsh7th/nvim-cmp",
|
||||||
|
"https://github.com/hrsh7th/cmp-nvim-lsp",
|
||||||
|
"https://github.com/hrsh7th/cmp-buffer",
|
||||||
|
"https://github.com/hrsh7th/cmp-path",
|
||||||
|
"https://github.com/saadparwaiz1/cmp_luasnip",
|
||||||
|
"https://github.com/L3MON4D3/LuaSnip",
|
||||||
|
})
|
||||||
@@ -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,57 @@
|
|||||||
|
{
|
||||||
|
"plugins": {
|
||||||
|
"LuaSnip": {
|
||||||
|
"rev": "a62e1083a3cfe8b6b206e7d3d33a51091df25357",
|
||||||
|
"src": "https://github.com/L3MON4D3/LuaSnip"
|
||||||
|
},
|
||||||
|
"cmp-buffer": {
|
||||||
|
"rev": "b74fab3656eea9de20a9b8116afa3cfc4ec09657",
|
||||||
|
"src": "https://github.com/hrsh7th/cmp-buffer"
|
||||||
|
},
|
||||||
|
"cmp-nvim-lsp": {
|
||||||
|
"rev": "cbc7b02bb99fae35cb42f514762b89b5126651ef",
|
||||||
|
"src": "https://github.com/hrsh7th/cmp-nvim-lsp"
|
||||||
|
},
|
||||||
|
"cmp-path": {
|
||||||
|
"rev": "c642487086dbd9a93160e1679a1327be111cbc25",
|
||||||
|
"src": "https://github.com/hrsh7th/cmp-path"
|
||||||
|
},
|
||||||
|
"cmp_luasnip": {
|
||||||
|
"rev": "98d9cb5c2c38532bd9bdb481067b20fea8f32e90",
|
||||||
|
"src": "https://github.com/saadparwaiz1/cmp_luasnip"
|
||||||
|
},
|
||||||
|
"mason-lspconfig.nvim": {
|
||||||
|
"rev": "0c2823e0418f3d9230ff8b201c976e84de1cb401",
|
||||||
|
"src": "https://github.com/mason-org/mason-lspconfig.nvim"
|
||||||
|
},
|
||||||
|
"mason-tool-installer.nvim": {
|
||||||
|
"rev": "443f1ef8b5e6bf47045cb2217b6f748a223cf7dc",
|
||||||
|
"src": "https://github.com/WhoIsSethDaniel/mason-tool-installer.nvim"
|
||||||
|
},
|
||||||
|
"mason.nvim": {
|
||||||
|
"rev": "12ddd182d9efbdc848b540f16484a583d52da0fb",
|
||||||
|
"src": "https://github.com/mason-org/mason.nvim"
|
||||||
|
},
|
||||||
|
"nvim-cmp": {
|
||||||
|
"rev": "a1d504892f2bc56c2e79b65c6faded2fd21f3eca",
|
||||||
|
"src": "https://github.com/hrsh7th/nvim-cmp"
|
||||||
|
},
|
||||||
|
"nvim-lspconfig": {
|
||||||
|
"rev": "8fde495949782bb61c2605174e231d145a048d8c",
|
||||||
|
"src": "https://github.com/neovim/nvim-lspconfig"
|
||||||
|
},
|
||||||
|
"nvim-treesitter": {
|
||||||
|
"rev": "4916d6592ede8c07973490d9322f187e07dfefac",
|
||||||
|
"src": "https://github.com/nvim-treesitter/nvim-treesitter"
|
||||||
|
},
|
||||||
|
"telescope.nvim": {
|
||||||
|
"rev": "d90956833d7c27e73c621a61f20b29fdb7122709",
|
||||||
|
"src": "https://github.com/nvim-telescope/telescope.nvim",
|
||||||
|
"version": "'0.1.5'"
|
||||||
|
},
|
||||||
|
"vim-moonfly-colors": {
|
||||||
|
"rev": "ed33cb0e0edfced6e86e782d51f23e67232ad4a9",
|
||||||
|
"src": "https://github.com/bluz71/vim-moonfly-colors"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
.DS_Store
|
||||||
@@ -57,6 +57,11 @@ if [[ -d $HOME/.cargo/bin && ":$PATH:" != *":$HOME/.cargo/bin:"* ]]; then
|
|||||||
export PATH=$PATH:$HOME/.cargo/bin
|
export PATH=$PATH:$HOME/.cargo/bin
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Add .dotnet/tools path if installed and not already in $PATH
|
||||||
|
if [[ -d $HOME/.dotnet/tools && ":$PATH:" != *":$HOME/.dotnet/tools:"* ]]; then
|
||||||
|
export PATH=$PATH:$HOME/.dotnet/tools
|
||||||
|
fi
|
||||||
|
|
||||||
###############################################
|
###############################################
|
||||||
# History configuration
|
# History configuration
|
||||||
###############################################
|
###############################################
|
||||||
|
|||||||
Reference in New Issue
Block a user