Skip to content
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
8 changes: 4 additions & 4 deletions lua/config/autocmds.lua
Original file line number Diff line number Diff line change
Expand Up @@ -91,15 +91,15 @@ vim.api.nvim_create_autocmd({ 'UIEnter', 'ColorScheme' }, {
if not normal.bg then
return
end
io.write(string.format('\027Ptmux;\027\027]11;#%06x\007\027\\', normal.bg))
io.write(string.format('\027]11;#%06x\027\\', normal.bg))
pcall(io.write, string.format('\027Ptmux;\027\027]11;#%06x\007\027\\', normal.bg))
pcall(io.write, string.format('\027]11;#%06x\027\\', normal.bg))
end,
})

vim.api.nvim_create_autocmd('UILeave', {
callback = function()
io.write '\027Ptmux;\027\027]111;\007\027\\'
io.write '\027]111\027\\'
pcall(io.write, '\027Ptmux;\027\027]111;\007\027\\')
pcall(io.write, '\027]111\027\\')
end,
})

Expand Down
8 changes: 6 additions & 2 deletions lua/config/lazy.lua
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
local lazypath = vim.fn.stdpath 'data' .. '/lazy/lazy.nvim'
if not vim.loop.fs_stat(lazypath) then
vim.fn.system {
if not vim.uv.fs_stat(lazypath) then
local output = vim.fn.system {
'git',
'clone',
'--filter=blob:none',
'https://github.com/folke/lazy.nvim.git',
'--branch=stable',
lazypath,
}
if vim.v.shell_error ~= 0 then
vim.notify('Failed to clone lazy.nvim:\n' .. output, vim.log.levels.ERROR)
return
end
end
vim.opt.rtp:prepend(lazypath)

Expand Down
2 changes: 1 addition & 1 deletion lua/config/mappings.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ vim.keymap.set('n', '<Esc>', '<cmd>nohlsearch<CR>')
vim.keymap.set('n', '<C-[', '<cmd>nohlsearch<CR>')

-- Diagnostic keymaps
vim.keymap.set('n', '<leader>e', vim.diagnostic.open_float, { desc = 'Show diagnostic [E]rror messages' })
vim.keymap.set('n', '<leader>d', vim.diagnostic.open_float, { desc = 'Show [D]iagnostic messages' })
vim.keymap.set('n', '<leader>q', vim.diagnostic.setloclist, { desc = 'Open diagnostic [Q]uickfix list' })

-- Exit terminal mode in the builtin terminal with a shortcut that is a bit easier
Expand Down
9 changes: 7 additions & 2 deletions lua/helpers.lua
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
local M = {}

---LSPSaga helper to check for peek definition window
--- NOTE: This prevents issues like marksman LSP exiting when peek windows are created.

--- Check if buffer is an LSPSaga peek definition window.
--- LSPSaga creates special markdown preview buffers for peeking definitions.
--- These buffers should not trigger LSP/linting as they are temporary non-editable previews.
--- See: https://github.com/nvimdev/lspsaga.nvim/issues/1352
---@param bufnr number The buffer number to check.
---@return boolean true if the buffer should be linted, false otherwise.
---@return boolean true if buffer is an LSPSaga peek window, false otherwise.
function M.is_lspsaga_peek_window(bufnr)
local filetype = vim.bo[bufnr].filetype
local buftype = vim.bo[bufnr].buftype
Expand Down
9 changes: 8 additions & 1 deletion lua/plugins/comments.lua
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,14 @@ return {
{
'numToStr/Comment.nvim',
dependencies = { 'JoosepAlviste/nvim-ts-context-commentstring' },
lazy = false,
keys = {
{ 'gcc', mode = 'n', desc = 'Comment toggle current line' },
{ 'gc', mode = { 'n', 'o' }, desc = 'Comment toggle linewise' },
{ 'gc', mode = 'x', desc = 'Comment toggle linewise (visual)' },
{ 'gbc', mode = 'n', desc = 'Comment toggle current block' },
{ 'gb', mode = { 'n', 'o' }, desc = 'Comment toggle blockwise' },
{ 'gb', mode = 'x', desc = 'Comment toggle blockwise (visual)' },
},
config = function()
require('Comment').setup {
pre_hook = require('ts_context_commentstring.integrations.comment_nvim').create_pre_hook(),
Expand Down
140 changes: 72 additions & 68 deletions lua/plugins/ecolog.lua
Original file line number Diff line number Diff line change
@@ -1,79 +1,83 @@
return {
{
dir = '~/Projects/ecolog.nvim',
keys = {
{ '<leader>e', '', desc = '+ecolog', mode = { 'n', 'v' } },
{ '<leader>el', '<Cmd>EcologShelterLinePeek<cr>', desc = 'Peek line' },
{ '<leader>ey', '<Cmd>EcologCopy<cr>', desc = 'Copy value under cursor' },
{ '<leader>ei', '<Cmd>EcologInterpolationToggle<cr>', desc = 'Toggle interpolation' },
{ '<leader>eh', '<Cmd>EcologShellToggle<cr>', desc = 'Toggle shell variables' },
{ '<leader>ge', '<cmd>EcologGoto<cr>', desc = 'Go to env file' },
{ '<leader>ec', '<cmd>EcologSnacks<cr>', desc = 'Open a picker' },
{ '<leader>eS', '<cmd>EcologSelect<cr>', desc = 'Switch env file' },
{ '<leader>es', '<cmd>EcologShelterToggle<cr>', desc = 'Shelter toggle' },
-- WARN: Check if local development directory exists, fallback to official repo. Can be removed, but required for my workflow
local local_ecolog = vim.fn.expand '~/Projects/ecolog.nvim'
local use_local = vim.uv.fs_stat(local_ecolog) ~= nil

local ecolog_spec = {
[use_local and 'dir' or 'url'] = use_local and local_ecolog or 'https://github.com/ph1losof/ecolog.nvim',
keys = {
{ '<leader>e', '', desc = '+ecolog', mode = { 'n', 'v' } },
{ '<leader>el', '<Cmd>EcologShelterLinePeek<cr>', desc = 'Peek line' },
{ '<leader>ey', '<Cmd>EcologCopy<cr>', desc = 'Copy value under cursor' },
{ '<leader>ei', '<Cmd>EcologInterpolationToggle<cr>', desc = 'Toggle interpolation' },
{ '<leader>eh', '<Cmd>EcologShellToggle<cr>', desc = 'Toggle shell variables' },
{ '<leader>ge', '<cmd>EcologGoto<cr>', desc = 'Go to env file' },
{ '<leader>ec', '<cmd>EcologSnacks<cr>', desc = 'Open a picker' },
{ '<leader>eS', '<cmd>EcologSelect<cr>', desc = 'Switch env file' },
{ '<leader>es', '<cmd>EcologShelterToggle<cr>', desc = 'Shelter toggle' },
},
opts = {
preferred_environment = 'local',
types = true,
monorepo = {
enabled = true,
auto_switch = true,
notify_on_switch = false,
},
opts = {
preferred_environment = 'local',
types = true,
monorepo = {
enabled = true,
auto_switch = true,
notify_on_switch = false,
interpolation = {
enabled = true,
features = {
commands = false,
},
interpolation = {
enabled = true,
features = {
commands = false,
},
},
sort_var_fn = function(a, b)
if a.source == 'shell' and b.source ~= 'shell' then
return false
end
if a.source ~= 'shell' and b.source == 'shell' then
return true
end
},
sort_var_fn = function(a, b)
if a.source == 'shell' and b.source ~= 'shell' then
return false
end
if a.source ~= 'shell' and b.source == 'shell' then
return true
end

return a.name < b.name
end,
integrations = {
lspsaga = true,
blink_cmp = true,
snacks = true,
statusline = {
hidden_mode = true,
icons = { enabled = true, env = 'E', shelter = 'S' },
highlights = {
env_file = 'Directory',
vars_count = 'Number',
},
return a.name < b.name
end,
integrations = {
lspsaga = true,
blink_cmp = true,
snacks = true,
statusline = {
hidden_mode = true,
icons = { enabled = true, env = 'E', shelter = 'S' },
highlights = {
env_file = 'Directory',
vars_count = 'Number',
},
},
shelter = {
configuration = {
patterns = {
['DATABASE_URL'] = 'full',
},
sources = {
['.env.example'] = 'none',
},
skip_comments = false,
partial_mode = {
min_mask = 5,
show_start = 1,
show_end = 1,
},
mask_char = '*',
},
shelter = {
configuration = {
patterns = {
['DATABASE_URL'] = 'full',
},
sources = {
['.env.example'] = 'none',
},
modules = {
files = true,
peek = false,
snacks_previewer = true,
snacks = false,
cmp = true,
skip_comments = false,
partial_mode = {
min_mask = 5,
show_start = 1,
show_end = 1,
},
mask_char = '*',
},
modules = {
files = true,
peek = false,
snacks_previewer = true,
snacks = false,
cmp = true,
},
path = vim.fn.getcwd(),
},
path = vim.fn.getcwd(),
},
}

return { ecolog_spec }
5 changes: 3 additions & 2 deletions lua/plugins/formatting.lua
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
return {
{
'stevearc/conform.nvim',
lazy = false,
event = 'BufWritePre',
cmd = 'ConformInfo',
opts = {
formatters_by_ft = {
lua = { 'stylua' },
Expand Down Expand Up @@ -33,7 +34,7 @@ return {
end,
default_format_opts = {
timeout_ms = 3000,
async = false,
async = true,
quiet = false,
lsp_format = 'fallback',
},
Expand Down
32 changes: 11 additions & 21 deletions lua/plugins/lspconfig.lua
Original file line number Diff line number Diff line change
Expand Up @@ -53,15 +53,6 @@ return {
config = function()
local helpers = require 'helpers'

vim.diagnostic.config {
virtual_text = true,
signs = true,
underline = true,
update_in_insert = false,
severity_sort = true,
}
vim.o.winborder = 'rounded'

vim.api.nvim_create_autocmd('LspAttach', {
group = vim.api.nvim_create_augroup('lsp-attach', { clear = true }),
callback = function(event)
Expand Down Expand Up @@ -91,16 +82,6 @@ return {
end,
})

vim.api.nvim_create_autocmd('FileType', {
pattern = { 'sh', 'bash' },
callback = function(args)
local file_name = vim.fn.expand '%:t'
if string.match(file_name, '^%.env') then
vim.lsp.stop_client(vim.lsp.get_clients { bufnr = args.buf, name = 'bashls' })
end
end,
})

local util = require 'lspconfig/util'

local capabilities = vim.lsp.protocol.make_client_capabilities()
Expand All @@ -117,7 +98,16 @@ return {
return root_pattern(fname)
end,
},
bashls = {},
bashls = {
handlers = {
['textDocument/publishDiagnostics'] = function(err, res, ...)
local file_name = vim.fn.fnamemodify(vim.uri_to_fname(res.uri), ':t')
if string.match(file_name, '^%.env') == nil then
return on_publish_diagnostics(err, res, ...)
end
end,
},
},
tailwindcss = {
hovers = true,
suggestions = true,
Expand All @@ -133,7 +123,7 @@ return {
end,
},
marksman = {
-- This solves the problem of Marksman exiting when a new hover doc buffer (from Lspsaga) is created credits to FlawlessCasual17
-- NOTE: This solves the problem of Marksman exiting when a new hover doc buffer (from Lspsaga) is created credits to FlawlessCasual17
---@param bufnr number
autostart = function(bufnr)
if helpers.is_lspsaga_peek_window(bufnr) then
Expand Down
2 changes: 1 addition & 1 deletion lua/plugins/lspsaga.lua
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ return {
{ 'K', '<cmd>Lspsaga hover_doc<CR>', desc = 'Hover Doc' },
{ '<leader>gd', '<cmd>Lspsaga goto_definition<CR>', desc = 'Go to definition' },
{ '<leader>rn', '<cmd>Lspsaga rename<CR>', desc = 'Rename' },
{ '<leager>gp', '<cmd>Lspsaga peek_definition<CR>', desc = 'Preview Definition' },
{ '<leader>gp', '<cmd>Lspsaga peek_definition<CR>', desc = 'Preview Definition' },
{ '<leader>ca', '<cmd>Lspsaga code_action<CR>', desc = 'Code Action' },
{ '<leader>ol', '<cmd>Lspsaga outline<CR>', desc = 'Outline' },
},
Expand Down
2 changes: 1 addition & 1 deletion lua/plugins/lualine.lua
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ local oil_extension = {
lualine_a = {
function()
local ok, oil = pcall(require, 'oil')
if ok then
if ok and oil and oil.get_current_dir then
return vim.fn.fnamemodify(oil.get_current_dir(), ':~')
else
return ''
Expand Down
2 changes: 1 addition & 1 deletion lua/plugins/markdown.lua
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ return {
keys = {
{
'<leader>mp',
ft = 'markdown',
'<cmd>MarkdownPreviewToggle<cr>',
desc = 'Markdown Preview',
ft = 'markdown',
},
},
init = function()
Expand Down
7 changes: 5 additions & 2 deletions lua/plugins/morta.lua
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
return {
{
't3ntxcl3s/morta.nvim',
'ph1losof/morta.nvim',
branch = '2.0',
name = 'morta',
priority = 1000,
opts = {},
config = function()
vim.cmd.colorscheme 'morta'
local ok = pcall(vim.cmd.colorscheme, 'morta')
if not ok then
vim.notify('Failed to load morta colorscheme, using default', vim.log.levels.WARN)
end
end,
},
}
5 changes: 4 additions & 1 deletion lua/plugins/oil.lua
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,10 @@ vim.api.nvim_create_autocmd('User', {
pattern = 'OilActionsPost',
callback = function(event)
if event.data.actions.type == 'move' then
Snacks.rename.on_rename_file(event.data.actions.src_url, event.data.actions.dest_url)
local ok, snacks = pcall(require, 'snacks')
if ok and snacks and snacks.rename then
snacks.rename.on_rename_file(event.data.actions.src_url, event.data.actions.dest_url)
end
end
end,
})
Expand Down
1 change: 0 additions & 1 deletion lua/plugins/surround.lua
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
return {
{
'kylechui/nvim-surround',
version = '*', -- Use for stability; omit to use `main` branch for the latest features
event = 'VeryLazy',
config = function()
require('nvim-surround').setup {}
Expand Down
2 changes: 1 addition & 1 deletion lua/plugins/tailwind.lua
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ return {
build = ':UpdateRemotePlugins',
dependencies = {
'nvim-treesitter/nvim-treesitter',
{ 'neovim/nvim-lspconfig', version = 'v2.4.0' },
'neovim/nvim-lspconfig',
},
opts = {
document_color = { enabled = false },
Expand Down
1 change: 0 additions & 1 deletion lua/plugins/treesitter.lua
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ return {
{
'nvim-treesitter/nvim-treesitter',
build = ':TSUpdate',
dependencies = { 'windwp/nvim-ts-autotag' },
opts = {
incremental_selection = {
enable = true,
Expand Down
Loading