Compare commits

...

4 commits

Author SHA1 Message Date
Sanchayan Maity afd674b768
nvim: plugins: Drop nvim-lightbulb
Drop nvim-lightbulb and just add the needed functionality. This also
fixes a minor bug where the code action detection was incorrectly
being done under codeLensProvider instead of codeActionProvider.
2023-07-06 16:57:38 +05:30
Sanchayan Maity b24c03af09
nvim: plugins: Drop dirbuf and use mini.files module 2023-07-06 16:57:38 +05:30
Sanchayan Maity ea588b0556
nvim: after/plugin/mini: Drop use of align module 2023-07-06 16:57:38 +05:30
Sanchayan Maity 23a8093e25
tridactyl: Add quickmark for IETF 2023-07-06 16:38:30 +05:30
5 changed files with 69 additions and 40 deletions

View file

@ -1,15 +1,23 @@
local remap = vim.keymap.set
local opts = { noremap=true, silent=true, unique=true }
-- Align text/easy-align replacement
require('mini.align').setup({
mappings = {
start = '',
start_with_preview = 'ga',
},
})
-- Comment lines
require('mini.comment').setup()
-- File System
require('mini.files').setup({
mappings = {
close = 'q' ,
go_in = 'e' ,
go_in_plus = '<Right>',
go_out = 'n' ,
go_out_plus = '<Left>' ,
reset = '<BS>' ,
show_help = 'g?' ,
synchronize = '=' ,
trim_left = '' ,
trim_right = '' ,
}
})
-- Vertical jumps/movement
require('mini.jump2d').setup({
allowed_lines = {
@ -37,6 +45,9 @@ require('mini.surround').setup({})
require('mini.trailspace').setup({})
-- Key mappings for all mini modules we use
remap('n', '-', function()
return require('mini.files').open(vim.api.nvim_buf_get_name(0))
end, opts)
remap({ 'n', 'o', 'x' }, 'gS', function()
return require('mini.jump2d').start({
allowed_lines = {

View file

@ -1,23 +0,0 @@
require'nvim-lightbulb'.update_lightbulb {
sign = {
enabled = true,
priority = 10,
},
float = {
enabled = false,
text = "💡",
win_opts = {},
},
virtual_text = {
enabled = false,
text = "💡",
},
status_text = {
enabled = false,
text = "💡",
text_unavailable = ""
},
autocmd = {
enabled = false,
}
}

View file

@ -1,5 +1,5 @@
local protocol = require 'vim.lsp.protocol'
local lightbulb = require 'nvim-lightbulb'
local protocol = require 'vim.lsp.protocol'
local lsp_util = vim.lsp.util
vim.lsp.set_log_level("off")
@ -73,6 +73,32 @@ local lsp_key_mappings = {
{ "codeLensProvider", 'n', '<LocalLeader>L', '<cmd>lua vim.lsp.codelens.clear()<CR>' },
}
local CODE_ACTION_AVAILABLE = "CodeActionAvailable"
local CODE_ACTION_GROUP = "code-action-group"
if vim.tbl_isempty(vim.fn.sign_getdefined(CODE_ACTION_AVAILABLE)) then
vim.fn.sign_define(CODE_ACTION_AVAILABLE, { text = "💡", texthl = "DiagnosticSignInfo" })
end
local code_action_update_sign = function(old_line, new_line, bufnr)
bufnr = bufnr or "%"
if old_line then
vim.fn.sign_unplace(
CODE_ACTION_GROUP, { id = old_line, buffer = bufnr }
)
vim.b.lightbulb_line = nil
end
if new_line and (vim.b.lightbulb_line ~= new_line) then
vim.fn.sign_place(
new_line, CODE_ACTION_GROUP, CODE_ACTION_AVAILABLE, bufnr,
{ lnum = new_line, priority = 10 }
)
vim.b.lightbulb_line = new_line
end
end
local cargo_reload_workspace = function()
vim.lsp.buf_request(0, 'rust-analyzer/reloadWorkspace', nil, function(err)
if err then
@ -168,17 +194,33 @@ local on_attach = function(client, bufnr)
end
end
if client.server_capabilities.codeActionProvider then
vim.api.nvim_create_autocmd({"CursorHold", "CursorHoldI"}, {
group = lsp_augroup_id,
buffer = bufnr,
callback = function()
-- Taken from https://github.com/neovim/nvim-lspconfig/wiki/Code-Actions
local context = { diagnostics = vim.lsp.diagnostic.get_line_diagnostics() }
local params = lsp_util.make_range_params()
params.context = context
vim.lsp.buf_request(0, 'textDocument/codeAction', params, function(err, result, ctx, config)
if result and not vim.tbl_isempty(result) then
local line = params.range.start.line
code_action_update_sign(vim.b.lightbulb_line, line + 1, bufnr)
else
code_action_update_sign(vim.b.lightbulb_line, nil, bufnr)
end
end)
end
})
end
if client.server_capabilities.codeLensProvider then
vim.api.nvim_create_autocmd({"CursorHold", "CursorHoldI", "InsertLeave"}, {
group = lsp_augroup_id,
buffer = bufnr,
callback = vim.lsp.codelens.refresh,
})
vim.api.nvim_create_autocmd({"CursorHold", "CursorHoldI"}, {
group = lsp_augroup_id,
buffer = bufnr,
callback = lightbulb.update_lightbulb,
})
end
if client.server_capabilities.documentHighlightProvider then

View file

@ -15,10 +15,8 @@ require "paq" {
'tpope/vim-repeat' ,
'tpope/vim-sleuth' ,
'tpope/vim-dispatch' ,
'elihunter173/dirbuf.nvim' ,
'junegunn/vim-easy-align' ,
'nvim-lua/plenary.nvim' ,
'kosayoda/nvim-lightbulb' ,
'mfussenegger/nvim-lint' ,
'nvim-treesitter/nvim-treesitter' ,
'mfussenegger/nvim-treehopper' ,

View file

@ -19,7 +19,8 @@ quickmark c https://chat.asymptotic.io/#/welcome
quickmark C https://www.online.citibank.co.in/portal/pdf/card-Rate.pdf
quickmark f https://instantforex.icicibank.com/instantforex/forms/MicroCardRateView.aspx
quickmark F https://www.hdfcbank.com/content/bbp/repositories/723fb80a-2dde-42a3-9793-7ae1be57c87f/?path=/Personal/Home/content/rates.pdf
quickmark r https://reddit.com
quickmark r https://datatracker.ietf.org/
quickmark R https://reddit.com
quickmark e https://www.reddit.com/r/emacs
quickmark h https://www.reddit.com/r/haskell
quickmark n https://www.reddit.com/r/neovim