Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refac: minor cleanup and improvements #291

Merged
merged 8 commits into from
Sep 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 16 additions & 17 deletions lazy-lock.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"Comment.nvim": { "branch": "master", "commit": "0236521ea582747b58869cb72f70ccfa967d2e89" },
"LuaSnip": { "branch": "master", "commit": "ea7d7ea510c641c4f15042becd27f35b3e5b3c2b" },
"LuaSnip": { "branch": "master", "commit": "c5fb16a934892086d4ba01bac48b77c65435025e" },
"animation.nvim": { "branch": "main", "commit": "fb77091ab72ec9971aee0562e7081182527aaa6a" },
"barbecue.nvim": { "branch": "main", "commit": "cd7e7da622d68136e13721865b4d919efd6325ed" },
"barbecue.nvim": { "branch": "main", "commit": "d38a2a023dfb1073dd0e8fee0c9be08855d3688f" },
"catppuccin": { "branch": "main", "commit": "85e93601e0f0b48aa2c6bbfae4d0e9d7a1898280" },
"cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" },
"cmp-nvim-lsp": { "branch": "main", "commit": "44b16d11215dce86f253ce0c30949813c0a90765" },
Expand All @@ -11,44 +11,43 @@
"cmp-under-comparator": { "branch": "master", "commit": "6857f10272c3cfe930cece2afa2406e1385bfef8" },
"cmp_luasnip": { "branch": "master", "commit": "18095520391186d634a0045dacaa346291096566" },
"friendly-snippets": { "branch": "main", "commit": "ebf6d6e83494cdd88a54a429340256f4dbb6a052" },
"git-conflict.nvim": { "branch": "main", "commit": "f20f197df50a0779ba55e933ef0995698ad32039" },
"gitsigns.nvim": { "branch": "main", "commit": "fef5d90953f0a730483b44745fae5938ba8227f8" },
"git-conflict.nvim": { "branch": "main", "commit": "896261933afe2fddf6fb043d9cd4d88301b151a9" },
"gitsigns.nvim": { "branch": "main", "commit": "bce4576a9047085a528c479a7fe1e2f6b787b6c1" },
"indent-blankline.nvim": { "branch": "master", "commit": "9637670896b68805430e2f72cf5d16be5b97a22a" },
"lazy.nvim": { "branch": "main", "commit": "2a9354c7d2368d78cbd5575a51a2af5bd8a6ad01" },
"lazygit.nvim": { "branch": "main", "commit": "75c920883f44243f2bbb172be423e484a58f7c45" },
"lspkind-nvim": { "branch": "master", "commit": "57610d5ab560c073c465d6faf0c19f200cb67e6e" },
"lualine.nvim": { "branch": "master", "commit": "45e27ca739c7be6c49e5496d14fcf45a303c3a63" },
"middleclass": { "branch": "master", "commit": "9fab4d5bca67262614960960ca35c4740eb2be2c" },
"mini.pairs": { "branch": "main", "commit": "dfa9f6e2576bb8853be277d96b735af59d9be7c2" },
"mini.surround": { "branch": "main", "commit": "9d1956b576d7051da3a483b251dfc778121c60db" },
"neo-tree.nvim": { "branch": "v2.x", "commit": "80dc74d081823649809f78370fa5b204aa9a853a" },
"neodev.nvim": { "branch": "main", "commit": "f0e574687aa51c513017155f003e8e8950ec6ff4" },
"neodev.nvim": { "branch": "main", "commit": "e9dd1535759794635a951644c183beb327879407" },
"noice.nvim": { "branch": "main", "commit": "74c2902146b080035beb19944baf6f014a954720" },
"nui.nvim": { "branch": "main", "commit": "c8de23342caf8d50b15d6b28368d36a56a69d76f" },
"null-ls.nvim": { "branch": "main", "commit": "0010ea927ab7c09ef0ce9bf28c2b573fc302f5a7" },
"nvim-bufferline.lua": { "branch": "main", "commit": "9961d87bb3ec008213c46ba14b3f384a5f520eb5" },
"nvim-bufferline.lua": { "branch": "main", "commit": "6ecd37e0fa8b156099daedd2191130e083fb1490" },
"nvim-cmp": { "branch": "main", "commit": "5dce1b778b85c717f6614e3f4da45e9f19f54435" },
"nvim-colorizer.lua": { "branch": "master", "commit": "dde3084106a70b9a79d48f426f6d6fec6fd203f7" },
"nvim-lspconfig": { "branch": "master", "commit": "d177ad277a638f262edb73c75ffe33e377b95dc5" },
"nvim-navbuddy": { "branch": "master", "commit": "b56a704323d07aac296a20bbf8274cf24e73ab32" },
"nvim-navic": { "branch": "master", "commit": "9c89730da6a05acfeb6a197e212dfadf5aa60ca0" },
"nvim-lspconfig": { "branch": "master", "commit": "4266f9bb36b4fb09edd19b67d95043cf7ff88ddf" },
"nvim-navbuddy": { "branch": "master", "commit": "f137a3466a6cd1965cdcc5398daff54e66eebbe5" },
"nvim-navic": { "branch": "master", "commit": "0ffa7ffe6588f3417e680439872f5049e38a24db" },
"nvim-notify": { "branch": "master", "commit": "94859430020f5cf32a1b97ddd9e596fed9db7981" },
"nvim-treesitter": { "branch": "master", "commit": "15d327fe6324d8269451131ec34ad4f2a8ef1e01" },
"nvim-treesitter": { "branch": "master", "commit": "b7f2dd5dfbd24a1239844e15637b637b990df164" },
"nvim-treesitter-refactor": { "branch": "master", "commit": "65ad2eca822dfaec2a3603119ec3cc8826a7859e" },
"nvim-treesitter-textobjects": { "branch": "master", "commit": "bd103502252027434ec42f628d2dbf54821d4ce6" },
"nvim-ts-autotag": { "branch": "main", "commit": "6be1192965df35f94b8ea6d323354f7dc7a557e4" },
"nvim-ts-rainbow2": { "branch": "master", "commit": "b3120cd5ae9ca524af9cb602f41e12e301fa985f" },
"nvim-web-devicons": { "branch": "master", "commit": "ecdeb4e2a4af34fc873bbfbf1f4c4e447e632255" },
"nvim-web-devicons": { "branch": "master", "commit": "973ab742f143a796a779af4d786ec409116a0d87" },
"nvim-window-picker": { "branch": "main", "commit": "1b1bb834b0acb9eebb11a61664efc665757f1ba2" },
"plenary.nvim": { "branch": "master", "commit": "0232372b906f275f76ac42029eba25eaf95e76b9" },
"schemastore.nvim": { "branch": "main", "commit": "c0874b9eb5e9aecd27e122ebfe7490516ac02bd3" },
"plenary.nvim": { "branch": "master", "commit": "9ce85b0f7dcfe5358c0be937ad23e456907d410b" },
"schemastore.nvim": { "branch": "main", "commit": "d2a3d1da007549c921f7b0e22521d1c20d09c8a7" },
"telescope-fzf-native.nvim": { "branch": "main", "commit": "6c921ca12321edaa773e324ef64ea301a1d0da62" },
"telescope-project.nvim": { "branch": "master", "commit": "7c64b181dd4e72deddcf6f319e3bf1e95b2a2f30" },
"telescope-ui-select.nvim": { "branch": "master", "commit": "62ea5e58c7bbe191297b983a9e7e89420f581369" },
"telescope.nvim": { "branch": "master", "commit": "a19770625aed49ad2a9f591a5e3946707f7359f6" },
"telescope.nvim": { "branch": "master", "commit": "40c8d2fc2b729dd442eda093cf8c9496d6e23732" },
"todo-comments.nvim": { "branch": "main", "commit": "3094ead8edfa9040de2421deddec55d3762f64d1" },
"trouble.nvim": { "branch": "main", "commit": "3f85d8ed30e97ceeddbbcf80224245d347053711" },
"typescript.nvim": { "branch": "main", "commit": "4de85ef699d7e6010528dcfbddc2ed4c2c421467" },
"vim-illuminate": { "branch": "master", "commit": "76f28e858f1caae87bfa45fb4fd09e4b053fc45b" },
"ultimate-autopair.nvim": { "branch": "v0.6", "commit": "7a8a5489c2357d805cfeab1fea41c80c0810f486" },
"vim-illuminate": { "branch": "master", "commit": "6acf7d4a18255a3ddc43770866c8e148fe85af7b" },
"windows.nvim": { "branch": "main", "commit": "c7492552b23d0ab30325e90b56066ec51242adc8" }
}
17 changes: 10 additions & 7 deletions lua/lsp/diagnostics.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,22 @@ local M = {}
M.signs = { Error = ' ', Warn = ' ', Hint = ' ', Info = ' ' }

function M.setup()
-- Automatically update diagnostics
vim.diagnostic.config({ virtual_text = false, float = _G.global.float_border_opts })

vim.lsp.handlers['workspace/diagnostic/refresh'] = function(_, _, ctx)
local ns = vim.lsp.diagnostic.get_namespace(ctx.client_id)
pcall(vim.diagnostic.reset, ns)
return true
end

for type, icon in pairs(M.signs) do
local hl = 'DiagnosticSign' .. type
vim.fn.sign_define(hl, { text = icon, texthl = hl, numhl = '' })
end

vim.lsp.handlers['textDocument/diagnostic'] = vim.lsp.with(vim.lsp.diagnostic.on_diagnostic, {
-- Use a function to dynamically turn signs off
-- and on, using buffer local variables
signs = function(namespace, bufnr)
return vim.b[bufnr].show_signs == true
end,
-- Disable a feature
update_in_insert = true,
})
end

return M
81 changes: 0 additions & 81 deletions lua/lsp/handlers.lua

This file was deleted.

2 changes: 1 addition & 1 deletion lua/lsp/neodev.lua
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ local settings = {
},
completion = {
showWord = 'Disable',
callSnippet = 'Disable',
callSnippet = 'Replace',
keywordSnippet = 'Disable',
},
workspace = {
Expand Down
9 changes: 4 additions & 5 deletions lua/plugins/autopairs.lua
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
return {
'echasnovski/mini.pairs',
event = 'VeryLazy',
config = function(_, opts)
require('mini.pairs').setup(opts)
end,
'altermo/ultimate-autopair.nvim',
event = { 'InsertEnter', 'CmdlineEnter' },
branch = 'v0.6',
opts = {},
}
6 changes: 3 additions & 3 deletions lua/plugins/lsp.lua
Original file line number Diff line number Diff line change
Expand Up @@ -137,9 +137,9 @@ return {
-- capabilities
local capabilities = client.server_capabilities

if capabilities.inlayHintProvider then
vim.lsp.buf.inlay_hint(bufnr, true)
end
u.map('n', '<leader>h', function()
vim.lsp.inlay_hint(0, nil)
end, { desc = 'Toggle Inlay Hints' })

if client.supports_method('textDocument/formatting') then
local formatting_cb = function()
Expand Down
11 changes: 0 additions & 11 deletions lua/plugins/treesitter.lua
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ return {
'nvim-treesitter/nvim-treesitter-textobjects',
'windwp/nvim-ts-autotag',
'nvim-treesitter/nvim-treesitter-refactor',
'HiPhish/nvim-ts-rainbow2',
},
config = function()
pcall(require('nvim-treesitter.install').update({ with_sync = true }))
Expand All @@ -25,7 +24,6 @@ return {
'gitattributes',
'gitignore',
'go',
'help',
'html',
'java',
'javascript',
Expand Down Expand Up @@ -107,15 +105,6 @@ return {
highlight_definitions = { enable = true },
clear_on_cursor_move = true,
},
rainbow = {
enable = true,
-- list of languages you want to disable the plugin for
disable = { 'jsx', 'cpp' },
-- Which query to use for finding delimiters
query = 'rainbow-parens',
-- Highlight the entire buffer all at once
strategy = require('ts-rainbow').strategy.global,
},
})
end,
},
Expand Down
26 changes: 0 additions & 26 deletions lua/utils.lua
Original file line number Diff line number Diff line change
Expand Up @@ -144,32 +144,6 @@ M.is_file = function(path)
return stat and stat.type == 'file'
end

M.make_floating_window = function(custom_window_config, height_ratio, width_ratio)
height_ratio = height_ratio or 0.8
width_ratio = width_ratio or 0.8

local height = math.ceil(vim.opt.lines:get() * height_ratio)
local width = math.ceil(vim.opt.columns:get() * width_ratio)
local window_config = {
relative = 'editor',
style = 'minimal',
border = 'rounded',
width = width,
height = height,
row = width / 2,
col = height / 2,
}
window_config = vim.tbl_extend('force', window_config, custom_window_config or {})

local bufnr = api.nvim_create_buf(false, true)
local winnr = api.nvim_open_win(bufnr, true, window_config)
return winnr, bufnr
end

M.get_system_output = function(cmd)
return vim.split(vim.fn.system(cmd), '\n')
end

M.get_cwd = function()
return uv.cwd
end
Expand Down