Skip to content

Commit

Permalink
chore: Update 2024-05-10
Browse files Browse the repository at this point in the history
  • Loading branch information
loctvl842 committed May 10, 2024
1 parent 868a8ae commit 76aa349
Show file tree
Hide file tree
Showing 22 changed files with 289 additions and 123 deletions.
3 changes: 2 additions & 1 deletion lazy-lock.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
"mini.comment": { "branch": "main", "commit": "a4b7e46deb9ad2feb8902cc5dbf087eced112ee5" },
"mini.hipatterns": { "branch": "main", "commit": "0a72439dbded766af753a3e7ec0a5b21d0f8ada0" },
"mini.pairs": { "branch": "main", "commit": "04f58f2545ed80ac3b52dd4826e93f33e15b2af6" },
"monokai-pro.nvim": { "branch": "master", "commit": "8940b2f87343db96ee2c62404a4e4ff9257ed514" },
"monokai-pro.nvim": { "branch": "master", "commit": "23d5fe38bafac22487e5a477c823ac2e41f461f6" },
"neo-tree-diagnostics.nvim": { "branch": "main", "commit": "e00434c3cf8637bcaf70f65c2b9d82b0cc9bd7dc" },
"neo-tree.nvim": { "branch": "main", "commit": "16d1b194376bf1fc2acd89ccb3c29ba8315bfcea" },
"noice.nvim": { "branch": "main", "commit": "0cbe3f88d038320bdbda3c4c5c95f43a13c3aa12" },
Expand All @@ -58,6 +58,7 @@
"promise-async": { "branch": "main", "commit": "38a4575da9497326badd3995e768b4ccf0bb153e" },
"rainbow-delimiters.nvim": { "branch": "master", "commit": "a249476e451673f7811852d93109dff19311ee39" },
"statuscol.nvim": { "branch": "main", "commit": "d954893262a57a92e46edd87de67e2b3fe72305e" },
"tailwindcss-colorizer-cmp.nvim": { "branch": "main", "commit": "3d3cd95e4a4135c250faf83dd5ed61b8e5502b86" },
"telescope.nvim": { "branch": "master", "commit": "1bb28df3cfc241b961331f00dcb8d5b45fe3e4f0" },
"tokyonight.nvim": { "branch": "main", "commit": "67c6050e1ca41260c919236a098ba278472c7520" },
"vim-bbye": { "branch": "master", "commit": "903f5eb17f72ebf7b0b1524bbb792c0b36761af6" },
Expand Down
2 changes: 1 addition & 1 deletion lua/beastvim/features/lsp/diagnostics.lua
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ local function on()
float = {
focusable = false,
style = "minimal",
border = Utils.telescope.borderchars("thick", "tl-t-tr-r-br-b-bl-l"),
border = Utils.ui.borderchars("thick", "tl-t-tr-r-br-b-bl-l"),
source = "always",
header = "",
prefix = "",
Expand Down
25 changes: 24 additions & 1 deletion lua/beastvim/features/lsp/init.lua
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
local Utils = require("beastvim.utils")

---@class LspServer
---@field keys? string|string[]|LazyKeysSpec[]|fun(self:LazyPlugin, keys:string[]):(string|LazyKeys)[]
---@field keys? LazyKeysSpec
---@field capabilities? table
---@field on_attach? fun(client, bufnr)
---@field root_dir? string|string[]|fun(client, bufnr):string Root pattern or function to get the root directory

---@class LspOptions
---@field servers table<string, LspServer>
Expand All @@ -14,6 +15,7 @@ local Utils = require("beastvim.utils")
---@field keymaps beastvim.features.lsp.keymaps
---@field navic beastvim.features.lsp.navic
---@field diagnostics beastvim.features.lsp.diagnostics
---@field ui beastvim.features.lsp.ui
local M = {}

setmetatable(M, {
Expand All @@ -30,6 +32,10 @@ function M.setup(opts)
Utils.notify("Plugin `neovim/nvim-lspconfig` not installed", "ERROR")
return
end

-- UI
M.ui.setup()

-- Diagnostics
M.diagnostics.setup(opts.diagnostics)

Expand Down Expand Up @@ -71,6 +77,23 @@ function M.setup(opts)
end
Utils.lsp.on_attach(callback)
end

-- TODO Set root_dir pattern
local pending = true
if not pending and server_opts.root_dir then
-- If root_dir is string or list of strings
local lsp_utils = require("lspconfig/util")
if type(server_opts.root_dir) == "string" then
server_opts.root_dir = lsp_utils.root_pattern(server_opts.root_dir)
end
if type(server_opts.root_dir) == "table" then
server_opts.root_dir = lsp_utils.root_pattern(server_opts.root_dir)
end
end
if pending then
server_opts.root_dir = nil
end

lspconfig[server].setup(server_opts)
end

Expand Down
1 change: 1 addition & 0 deletions lua/beastvim/features/lsp/keymaps.lua
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ function M.get()
{ "gr", "<cmd>Telescope lsp_references<cr>", desc = "Go to references" },
{ "gi", "<cmd>Telescope lsp_implementations<cr>", desc = "Go to implementations" },
{ "K", "<cmd>lua vim.lsp.buf.hover()<CR>", desc = "Hover" },
{ "<c-k>", "<cmd>lua vim.lsp.buf.signature_help()<CR>", mode = "i", desc = "Signature Help" },
{ "gl", "<cmd>lua vim.diagnostic.open_float()<CR>", desc = "Show diagnostics" },
{ "]d", "<cmd>lua vim.diagnostic.goto_prev({buffer=0})<cr>", desc = "Prev Diagnostic" },
{ "[d", "<cmd>lua vim.diagnostic.goto_next({buffer=0})<CR>", desc = "Next Diagnostic" },
Expand Down
70 changes: 70 additions & 0 deletions lua/beastvim/features/lsp/lang/dotnet.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
return {
{ "Hoffs/omnisharp-extended-lsp.nvim", lazy = true },
{
"nvim-treesitter/nvim-treesitter",
opts = function(_, opts)
if type(opts.ensure_installed) == "table" then
vim.list_extend(opts.ensure_installed, { "c_sharp" })
end
end,
},
{
"nvimtools/none-ls.nvim",
optional = true,
opts = function(_, opts)
local nls = require("null-ls")
opts.sources = opts.sources or {}
table.insert(opts.sources, nls.builtins.formatting.csharpier)
end,
},

{
"stevearc/conform.nvim",
optional = true,
opts = {
formatters_by_ft = {
cs = { "csharpier" },
},
formatters = {
csharpier = {
command = "dotnet-csharpier",
args = { "--write-stdout" },
},
},
},
},
{
"williamboman/mason.nvim",
opts = function(_, opts)
if type(opts.ensure_installed) == "table" then
vim.list_extend(opts.ensure_installed, { "netcoredbg", "csharpier" })
end
end,
},
{
"neovim/nvim-lspconfig",
opts = {
servers = {
omnisharp = {
handlers = {
["textDocument/definition"] = function(...)
return require("omnisharp_extended").handler(...)
end,
},
keys = {
{
"gd",
function()
require("omnisharp_extended").telescope_lsp_definitions()
end,
desc = "Goto Definition",
},
},
enable_roslyn_analyzers = true,
organize_imports_on_format = true,
enable_import_completion = true,
},
},
},
},
}
11 changes: 6 additions & 5 deletions lua/beastvim/features/lsp/lang/go.lua
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ return {
"williamboman/mason.nvim",
opts = function(_, opts)
opts.ensure_installed = opts.ensure_installed or {}
vim.list_extend(opts.ensure_installed, { "goimports", "gofumpt" })
vim.list_extend(opts.ensure_installed, { "goimports", "golangci-lint" })
end,
},
{
Expand All @@ -25,7 +25,7 @@ return {
gopls = {
settings = {
gopls = {
gofumpt = true,
gofumpt = false,
codelenses = {
gc_details = false,
generate = true,
Expand All @@ -37,7 +37,7 @@ return {
vendor = true,
},
hints = {
assignVariableTypes = true,
assignVariableTypes = false,
compositeLiteralFields = true,
compositeLiteralTypes = true,
constantValues = true,
Expand All @@ -46,7 +46,7 @@ return {
rangeVariableTypes = true,
},
analyses = {
fieldalignment = true,
fieldalignment = false,
nilness = true,
unusedparams = true,
unusedwrite = true,
Expand All @@ -72,6 +72,7 @@ return {
}
end
end,
root_dir = { "go.mod", ".git" },
},
},
},
Expand All @@ -80,7 +81,7 @@ return {
"stevearc/conform.nvim",
opts = {
formatters_by_ft = {
go = { "goimports", "gofumpt" },
go = { "goimports", "golangci-lint" },
},
},
},
Expand Down
49 changes: 49 additions & 0 deletions lua/beastvim/features/lsp/lang/tailwind.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
return {
{
"neovim/nvim-lspconfig",
opts = {
servers = {
tailwindcss = {
-- exclude a filetype from the default_config
filetypes_exclude = { "markdown" },
-- add additional filetypes to the default_config
filetypes_include = {},
-- to fully override the default_config, change the below
-- filetypes = {}
},
},
setup = {
tailwindcss = function(_, opts)
local tw = require("lspconfig.server_configurations.tailwindcss")
opts.filetypes = opts.filetypes or {}

-- Add default filetypes
vim.list_extend(opts.filetypes, tw.default_config.filetypes)

-- Remove excluded filetypes
--- @param ft string
opts.filetypes = vim.tbl_filter(function(ft)
return not vim.tbl_contains(opts.filetypes_exclude or {}, ft)
end, opts.filetypes)

-- Add additional filetypes
vim.list_extend(opts.filetypes, opts.filetypes_include or {})
end,
},
},
},
{
"hrsh7th/nvim-cmp",
dependencies = {
{ "roobert/tailwindcss-colorizer-cmp.nvim", config = true },
},
opts = function(_, opts)
-- original LazyVim kind icon formatter
local format_kinds = opts.formatting.format
opts.formatting.format = function(entry, item)
format_kinds(entry, item) -- add icons
return require("tailwindcss-colorizer-cmp").formatter(entry, item)
end
end,
},
}
26 changes: 26 additions & 0 deletions lua/beastvim/features/lsp/ui.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
local Utils = require("beastvim.utils")

---@class beastvim.features.lsp.ui
local M = {}

setmetatable(M, {
__call = function(m, ...)
return m.setup(...)
end,
})

function M.setup()
local monokai_opts = Utils.plugin.opts("monokai-pro.nvim")

-- LSP Handlers
vim.lsp.handlers["textDocument/hover"] = vim.lsp.with(vim.lsp.handlers.hover, {
border = nil,
title = "",
})
vim.lsp.handlers["textDocument/signatureHelp"] = vim.lsp.with(vim.lsp.handlers.signature_help, {
border = nil,
title = "concac",
})
end

return M
29 changes: 13 additions & 16 deletions lua/beastvim/features/neo-tree/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ local Icons = require("beastvim.tweaks.icons")

local config = {
close_if_last_window = true, -- Close Neo-tree if it is the last window left in the tab
popup_border_style = Utils.telescope.borderchars("thick", "tl-t-tr-r-br-b-bl-l"),
popup_border_style = Utils.ui.borderchars("thick", "tl-t-tr-r-br-b-bl-l"),
sources = {
"filesystem",
"buffers",
Expand Down Expand Up @@ -87,6 +87,7 @@ config.filesystem.components = require("beastvim.features.neo-tree.sources.files
local function hideCursor()
vim.cmd([[
setlocal guicursor=n:block-Cursor
setlocal foldcolumn=0
hi Cursor blend=100
]])
end
Expand All @@ -98,22 +99,18 @@ local function showCursor()
end

local neotree_group = Utils.augroup("neo-tree_hide_cursor")
vim.api.nvim_create_autocmd({ "FileType" }, {
pattern = "neo-tree",

vim.api.nvim_create_autocmd({ "WinEnter", "BufEnter", "InsertEnter" }, {
group = neotree_group,
callback = function()
local action = vim.bo.filetype == "neo-tree" and hideCursor or showCursor
action()
end,
})
vim.api.nvim_create_autocmd({ "WinLeave", "BufLeave", "InsertEnter" }, {
group = neotree_group,
callback = function()
vim.api.nvim_create_autocmd({ "WinEnter", "BufEnter", "InsertEnter" }, {
group = neotree_group,
callback = function()
local fire = vim.bo.filetype == "neo-tree" and hideCursor or showCursor
fire()
end,
})
vim.api.nvim_create_autocmd({ "WinLeave", "BufLeave", "InsertEnter" }, {
group = neotree_group,
callback = function()
showCursor()
end,
})
showCursor()
end,
})

Expand Down
14 changes: 5 additions & 9 deletions lua/beastvim/lazy.lua
Original file line number Diff line number Diff line change
@@ -1,15 +1,9 @@
local Icons = require("beastvim.tweaks").icons
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,
})
if not (vim.uv or vim.loop).fs_stat(lazypath) then
-- stylua: ignore
vim.fn.system({ "git", "clone", "--filter=blob:none", "https://github.com/folke/lazy.nvim.git", "--branch=stable", lazypath })
end
vim.opt.rtp:prepend(lazypath)

Expand All @@ -25,6 +19,8 @@ require("lazy").setup({
{ import = "beastvim.features.lsp.lang.vue", enabled = false },
{ import = "beastvim.features.lsp.lang.go", enabled = true },
{ import = "beastvim.features.lsp.lang.docker", enabled = true },
{ import = "beastvim.features.lsp.lang.dotnet", enabled = false },
{ import = "beastvim.features.lsp.lang.tailwind", enabled = true },
},
defaults = {
lazy = true,
Expand Down
4 changes: 2 additions & 2 deletions lua/beastvim/plugins/aisync.lua
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,8 @@ return {
opts = {
api_key_cmd = "pass show OpenAI/Rockship",
openai_edit_params = {
model = "gpt-4-1106-preview",
-- model = "gpt-4",
-- model = "gpt-4-1106-preview",
model = "gpt-3.5-turbo",
frequency_penalty = 0,
presence_penalty = 0,
temperature = 0.9,
Expand Down
2 changes: 1 addition & 1 deletion lua/beastvim/plugins/coding.lua
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ return {
local hl_gr = Utils.string.capitalize("CmpItemKind" .. Utils.string.capitalize(entry.source.name))
item.kind = brain_kind
item.kind_hl_group = hl_gr
vim.api.nvim_set_hl(0, hl_gr, {fg = Icons.colors.brain[entry.source.name]})
vim.api.nvim_set_hl(0, hl_gr, { fg = Icons.colors.brain[entry.source.name] })
end
return item
end,
Expand Down
Loading

0 comments on commit 76aa349

Please sign in to comment.