clean config | fix (#1225) (#1226)

This commit is contained in:
siduck 2022-06-18 09:57:17 +05:30
parent 349ee96a20
commit 9bca3eacae
16 changed files with 69 additions and 165 deletions

View file

@ -45,13 +45,3 @@ win.default_opts = function(options)
opts.border = "single"
return opts
end
vim.lsp.handlers["textDocument/signatureHelp"] = vim.lsp.with(vim.lsp.handlers.signature_help, {
border = "single",
silent = true,
focusable = false,
close_events = { "InsertCharPre", "CursorMoved" },
anchor = "SW",
relative = "cursor",
row = -1,
})

View file

@ -1,60 +0,0 @@
-- credits to @Malace : https://www.reddit.com/r/neovim/comments/ql4iuj/rename_hover_including_window_title_and/
-- This is modified version of the above snippet
local M = {}
M.open = function()
local currName = vim.fn.expand "<cword>" .. " "
local win = require("plenary.popup").create(currName, {
title = "Renamer",
style = "minimal",
borderchars = { "", "", "", "", "", "", "", "" },
relative = "cursor",
borderhighlight = "RenamerBorder",
titlehighlight = "RenamerTitle",
focusable = true,
width = 25,
height = 1,
line = "cursor+2",
col = "cursor-1",
})
local map_opts = { noremap = true, silent = true }
vim.cmd "normal w"
vim.cmd "startinsert"
vim.api.nvim_buf_set_keymap(0, "i", "<Esc>", "<cmd>stopinsert | q!<CR>", map_opts)
vim.api.nvim_buf_set_keymap(0, "n", "<Esc>", "<cmd>stopinsert | q!<CR>", map_opts)
vim.api.nvim_buf_set_keymap(
0,
"i",
"<CR>",
"<cmd>stopinsert | lua require'ui.renamer'.apply(" .. currName .. "," .. win .. ")<CR>",
map_opts
)
vim.api.nvim_buf_set_keymap(
0,
"n",
"<CR>",
"<cmd>stopinsert | lua require'ui.renamer'.apply(" .. currName .. "," .. win .. ")<CR>",
map_opts
)
end
M.apply = function(curr, win)
local newName = vim.trim(vim.fn.getline ".")
vim.api.nvim_win_close(win, true)
if #newName > 0 and newName ~= curr then
local params = vim.lsp.util.make_position_params()
params.newName = newName
vim.lsp.buf_request(0, "textDocument/rename", params)
end
end
return M

View file

@ -149,18 +149,14 @@ end
M.LSP_status = function()
local clients = vim.lsp.get_active_clients()
local names = {}
local name = false
for _, client in ipairs(clients) do
if client.attached_buffers[vim.api.nvim_get_current_buf()] then
table.insert(names, client.name)
name = client.name
break
end
end
local name = false
if next(names) then
name = table.concat(names, '|')
end
local content = name and "  LSP ~ " .. name .. " " or false
return content and ("%#St_LspStatus#" .. content) or ""
end
@ -174,19 +170,19 @@ end
M.cursor_position = function()
local left_sep = "%#St_pos_sep#" .. sep_l
local icon = "%#St_pos_icon#" .. " "
local icon = "%#St_pos_icon#" .. " "
local current_line = fn.line "."
local total_line = fn.line "$"
local text = math.modf((current_line / total_line) * 100) .. tostring "%%"
if current_line == 1 then
text = "Top "
text = "Top"
elseif current_line == total_line then
text = "Bot "
text = "Bot"
end
return left_sep .. icon .. "%#St_pos_text#" .. " " .. text
return left_sep .. icon .. "%#St_pos_text#" .. " " .. text .. " "
end
M.run = function()