This commit is contained in:
sankalp committed 2024-04-01 20:57:22 +05:45
1 parent 725fde93d8
commit 974a4a7385
7 files changed
+76 -78

No files matched your search

+23 -8
View File
@@ -4,11 +4,12 @@ local o = vim.opt
local lazy = require("lazy")
-- Search current word
local searching_brave = function()
vim.fn.system({ "xdg-open", "https://search.brave.com/search?q=" .. vim.fn.expand("<cword>") })
end
map("n", "<leader>?", searching_brave, { noremap = true, silent = true, desc = "Search current word on brave search" })
-- Lazy Option
map("n", "<leader>lu", function() lazy.update() end, { desc = "Lazy Update" })
map("n", "<leader>lC", function() lazy.check() end, { desc = "Lazy Check" })
map("n", "<leader>ls", function() lazy.sync() end, { desc = "Lazy Sync" })
-- return to dir
map("n", "<leader>pv", vim.cmd.Ex)
@@ -103,7 +104,7 @@ map("n", "<a-l>", "$", { desc = "Last character of Line" })
map("v", "<C-c>", '"+y', { desc = "Yank to clipboard" })
-- Duplicate paragraph
map('n', '<Leader>p', 'yap<S-}>p', { desc = 'Duplicate Paragraph' })
map('n', '<Leader>dd', 'yap<S-}>p', { desc = 'Duplicate Paragraph' })
-- Motion
map("c", "<C-a>", "<C-b>", { desc = "Start Of Line" })
@@ -149,12 +150,15 @@ map("n", "<leader>cp", "<cmd>let @+ = expand(\"%:p\")<CR>", { desc = "Copy File
map("n", "<leader>nd", "<cmd>NoiceDismiss<CR>", {desc = "Dismiss Noice Message"})
-- Replace word under cursor across entire buffer
map("n", "<leader>r", [[:%s/\<<C-r><C-w>\>/<C-r><C-w>/gI<Left><Left><Left>]],
{ desc = "Replace word under cursor" })
map('x', '<Leader>rw', '"hy:%s/<C-r>h/<C-r>h/gc<Left><Left><Left>')
map('n', '<Leader>rw', ':%s/\\<<C-r><C-w>\\>/<C-r><C-w>/gI<Left><Left><Left>')
-- Replace all instances of highlighted words
map("v", "<leader>rr", '"hy:%s/<C-r>h//g<left><left>')
-- Cancel search highlighting with ESC
map({ "i", "n" }, "<esc>", "<cmd>noh<cr><esc>", { desc = "Clear hlsearch and ESC" })
-- Dashboard
map("n", "<leader>fd", function()
if Util.has("alpha-nvim") then
@@ -163,3 +167,14 @@ map("n", "<leader>fd", function()
vim.cmd("Dashboard")
end
end, { desc = "Dashboard" })
-- search and replace
map({ "v", "n" }, "<leader>rp", ":%s/", { desc = "Buffer search and replace" })
-- Move to the end of yanked text after yank and paste
map('n', 'p', 'p`]')
map('x', 'y', 'y`]')
map('x', 'p', 'p`]')
-- Select last pasted text
map('n', 'gp', "'`[' . strpart(getregtype(), 0, 1) . '`]'", { expr = true })
@@ -28,7 +28,7 @@ return {
"nvim-lualine/lualine.nvim",
optional = true,
opts = function(_, opts)
table.insert(opts.sections.lualine_x, 1, require("recorder").displaySlots)
table.insert(opts.sections.lualine_x, require("recorder").displaySlots)
end,
},
}
@@ -0,0 +1,37 @@
return {
{ import = "lazyvim.plugins.extras.lang.yaml" },
{
"someone-stole-my-name/yaml-companion.nvim",
ft = { "yaml" },
dependencies = {
{ "neovim/nvim-lspconfig" },
{ "nvim-lua/plenary.nvim" },
{ "nvim-telescope/telescope.nvim" },
},
opts = {},
config = function(_, opts)
local cfg = require("yaml-companion").setup(opts)
require("lspconfig")["yamlls"].setup(cfg)
LazyVim.on_load("telescope.nvim", function()
require("telescope").load_extension("yaml_schema")
end)
end,
keys = {
{ "<leader>cy", "<cmd>Telescope yaml_schema<cr>", desc = "YAML Schema" },
},
},
{
"nvim-lualine/lualine.nvim",
optional = true,
opts = function(_, opts)
local function yaml_schema()
local schema = require("yaml-companion").get_buf_schema(0)
if schema.result[1].name == "none" then
return ""
end
return schema.result[1].name
end
table.insert(opts.sections.lualine_x, 1, yaml_schema)
end,
},
}