Skip to content

Commit

Permalink
feat: upgrade extras with 'recommended'
Browse files Browse the repository at this point in the history
  • Loading branch information
rafi committed May 18, 2024
1 parent 13b5008 commit 6667d5c
Show file tree
Hide file tree
Showing 11 changed files with 75 additions and 13 deletions.
4 changes: 2 additions & 2 deletions lua/rafi/config/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ function M.init()
-- Add lua/*/plugins/extras as list of "extra" sources
LazyVim.extras.sources = {
{
name = 'LazyVim',
name = 'LazyVim',
desc = 'LazyVim extras',
module = 'lazyvim.plugins.extras',
},
Expand All @@ -90,7 +90,7 @@ function M.init()
{
name = 'User ',
desc = 'User extras',
module = 'plugins.extras'
module = 'plugins.extras',
},
}
end
Expand Down
6 changes: 6 additions & 0 deletions lua/rafi/plugins/extras/lang/ansible.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@
--

return {
recommended = function()
return LazyVim.extras.wants({
ft = 'yaml.ansible',
root = { 'ansible.cfg', '.ansible-lint' },
})
end,

{
'nvim-treesitter/nvim-treesitter',
Expand Down
12 changes: 12 additions & 0 deletions lua/rafi/plugins/extras/lang/docker.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,18 @@
-- See: https://github.com/LazyVim/LazyVim/blob/main/lua/lazyvim/plugins/extras/lang/docker.lua

return {
recommended = function()
return LazyVim.extras.wants({
ft = 'dockerfile',
root = {
'Dockerfile',
'docker-compose.yml',
'compose.yml',
'docker-compose.yaml',
'compose.yaml',
},
})
end,

{
'nvim-treesitter/nvim-treesitter',
Expand Down
6 changes: 6 additions & 0 deletions lua/rafi/plugins/extras/lang/go.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@
-- See: https://github.com/LazyVim/LazyVim/blob/main/lua/lazyvim/plugins/extras/lang/go.lua

return {
recommended = function()
return LazyVim.extras.wants({
ft = { 'go', 'gomod', 'gowork', 'gotmpl' },
root = { 'go.work', 'go.mod' },
})
end,

{
'nvim-treesitter/nvim-treesitter',
Expand Down
6 changes: 6 additions & 0 deletions lua/rafi/plugins/extras/lang/markdown.lua
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
return {
recommended = function()
return LazyVim.extras.wants({
ft = 'markdown',
root = 'README.md',
})
end,

{
'nvim-treesitter/nvim-treesitter',
Expand Down
19 changes: 16 additions & 3 deletions lua/rafi/plugins/extras/lang/python.lua
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,27 @@
if lazyvim_docs then
-- LSP Server to use for Python.
-- Set to "basedpyright" to use basedpyright instead of pyright.
vim.g.lazyvim_python_lsp = "pyright"
vim.g.lazyvim_python_lsp = 'pyright'
vim.g.lazyvim_python_ruff = 'ruff_lsp'
end

local lsp = vim.g.lazyvim_python_lsp or 'pyright'
local ruff = vim.g.lazyvim_python_ruff or 'ruff_lsp'

return {
recommended = function()
return LazyVim.extras.wants({
ft = 'python',
root = {
'pyproject.toml',
'setup.py',
'setup.cfg',
'requirements.txt',
'Pipfile',
'pyrightconfig.json',
},
})
end,

{
'nvim-treesitter/nvim-treesitter',
Expand Down Expand Up @@ -51,10 +64,10 @@ return {
enabled = true,
},
ruff_lsp = {
enabled = ruff == "ruff_lsp",
enabled = ruff == 'ruff_lsp',
},
ruff = {
enabled = ruff == "ruff",
enabled = ruff == 'ruff',
},
[ruff] = {
keys = {
Expand Down
5 changes: 5 additions & 0 deletions lua/rafi/plugins/extras/lang/yaml.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@
-- See: https://github.com/LazyVim/LazyVim/blob/main/lua/lazyvim/plugins/extras/lang/yaml.lua

return {
recommended = function()
return LazyVim.extras.wants({
ft = 'yaml',
})
end,

{
'nvim-treesitter/nvim-treesitter',
Expand Down
1 change: 1 addition & 0 deletions lua/rafi/plugins/extras/lsp/gtd.lua
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ return {
desc = 'Go to definition or file',
},
},
---@diagnostic disable-next-line: undefined-doc-name
---@type gtd.kit.App.Config.Schema
opts = {
sources = {
Expand Down
6 changes: 3 additions & 3 deletions lua/rafi/plugins/extras/ui/symbols-outline.lua
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,14 @@ return {
local filter = Config.kind_filter

if type(filter) == 'table' then
filter = filter.default
if type(filter) == 'table' then
local default = filter.default
if type(default) == 'table' then
for kind, symbol in pairs(defaults.symbols) do
opts.symbols[kind] = {
icon = Config.icons.kinds[kind] or symbol.icon,
hl = symbol.hl,
}
if not vim.tbl_contains(filter, kind) then
if not vim.tbl_contains(default, kind) then
table.insert(opts.symbol_blacklist, kind)
end
end
Expand Down
5 changes: 3 additions & 2 deletions lua/rafi/plugins/lsp/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ return {
-- Be aware that you also will need to properly configure your LSP server
-- to provide the inlay hints.
inlay_hints = {
enabled = true,
enabled = false,
},
-- Enable this to enable the builtin LSP code lenses on Neovim >= 0.10.0
-- Be aware that you also will need to properly configure your LSP server to
Expand Down Expand Up @@ -191,7 +191,7 @@ return {

vim.diagnostic.config(vim.deepcopy(opts.diagnostics))

-- Enable rounded borders in :LspInfo window.
-- Enable custom rounded borders in :LspInfo window.
require('lspconfig.ui.windows').default_options.border = 'rounded'

-- Initialize LSP servers and ensure Mason packages
Expand Down Expand Up @@ -225,6 +225,7 @@ return {
end
end

-- Load user-defined custom settings for each LSP server.
local exists, module = pcall(require, 'lsp.' .. server_name)
if exists and module ~= nil then
local user_config = module.config(server_opts) or {}
Expand Down
18 changes: 15 additions & 3 deletions lua/rafi/plugins/ui.lua
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,12 @@ return {
-- indicator = {
-- style = 'underline',
-- },
close_command = function(n) LazyVim.ui.bufremove(n) end,
right_mouse_command = function(n) LazyVim.ui.bufremove(n) end,
close_command = function(n)
LazyVim.ui.bufremove(n)
end,
right_mouse_command = function(n)
LazyVim.ui.bufremove(n)
end,
diagnostics_indicator = function(_, _, diag)
local icons = require('lazyvim.config').icons.diagnostics
local ret = (diag.error and icons.Error .. diag.error .. ' ' or '')
Expand Down Expand Up @@ -130,7 +134,7 @@ return {
config = function(_, opts)
require('bufferline').setup(opts)
-- Fix bufferline when restoring a session
vim.api.nvim_create_autocmd('BufAdd', {
vim.api.nvim_create_autocmd({ 'BufAdd', 'BufDelete' }, {
callback = function()
vim.schedule(function()
---@diagnostic disable-next-line: undefined-global
Expand Down Expand Up @@ -321,6 +325,14 @@ return {
},
},
},
config = function(_, opts)
if vim.fn.has('nvim-0.10.0') == 0 then
local utils = require('ibl.utils')
---@diagnostic disable-next-line: deprecated
utils.tbl_join = vim.tbl_flatten
end
require('ibl').setup(opts)
end,
},

-----------------------------------------------------------------------------
Expand Down

0 comments on commit 6667d5c

Please sign in to comment.