Compare commits
5 commits
351b2ca472
...
67b50ac321
| Author | SHA1 | Date | |
|---|---|---|---|
| 67b50ac321 | |||
| 14511ca5b1 | |||
| d5d97effcd | |||
| 7dfeaeead3 | |||
| d7ac4a8091 |
7 changed files with 100 additions and 25 deletions
|
|
@ -17,7 +17,6 @@
|
|||
# будет пытаться установить расширения в каталог nix store, куда нельзя что либо ставить без рута.
|
||||
packages = with pkgs; [
|
||||
vscode # Надо в home.packages писать, чтоб расширения ставились без рута
|
||||
jetbrains-toolbox # https://nixos.wiki/wiki/Jetbrains_Tools
|
||||
];
|
||||
|
||||
sessionVariables = {
|
||||
|
|
|
|||
|
|
@ -461,11 +461,6 @@
|
|||
|
||||
neovim
|
||||
|
||||
# Закинул в home.nix
|
||||
# vscode
|
||||
# jetbrains-toolbox
|
||||
# zed-editor
|
||||
|
||||
###########
|
||||
## Icons ##
|
||||
###########
|
||||
|
|
|
|||
|
|
@ -94,6 +94,12 @@ require('lazy').setup({
|
|||
-- Plugins for color highlight
|
||||
require 'custom.plugins.colorizer',
|
||||
|
||||
-- Symbol usage plugin
|
||||
require 'custom.plugins.symbol_usage',
|
||||
|
||||
-- Adding history for nvim clipboard
|
||||
require 'custom.plugins.clip_history',
|
||||
|
||||
-- Autoformat markdown tables
|
||||
{
|
||||
'Kicamon/markdown-table-mode.nvim',
|
||||
|
|
|
|||
|
|
@ -37,6 +37,7 @@
|
|||
"nvim-dap-ui": { "branch": "master", "commit": "bc81f8d3440aede116f821114547a476b082b319" },
|
||||
"nvim-lint": { "branch": "master", "commit": "6e9dd545a1af204c4022a8fcd99727ea41ffdcc8" },
|
||||
"nvim-lspconfig": { "branch": "master", "commit": "8a1529e46eef5efc86c34c8d9bdd313abc2ecba0" },
|
||||
"nvim-neoclip.lua": { "branch": "main", "commit": "831a97c7697736411a05ff8b91e8798ea4c2d6fb" },
|
||||
"nvim-nio": { "branch": "master", "commit": "21f5324bfac14e22ba26553caf69ec76ae8a7662" },
|
||||
"nvim-treesitter": { "branch": "master", "commit": "2586ea65faf45dcf1caf8d34510d50bb545c215a" },
|
||||
"nvim-treesitter-context": { "branch": "master", "commit": "129fcc94fa986692926366e940a46f00d2a4abbe" },
|
||||
|
|
@ -45,6 +46,7 @@
|
|||
"rose-pine": { "branch": "main", "commit": "7d1b5c7dcd274921f0f58e90a8bf935f6a95fbf3" },
|
||||
"rustaceanvim": { "branch": "master", "commit": "2b0f0b7e03751cf8ed123322f9b02d8f73fa9df7" },
|
||||
"sonokai": { "branch": "master", "commit": "9679341d4141ed81376f2bdf5e69b78dc348d212" },
|
||||
"symbol-usage.nvim": { "branch": "main", "commit": "e07c07dfe7504295a369281e95a24e1afa14b243" },
|
||||
"telescope-fzf-native.nvim": { "branch": "main", "commit": "1f08ed60cafc8f6168b72b80be2b2ea149813e55" },
|
||||
"telescope-ui-select.nvim": { "branch": "master", "commit": "6e51d7da30bd139a6950adf2a47fda6df9fa06d2" },
|
||||
"telescope.nvim": { "branch": "0.1.x", "commit": "a0bbec21143c7bc5f8bb02e0005fa0b982edc026" },
|
||||
|
|
|
|||
14
nvim/lua/custom/plugins/clip_history.lua
Normal file
14
nvim/lua/custom/plugins/clip_history.lua
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
-- Adding history for nvim clipboard
|
||||
|
||||
return {
|
||||
{
|
||||
'AckslD/nvim-neoclip.lua',
|
||||
dependencies = {
|
||||
{ 'nvim-telescope/telescope.nvim' },
|
||||
},
|
||||
config = function()
|
||||
require('neoclip').setup()
|
||||
vim.keymap.set('n', '<leader>sc', ':Telescope neoclip<CR>', { desc = '[S]earch [C]lip history' })
|
||||
end,
|
||||
},
|
||||
}
|
||||
78
nvim/lua/custom/plugins/symbol_usage.lua
Normal file
78
nvim/lua/custom/plugins/symbol_usage.lua
Normal file
|
|
@ -0,0 +1,78 @@
|
|||
-- Symbol usage plugin
|
||||
|
||||
local SymbolKind = vim.lsp.protocol.SymbolKind
|
||||
|
||||
local function h(name)
|
||||
return vim.api.nvim_get_hl(0, { name = name })
|
||||
end
|
||||
|
||||
-- hl-groups can have any name
|
||||
vim.api.nvim_set_hl(0, 'SymbolUsageRounding', { fg = h('CursorLine').bg, italic = true })
|
||||
vim.api.nvim_set_hl(0, 'SymbolUsageContent', { bg = h('CursorLine').bg, fg = h('Comment').fg, italic = true })
|
||||
vim.api.nvim_set_hl(0, 'SymbolUsageRef', { fg = h('Function').fg, bg = h('CursorLine').bg, italic = true })
|
||||
vim.api.nvim_set_hl(0, 'SymbolUsageDef', { fg = h('Type').fg, bg = h('CursorLine').bg, italic = true })
|
||||
vim.api.nvim_set_hl(0, 'SymbolUsageImpl', { fg = h('@keyword').fg, bg = h('CursorLine').bg, italic = true })
|
||||
|
||||
local function text_format(symbol)
|
||||
local res = {}
|
||||
|
||||
local round_start = { '', 'SymbolUsageRounding' }
|
||||
local round_end = { '', 'SymbolUsageRounding' }
|
||||
|
||||
-- Indicator that shows if there are any other symbols in the same line
|
||||
local stacked_functions_content = symbol.stacked_count > 0 and ('+%s'):format(symbol.stacked_count) or ''
|
||||
|
||||
if symbol.references then
|
||||
local usage = symbol.references <= 1 and 'usage' or 'usages'
|
||||
local num = symbol.references == 0 and 'no' or symbol.references
|
||||
table.insert(res, round_start)
|
||||
table.insert(res, { ' ', 'SymbolUsageRef' })
|
||||
table.insert(res, { ('%s %s'):format(num, usage), 'SymbolUsageContent' })
|
||||
table.insert(res, round_end)
|
||||
end
|
||||
|
||||
if symbol.definition then
|
||||
if #res > 0 then
|
||||
table.insert(res, { ' ', 'NonText' })
|
||||
end
|
||||
table.insert(res, round_start)
|
||||
table.insert(res, { ' ', 'SymbolUsageDef' })
|
||||
table.insert(res, { symbol.definition .. ' defs', 'SymbolUsageContent' })
|
||||
table.insert(res, round_end)
|
||||
end
|
||||
|
||||
if symbol.implementation then
|
||||
if #res > 0 then
|
||||
table.insert(res, { ' ', 'NonText' })
|
||||
end
|
||||
table.insert(res, round_start)
|
||||
table.insert(res, { ' ', 'SymbolUsageImpl' })
|
||||
table.insert(res, { symbol.implementation .. ' impls', 'SymbolUsageContent' })
|
||||
table.insert(res, round_end)
|
||||
end
|
||||
|
||||
if stacked_functions_content ~= '' then
|
||||
if #res > 0 then
|
||||
table.insert(res, { ' ', 'NonText' })
|
||||
end
|
||||
table.insert(res, round_start)
|
||||
table.insert(res, { ' ', 'SymbolUsageImpl' })
|
||||
table.insert(res, { stacked_functions_content, 'SymbolUsageContent' })
|
||||
table.insert(res, round_end)
|
||||
end
|
||||
|
||||
return res
|
||||
end
|
||||
|
||||
return {
|
||||
{
|
||||
'Wansmer/symbol-usage.nvim',
|
||||
event = 'LspAttach', -- need run before LspAttach if you use nvim 0.9. On 0.10 use 'LspAttach'
|
||||
config = function()
|
||||
require('symbol-usage').setup {
|
||||
text_format = text_format,
|
||||
kinds = { SymbolKind.Function, SymbolKind.Method, SymbolKind.Class, SymbolKind.Struct, SymbolKind.Variable, SymbolKind.Constant },
|
||||
}
|
||||
end,
|
||||
},
|
||||
}
|
||||
|
|
@ -208,25 +208,6 @@ return {
|
|||
-- local util = require 'lspconfig.util'
|
||||
local lspconfig = require 'lspconfig'
|
||||
|
||||
-- require('lspconfig.configs').postgres_lsp = {
|
||||
-- default_config = {
|
||||
-- name = 'postgres_lsp',
|
||||
-- cmd = { 'postgres_lsp' },
|
||||
-- filetypes = { 'sql' },
|
||||
-- single_file_support = true,
|
||||
-- root_dir = util.root_pattern 'root-file.txt',
|
||||
-- },
|
||||
-- }
|
||||
|
||||
-- SQL
|
||||
-- lspconfig.postgres_lsp.setup { force_setup = true }
|
||||
lspconfig.sqls.setup {
|
||||
on_attach = function(client)
|
||||
-- Выключить форматирование
|
||||
client.server_capabilities.documentFormattingProvider = false
|
||||
end,
|
||||
}
|
||||
|
||||
-- Nix
|
||||
lspconfig.nixd.setup {}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue