aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEugene Triguba <eugenetriguba@gmail.com>2025-05-29 22:01:08 -0400
committerEugene Triguba <eugenetriguba@gmail.com>2025-05-29 22:01:08 -0400
commit8f4c022f37992f990754b2b2ff87b50aacb761d4 (patch)
tree770c436c0a3acb4ebdd2e15e6fdd4cd654fcc7d5
parentupdate neovim configuration (diff)
downloaddotfiles-8f4c022f37992f990754b2b2ff87b50aacb761d4.zip
add barbar and tweak conform/lsp
-rw-r--r--nvim/.config/nvim/lazy-lock.json2
-rw-r--r--nvim/.config/nvim/lua/plugins/barbar.lua74
-rw-r--r--nvim/.config/nvim/lua/plugins/conform.lua2
-rw-r--r--nvim/.config/nvim/lua/plugins/lsp.lua63
4 files changed, 88 insertions, 53 deletions
diff --git a/nvim/.config/nvim/lazy-lock.json b/nvim/.config/nvim/lazy-lock.json
index ea24cea..9dcafb4 100644
--- a/nvim/.config/nvim/lazy-lock.json
+++ b/nvim/.config/nvim/lazy-lock.json
@@ -1,5 +1,6 @@
{
"LuaSnip": { "branch": "master", "commit": "458560534a73f7f8d7a11a146c801db00b081df0" },
+ "barbar.nvim": { "branch": "master", "commit": "53b5a2f34b68875898f0531032fbf090e3952ad7" },
"blink.cmp": { "branch": "main", "commit": "022521a8910a5543b0251b21c9e1a1e989745796" },
"conform.nvim": { "branch": "master", "commit": "6feb2f28f9a9385e401857b21eeac3c1b66dd628" },
"fidget.nvim": { "branch": "main", "commit": "d9ba6b7bfe29b3119a610892af67602641da778e" },
@@ -26,6 +27,7 @@
"nvim-nio": { "branch": "master", "commit": "21f5324bfac14e22ba26553caf69ec76ae8a7662" },
"nvim-treesitter": { "branch": "master", "commit": "42fc28ba918343ebfd5565147a42a26580579482" },
"nvim-web-devicons": { "branch": "master", "commit": "1fb58cca9aebbc4fd32b086cb413548ce132c127" },
+ "persistence.nvim": { "branch": "main", "commit": "166a79a55bfa7a4db3e26fc031b4d92af71d0b51" },
"plenary.nvim": { "branch": "master", "commit": "857c5ac632080dba10aae49dba902ce3abf91b35" },
"telescope-fzf-native.nvim": { "branch": "main", "commit": "1f08ed60cafc8f6168b72b80be2b2ea149813e55" },
"telescope-ui-select.nvim": { "branch": "master", "commit": "6e51d7da30bd139a6950adf2a47fda6df9fa06d2" },
diff --git a/nvim/.config/nvim/lua/plugins/barbar.lua b/nvim/.config/nvim/lua/plugins/barbar.lua
new file mode 100644
index 0000000..9787b05
--- /dev/null
+++ b/nvim/.config/nvim/lua/plugins/barbar.lua
@@ -0,0 +1,74 @@
+return {
+ {
+ 'romgrk/barbar.nvim',
+ dependencies = {
+ 'lewis6991/gitsigns.nvim',
+ 'nvim-tree/nvim-web-devicons',
+ },
+ init = function()
+ vim.g.barbar_auto_setup = false
+ end,
+ version = '^1.0.0',
+ config = function()
+ require('barbar').setup {}
+
+ local map = vim.api.nvim_set_keymap
+ local opts = { noremap = true, silent = true }
+
+ -- Move to previous/next
+ map('n', '<A-,>', '<Cmd>BufferPrevious<CR>', opts)
+ map('n', '<A-.>', '<Cmd>BufferNext<CR>', opts)
+
+ -- Re-order to previous/next
+ map('n', '<A-<>', '<Cmd>BufferMovePrevious<CR>', opts)
+ map('n', '<A->>', '<Cmd>BufferMoveNext<CR>', opts)
+
+ -- Goto buffer in position...
+ map('n', '<A-1>', '<Cmd>BufferGoto 1<CR>', opts)
+ map('n', '<A-2>', '<Cmd>BufferGoto 2<CR>', opts)
+ map('n', '<A-3>', '<Cmd>BufferGoto 3<CR>', opts)
+ map('n', '<A-4>', '<Cmd>BufferGoto 4<CR>', opts)
+ map('n', '<A-5>', '<Cmd>BufferGoto 5<CR>', opts)
+ map('n', '<A-6>', '<Cmd>BufferGoto 6<CR>', opts)
+ map('n', '<A-7>', '<Cmd>BufferGoto 7<CR>', opts)
+ map('n', '<A-8>', '<Cmd>BufferGoto 8<CR>', opts)
+ map('n', '<A-9>', '<Cmd>BufferGoto 9<CR>', opts)
+ map('n', '<A-0>', '<Cmd>BufferLast<CR>', opts)
+
+ -- Pin/unpin buffer
+ map('n', '<A-p>', '<Cmd>BufferPin<CR>', opts)
+
+ -- Goto pinned/unpinned buffer
+ -- :BufferGotoPinned
+ -- :BufferGotoUnpinned
+
+ -- Close buffer
+ map('n', '<A-c>', '<Cmd>BufferClose<CR>', opts)
+
+ -- Wipeout buffer
+ -- :BufferWipeout
+
+ -- Close commands
+ -- :BufferCloseAllButCurrent
+ -- :BufferCloseAllButPinned
+ -- :BufferCloseAllButCurrentOrPinned
+ -- :BufferCloseBuffersLeft
+ -- :BufferCloseBuffersRight
+
+ -- Magic buffer-picking mode
+ map('n', '<C-p>', '<Cmd>BufferPick<CR>', opts)
+ map('n', '<C-s-p>', '<Cmd>BufferPickDelete<CR>', opts)
+
+ -- Sort automatically by...
+ map('n', '<Space>bb', '<Cmd>BufferOrderByBufferNumber<CR>', opts)
+ map('n', '<Space>bn', '<Cmd>BufferOrderByName<CR>', opts)
+ map('n', '<Space>bd', '<Cmd>BufferOrderByDirectory<CR>', opts)
+ map('n', '<Space>bl', '<Cmd>BufferOrderByLanguage<CR>', opts)
+ map('n', '<Space>bw', '<Cmd>BufferOrderByWindowNumber<CR>', opts)
+
+ -- Other:
+ -- :BarbarEnable - enables barbar (enabled by default)
+ -- :BarbarDisable - very bad command, should never be used
+ end,
+ },
+}
diff --git a/nvim/.config/nvim/lua/plugins/conform.lua b/nvim/.config/nvim/lua/plugins/conform.lua
index 8c69f30..169a0cd 100644
--- a/nvim/.config/nvim/lua/plugins/conform.lua
+++ b/nvim/.config/nvim/lua/plugins/conform.lua
@@ -75,6 +75,8 @@ return {
javascriptreact = { 'prettierd', 'prettier', stop_after_first = true },
typescriptreact = { 'prettierd', 'prettier', stop_after_first = true },
css = { 'prettierd', 'prettier', stop_after_first = true },
+ htmldjango = { 'prettierd', 'prettier', stop_after_first = true },
+ html = { 'prettierd', 'prettier', stop_after_first = true },
},
formatters = {
isort = {
diff --git a/nvim/.config/nvim/lua/plugins/lsp.lua b/nvim/.config/nvim/lua/plugins/lsp.lua
index e6e77f9..b5a68c3 100644
--- a/nvim/.config/nvim/lua/plugins/lsp.lua
+++ b/nvim/.config/nvim/lua/plugins/lsp.lua
@@ -31,31 +31,6 @@ return {
'saghen/blink.cmp',
},
config = function()
- -- Brief aside: **What is LSP?**
- --
- -- LSP is an initialism you've probably heard, but might not understand what it is.
- --
- -- LSP stands for Language Server Protocol. It's a protocol that helps editors
- -- and language tooling communicate in a standardized fashion.
- --
- -- In general, you have a "server" which is some tool built to understand a particular
- -- language (such as `gopls`, `lua_ls`, `rust_analyzer`, etc.). These Language Servers
- -- (sometimes called LSP servers, but that's kind of like ATM Machine) are standalone
- -- processes that communicate with some "client" - in this case, Neovim!
- --
- -- LSP provides Neovim with features like:
- -- - Go to definition
- -- - Find references
- -- - Autocompletion
- -- - Symbol Search
- -- - and more!
- --
- -- Thus, Language Servers are external tools that must be installed separately from
- -- Neovim. This is where `mason` and related plugins come into play.
- --
- -- If you're wondering about lsp vs treesitter, you can check out the wonderfully
- -- and elegantly composed help section, `:help lsp-vs-treesitter`
-
-- This function gets run when an LSP attaches to a particular buffer.
-- That is to say, every time a new file is opened that is associated with
-- an lsp (for example, opening `main.rs` is associated with `rust_analyzer`) this
@@ -63,11 +38,8 @@ return {
vim.api.nvim_create_autocmd('LspAttach', {
group = vim.api.nvim_create_augroup('lsp-attach', { clear = true }),
callback = function(event)
- -- NOTE: Remember that Lua is a real programming language, and as such it is possible
- -- to define small helper and utility functions so you don't have to repeat yourself.
- --
- -- In this case, we create a function that lets us more easily define mappings specific
- -- for LSP related items. It sets the mode, buffer and description for us each time.
+ -- Utility to more easily define mappings specific for LSP related items.
+ -- It sets the mode, buffer and description for us each time.
local map = function(keys, func, desc, mode)
mode = mode or 'n'
vim.keymap.set(mode, keys, func, { buffer = event.buf, desc = 'LSP: ' .. desc })
@@ -110,29 +82,13 @@ return {
-- the definition of its *type*, not where it was *defined*.
map('grt', require('telescope.builtin').lsp_type_definitions, '[G]oto [T]ype Definition')
- -- This function resolves a difference between neovim nightly (version 0.11) and stable (version 0.10)
- ---@param client vim.lsp.Client
- ---@param method vim.lsp.protocol.Method
- ---@param bufnr? integer some lsp support methods only in specific files
- ---@return boolean
- local function client_supports_method(client, method, bufnr)
- if vim.fn.has 'nvim-0.11' == 1 then
- return client:supports_method(method, bufnr)
- else
- return client.supports_method(method, { bufnr = bufnr })
- end
- end
-
-- The following two autocommands are used to highlight references of the
-- word under your cursor when your cursor rests there for a little while.
-- See `:help CursorHold` for information about when this is executed
--
-- When you move your cursor, the highlights will be cleared (the second autocommand).
local client = vim.lsp.get_client_by_id(event.data.client_id)
- if
- client
- and client_supports_method(client, vim.lsp.protocol.Methods.textDocument_documentHighlight, event.buf)
- then
+ if client and client:supports_method(vim.lsp.protocol.Methods.textDocument_documentHighlight, event.buf) then
local highlight_augroup = vim.api.nvim_create_augroup('lsp-highlight', { clear = false })
vim.api.nvim_create_autocmd({ 'CursorHold', 'CursorHoldI' }, {
buffer = event.buf,
@@ -159,7 +115,7 @@ return {
-- code, if the language server you are using supports them
--
-- This may be unwanted, since they displace some of your code
- if client and client_supports_method(client, vim.lsp.protocol.Methods.textDocument_inlayHint, event.buf) then
+ if client and client:supports_method(vim.lsp.protocol.Methods.textDocument_inlayHint, event.buf) then
map('<leader>th', function()
vim.lsp.inlay_hint.enable(not vim.lsp.inlay_hint.is_enabled { bufnr = event.buf })
end, '[T]oggle Inlay [H]ints')
@@ -197,13 +153,13 @@ return {
}
-- LSP servers and clients are able to communicate to each other what features they support.
- -- By default, Neovim doesn't support everything that is in the LSP specification.
- -- When you add blink.cmp, luasnip, etc. Neovim now has *more* capabilities.
- -- So, we create new capabilities with blink.cmp, and then broadcast that to the servers.
+ --
+ -- By default, Neovim doesn't support everything that is in the LSP specification.
+ -- When you add blink.cmp, luasnip, etc. Neovim now has *more* capabilities.
+ -- So, we create new capabilities with blink.cmp, and then broadcast that to the servers.
local capabilities = require('blink.cmp').get_lsp_capabilities()
- -- Enable the following language servers
- -- Feel free to add/remove any LSPs that you want here. They will automatically be installed.
+ -- Enable the following language servers. They will automatically be installed.
--
-- Add any additional override configuration in the following tables. Available keys are:
-- - cmd (table): Override the default command used to start the server
@@ -229,6 +185,7 @@ return {
},
},
},
+ tailwindcss = {},
}
-- Ensure the servers and tools above are installed