-
-
Notifications
You must be signed in to change notification settings - Fork 20
Expand file tree
/
Copy pathmappings.lua
More file actions
820 lines (700 loc) · 23.5 KB
/
mappings.lua
File metadata and controls
820 lines (700 loc) · 23.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
local M = {}
---@param name 'fzf-lua'|'snacks'
---@param method string
---@param args? any
---@return function -- fun()
M.picker = function(name, method, args)
return function()
return name == "snacks" and _G["Snacks"]["picker"][method](args)
or require(name)[method](args)
end
end
---Map and return with unbind function
---@return function # unbind
local function map(modes, lhs, rhs, opts)
vim.keymap.set(modes, lhs, rhs, opts)
return function()
vim.keymap.del(modes, lhs, opts)
end
end
M.map = map
---wrap handler with buffer assertions
---@return function # unbind
local function emap(modes, keys, handler, opts)
return map(modes, keys, function()
local is_in_floating_window = vim.api.nvim_win_get_config(0).relative ~= ""
if is_in_floating_window then
return ""
end
if vim.bo.buftype == "nofile" then
return ""
end
if type(handler) == "function" then
return handler()
end
return handler
end, opts)
end
map("n", "<Esc><Esc>", function()
vim.cmd.doautoall("User EscEscStart")
-- Clear / search term
vim.fn.setreg("/", "")
-- Stop highlighting searches
vim.cmd.nohlsearch()
vim.cmd.doautoall("User EscEscEnd")
vim.cmd.redraw({ bang = true })
end, { desc = "Clear UI" })
-- ===========================================================================
-- Window / Buffer manip
-- ===========================================================================
map("n", "]t", vim.cmd.tabn, { desc = "Next tab" })
map("n", "[t", vim.cmd.tabp, { desc = "Prev tab" })
map("n", "<BS>", function()
-- only in non-floating
if vim.api.nvim_win_get_config(0).relative == "" then
return "<C-^>"
end
end, {
expr = true,
desc = "Prev buffer with <BS> backspace in normal (C-^ is kinda awkward)",
})
local resizeOpts =
{ desc = "Resize window with Shift+DIR, can take a count #<S-Dir>" }
map("n", "<S-Up>", "<C-W>+", resizeOpts)
map("n", "<S-Down>", "<C-W>-", resizeOpts)
map("n", "<S-Left>", "<C-w><", resizeOpts)
map("n", "<S-Right>", "<C-w>>", resizeOpts)
map("n", "<Leader>x", function()
require("dko.utils.buffer").close()
end, { desc = "Remove buffer (try without closing window)" })
map("n", "<Leader>l", function()
require("dko.utils.loclist").toggle()
end, { desc = "Toggle location list" })
-- ===========================================================================
-- Switch mode
-- ===========================================================================
map({ "c", "i" }, "jj", "<Esc>", { desc = "Back to normal mode" })
-- ===========================================================================
-- Visual mode tweaks
-- ===========================================================================
local visualArrowOpts = { desc = "Visual move by display lines" }
map("v", "<Down>", "gj", visualArrowOpts)
map("v", "<Up>", "gk", visualArrowOpts)
-- ===========================================================================
-- cd shortcuts
-- ===========================================================================
map("n", "<Leader>cd", "<Cmd>cd! %:p:h<CR>", {
desc = "cd to current buffer path",
})
map("n", "<Leader>..", "<Cmd>cd! ..<CR>", { desc = "cd up a level" })
map("n", "<Leader>cr", function()
local root = require("dko.utils.project").get_git_root()
if root then
if vim.uv.chdir(root) == 0 then
vim.notify(root, vim.log.levels.INFO, { title = "Changed directory" })
end
end
end, { desc = "cd to current buffer's git root" })
-- ===========================================================================
-- :edit shortcuts
-- ===========================================================================
map("n", "<Leader>ecr", function()
require("dko.utils.file").edit_closest("README.md")
end, { desc = "Edit closest README.md" })
map("n", "<Leader>epj", function()
require("dko.utils.file").edit_closest("package.json")
end, { desc = "Edit closest package.json" })
map("n", "<Leader>evi", function()
vim.cmd.edit(vim.fn.stdpath("config") .. "/init.lua")
end, { desc = "Edit init.lua" })
map("n", "<Leader>evm", function()
vim.cmd.edit(vim.fn.stdpath("config") .. "/lua/dko/mappings.lua")
end, { desc = "Edit mappings.lua" })
-- =============================================================================
-- doctor
-- =============================================================================
map("n", "<A-\\>", function()
require("dko.doctor").toggle_float()
end, { desc = "Toggle dko.doctor float" })
-- ===========================================================================
-- Buffer: Reading
-- ===========================================================================
map({ "i", "n" }, "<F1>", "<NOP>", { desc = "Disable help shortcut key" })
map("n", "<F1>", function()
local help = require("dko.utils.help")
local cexpr = vim.fn.expand("<cexpr>")
local res = help.cexpr(cexpr)
if vim.env.NVIM_DEV ~= nil then
vim.print({ cexpr, res })
end
if res and pcall(vim.cmd.help, res.match) then
return
end
local line = vim.api.nvim_get_current_line()
res = help.line(line)
if vim.env.NVIM_DEV ~= nil then
vim.print({ line, res })
end
if res then
vim.cmd.help(res.match)
end
end, { desc = "Show vim help for <cexpr> or current line" })
map("n", "<Leader>yg", function()
local res = require("dko.utils.file").real_filepath()
if res then
local gr = require("dko.utils.project").get_git_root()
if gr then
res = res:gsub(gr .. "/", "")
end
vim.fn.setreg("+", res)
vim.notify(
res,
vim.log.levels.INFO,
{ title = "Yanked git relative filepath" }
)
end
end, { desc = "Yank the filepath of current buffer relative to its git root" })
map("n", "<Leader>yn", function()
local res = vim.fn.expand("%:t", false, false)
if type(res) ~= "string" then
return
end
if res == "" then
vim.notify(
"Buffer has no filename",
vim.log.levels.ERROR,
{ title = "Failed to yank filename", render = "wrapped-compact" }
)
return
end
vim.fn.setreg("+", res)
vim.notify(res, vim.log.levels.INFO, { title = "Yanked filename" })
end, { desc = "Yank the filename of current buffer" })
map("n", "<Leader>yp", function()
local res = require("dko.utils.file").real_filepath()
if res then
vim.fn.setreg("+", res)
vim.notify(res, vim.log.levels.INFO, { title = "Yanked filepath" })
end
end, { desc = "Yank the full filepath of current buffer" })
-- ===========================================================================
-- Buffer: Movement
-- ===========================================================================
map("n", "<Leader>mm", function()
require("dko.utils.movemode").toggle()
end, { desc = "Toggle move mode" })
map("", "H", "^", { desc = "Change H to alias ^" })
map("", "L", "g_", { desc = "Change L to alias g_" })
-- https://stackoverflow.com/questions/4256697/vim-search-and-highlight-but-do-not-jump#comment91750564_4257175
map("n", "*", "m`<Cmd>keepjumps normal! *``<CR>", {
desc = "Don't jump on first * -- simpler vim-asterisk",
})
-- ===========================================================================
-- Buffer: Edit contents
-- ===========================================================================
map("n", "<A-=>", function()
require("dko.utils.format").run_pipeline({ async = false })
end, {
desc = "Fix and format buffer with dko.utils.format.run_pipeline",
})
local visualTabOpts = {
desc = "<Tab> indents selected lines in Visual",
remap = true,
}
map("v", "<Tab>", ">", visualTabOpts)
map("v", "<S-Tab>", "<", visualTabOpts)
map("n", "<Leader>q", "@q", { desc = "Quickly apply macro q" })
local reselectOpts = { desc = "Reselect visual block after indent" }
map("x", "<", "<gv", reselectOpts)
map("x", ">", ">gv", reselectOpts)
map("n", "<Leader>,", "$r,", {
desc = "Replace last character with a comma",
})
map("n", "<Leader>;", "$r;", {
desc = "Replace last character with a semi-colon",
})
for _, v in pairs({ "=", "-", "." }) do
map({ "n", "i" }, "<Leader>f" .. v, function()
require("dko.utils.hr").fill(v)
end, { desc = ("Append horizontal rule of %s up to &textwidth"):format(v) })
end
map("x", "<Leader>C", function()
-- @TODO replace with https://github.com/neovim/neovim/pull/13896
vim.api.nvim_feedkeys("y", "nx", false)
local selection = vim.fn.getreg('"')
if type(selection) ~= "string" then
return
end
local converted = require("dko.utils.string").smallcaps(selection)
vim.fn.setreg('"', converted)
vim.api.nvim_feedkeys('gv""P', "nx", false)
end, { desc = "Convert selection to smallcaps" })
map("n", "dd", function()
if vim.api.nvim_get_current_line():match("^%s*$") then
return '"_dd'
else
return "dd"
end
end, { desc = "Smart dd, don't yank empty lines", expr = true })
-- ===========================================================================
-- <Tab> behavior
-- ===========================================================================
--[[ " <Tab> space or real tab based on line contents and cursor position
" The PUM is closed and characters before the cursor are not all whitespace
" so we need to insert alignment spaces (always spaces)
" Calc how many spaces, support for negative &sts values
let l:sts = (&softtabstop <= 0) ? shiftwidth() : &softtabstop
let l:sp = (virtcol('.') % l:sts)
if l:sp == 0 | let l:sp = l:sts | endif
return repeat(' ', 1 + l:sts - l:sp)
endfunction ]]
map("i", "<Tab>", function()
-- If characters all the way back to start of line were all whitespace,
-- insert whatever expandtab setting is set to do.
local current_line = require("dko.utils.buffer").get_cursorline_contents()
local all_spaces_regex = "^%s*$"
if current_line:match(all_spaces_regex) then
return "<Tab>"
end
-- Insert appropriate amount of spaces instead of real tabs
local sts = vim.bo.softtabstop <= 0 and vim.fn.shiftwidth()
or vim.bo.softtabstop
if sts == 0 then
-- untabbable
return ""
end
-- How many spaces to insert after the current cursor to get to the next sts
local spaces_from_cursor_to_next_sts = vim.fn.virtcol(".") % sts
if spaces_from_cursor_to_next_sts == 0 then
spaces_from_cursor_to_next_sts = sts
end
-- Insert whitespace to next softtabstop
-- E.g. sts = 4, cursor at _,
-- 1234123412341234
-- before abc_
-- after abc _
-- before abc _
-- after abc _
-- before abc _
-- after abc _
return (" "):rep(1 + sts - spaces_from_cursor_to_next_sts)
end, { expr = true, desc = "Tab should insert spaces" })
map("i", "<S-Tab>", "<C-d>", {
desc = "Tab inserts a tab, shift-tab should remove it",
})
-- ===========================================================================
-- Tree-sitter utils
-- ===========================================================================
map("n", "ss", function()
vim.print(vim.treesitter.get_captures_at_cursor())
end, { desc = "Print treesitter captures under cursor" })
map("n", "sy", function()
local captures = vim.treesitter.get_captures_at_cursor()
if #captures == 0 then
vim.notify(
"No treesitter captures under cursor",
vim.log.levels.ERROR,
{ title = "Yank failed", render = "wrapped-compact" }
)
return
end
local parsedCaptures = vim
.iter(captures)
:map(function(capture)
return ("@%s"):format(capture)
end)
:totable()
local resultString = vim.inspect(parsedCaptures)
vim.fn.setreg("+", resultString .. "\n")
vim.notify(
resultString,
vim.log.levels.INFO,
{ title = "Yanked capture", render = "wrapped-compact" }
)
end, { desc = "Copy treesitter captures under cursor" })
-- =============================================================================
-- LSP: vtsls
-- =============================================================================
M.bind_vtsls = function()
map("n", "<Leader>ti", "<Cmd>ChangeImportModuleSpecifier<CR>", {
desc = "vtsls: cycle importModuleSpecifier",
})
map("n", "gd", function()
require("dko.utils.typescript").go_to_source_definition(
"vtsls",
"typescript.goToSourceDefinition"
)
end, { desc = "vtsls typescript.goToSourceDefinition", buffer = true })
end
-- =============================================================================
-- External mappings
-- =============================================================================
-- ===========================================================================
-- Plugin: Comment.nvim
-- ===========================================================================
---@param tbl table
---@return table
M.with_commentnvim_mappings = function(tbl)
---LHS of operator-pending mappings in NORMAL and VISUAL mode
tbl.opleader = {
---Line-comment keymap (default gc)
line = "<Tab>",
---Block-comment keymap (gb is my blame command)
block = "<Leader>b",
}
tbl.toggler = {
---Line-comment toggle keymap
line = "<Tab><Tab>",
---Block-comment toggle keymap
block = "<Leader>B",
}
return tbl
end
-- ===========================================================================
-- Plugin: gitsigns.nvim
-- ===========================================================================
M.bind_gitsigns = function()
-- Navigation
map("n", "]h", function()
if vim.wo.diff then
return "]h"
end
---@diagnostic disable-next-line: param-type-mismatch
require("gitsigns").nav_hunk("next")
end, {
buffer = true,
desc = "Next hunk",
})
map("n", "[h", function()
if vim.wo.diff then
return "[h"
end
---@diagnostic disable-next-line: param-type-mismatch
require("gitsigns").nav_hunk("prev")
end, {
buffer = true,
desc = "Prev hunk",
})
-- Action
map("n", "gb", function()
require("gitsigns").blame_line()
end, {
buffer = true,
desc = "Popup blame for line",
})
map("n", "gB", function()
require("gitsigns").blame_line({ full = true })
end, {
buffer = true,
desc = "Popul full blame for line",
})
-- Text object
map({ "o", "x" }, "ih", "<Cmd>Gitsigns select_hunk<CR>", {
buffer = true,
desc = "Select hunk",
})
end
-- ===========================================================================
-- Plugin: inspecthi
-- ===========================================================================
M.bind_inspecthi = function()
map("n", "zs", "<Cmd>Inspecthi<CR>", {
desc = "Show highlight groups under cursor",
silent = true,
})
end
-- =============================================================================
-- Plugin: tadmccorkle/markdown.nvim
-- =============================================================================
M.bind_markdown = function(bufnr)
map("n", "<c-x>", "<Cmd>MDTaskToggle<CR>", {
buffer = bufnr,
desc = "Toggle checkbox",
})
end
-- =============================================================================
-- Plugin: nvim-redraft
-- =============================================================================
M.nvim_redraft = {
edit = "<Leader>aes",
select_model = "<Leader>aem",
}
-- =============================================================================
-- Plugin: nvim-window
-- =============================================================================
M.nvim_window = {
"<Leader>w",
"<C-w>e",
"<C-w><C-e>",
}
M.bind_nvim_window = function()
vim.iter(M.nvim_window):each(function(k)
map("n", k, function()
require("nvim-window").pick()
end, { desc = "nvim-window picker" })
end)
end
-- ===========================================================================
-- Plugin: nvim-various-textobjs
-- ===========================================================================
M.bind_nvim_various_textobjs = function()
-- Note: use <Cmd> mapping format for dot-repeatability
-- https://github.com/chrisgrieser/nvim-various-textobjs/commit/363dbb7#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R5
map({ "o", "x" }, "ai", function()
---@type "inner"|"outer" exclude the startline
local START = "outer"
---@type "inner"|"outer" exclude the endline
local END = "outer"
---@type "withBlanks"|"noBlanks"
require("various-textobjs").indentation(START, END)
vim.cmd.normal("$") -- jump to end of line like vim-textobj-indent
end, { desc = "textobj: indent" })
map({ "o", "x" }, "ii", function()
---@type "inner"|"outer" exclude the startline
local START = "inner"
---@type "inner"|"outer" exclude the endline
local END = "inner"
---@type "withBlanks"|"noBlanks"
require("various-textobjs").indentation(START, END)
vim.cmd.normal("$") -- jump to end of line like vim-textobj-indent
end, { desc = "textobj: indent" })
map("n", "<Leader>s", function()
if vim.fn.indent(".") == 0 then
return "vapk:!sort<CR>"
else
--- uses various-textobjs ii indentation
return "vii:!sort<CR>"
end
end, {
desc = "Auto select indent and sort",
expr = true,
remap = true, -- since ii is a mapping too
})
map("v", "<Leader>s", function()
return ":!sort<CR>"
end, {
desc = "Sort selection",
expr = true,
remap = true, -- since ii is a mapping too
})
map(
{ "o", "x" },
"ik",
"<Cmd>lua require('various-textobjs').key(true)<CR>",
{ desc = "textobj: object key" }
)
-- last yank or paste
map(
{ "o", "x" },
"iP",
"<Cmd>lua require('various-textobjs').lastChange()<CR>",
{ desc = "textobj: last paste" }
)
map(
{ "o", "x" },
"iv",
"<Cmd>lua require('various-textobjs').value(true)<CR>",
{ desc = "textobj: object value" }
)
map(
{ "o", "x" },
"is",
"<Cmd>lua require('various-textobjs').subword(true)<CR>",
{ desc = "textobj: camel-_Snake" }
)
map(
{ "o", "x" },
"iu",
"<Cmd>lua require('various-textobjs').url()<CR>",
{ desc = "textobj: url" }
)
-- replaces netrw's gx
map("n", "gx", require("dko.utils.links").open_link)
end
-- ===========================================================================
-- Plugin: fzf-lua
-- ===========================================================================
M.bind_fzf_terminal_mappings = function()
for _, features in pairs({
require("dko.mappings.finder").features,
require("dko.mappings.lsp").features,
}) do
for _, config in pairs(features) do
map("t", config.shortcut, function()
vim.cmd.close()
end, {
buffer = true,
desc = "Use any picker mapping to close active picker",
})
end
end
end
-- =============================================================================
-- Plugin: snacks.nvim
-- =============================================================================
M.bind_snacks_notifier = function()
map("n", "<A-n>", function()
_G["Snacks"].notifier.show_history()
end, {
desc = "Open the snacks notifier history window",
nowait = true,
})
end
-- ===========================================================================
-- Plugin: toggleterm.nvim
-- ===========================================================================
M.toggleterm = {
--- Hide active toggleterm window
hide = "<A-i>",
--- Enter to normal mode in terminal window
mode = "<A-x>",
}
local common_winbar = {
enabled = true,
---@diagnostic disable-next-line: unused-local
name_formatter = function(term)
return "<A-x>"
end,
}
local toggleterm_modes = {
horizontal = {
keybind = "<A-i>",
count = 88888,
name = "common",
winbar = common_winbar,
},
vertical = {
keybind = "<A-C-i>",
count = 88888,
name = "common",
sizefn = function()
return math.max(vim.o.columns * 0.4, 20)
end,
winbar = common_winbar,
},
float = {
keybind = "<A-S-i>",
count = 99999,
name = "floating",
},
}
M.toggleterm_all_keys = {
toggleterm_modes.horizontal.keybind,
toggleterm_modes.vertical.keybind,
toggleterm_modes.float.keybind,
}
M.bind_toggleterm = function()
local original
local terms = {}
for mode, settings in pairs(toggleterm_modes) do
-- in ANY terminal, if you press ANY toggleterm keybind, term will close
-- and refocus prev win if possible
map("t", settings.keybind, function()
vim.cmd.close()
-- on_close fires
end, { desc = "Close terminal and restore focus" })
-- =======================================================================
terms[settings.name] = terms[settings.name]
or require("toggleterm.terminal").Terminal:new({
count = settings.count,
direction = mode,
display_name = "", -- using winbar for name
on_close = vim.schedule_wrap(function()
if original then
vim.api.nvim_set_current_win(original)
original = nil
end
vim.cmd.doautocmd("WinLeave")
end),
winbar = settings.winbar,
})
emap("n", settings.keybind, function()
if vim.bo.buftype ~= "terminal" then
original = vim.api.nvim_get_current_win()
end
local size = settings.sizefn and settings.sizefn() or 15
terms[settings.name]:toggle(size, mode)
end, { desc = "Open a " .. mode .. " terminal" })
end
end
-- ===========================================================================
-- Plugin: treesj
-- ===========================================================================
M.treesj = "gs"
M.bind_treesj = function()
map("n", M.treesj, "<Cmd>TSJToggle<CR>", { silent = true })
end
-- =============================================================================
-- Plugin: treewalker
-- =============================================================================
M.bind_treewalker = function()
for _, dir in pairs({ "Up", "Down", "Left", "Right" }) do
map(
{ "n", "v" },
("<A-%s>"):format(dir),
("<Cmd>Treewalker %s<CR>"):format(dir),
{ silent = true }
)
end
end
-- ===========================================================================
-- Plugin: tw-values.nvim / tailwind-hover.nvim
-- ===========================================================================
M.twvalues = "<Leader>tw"
M.bind_twvalues = function()
map("n", M.twvalues, "<Cmd>TWValues<CR>")
end
M.tailwind_hover = "<Leader>tw"
M.bind_tailwind_hover = function()
map("n", M.tailwind_hover, "<Cmd>TailwindHover<CR>")
end
-- ===========================================================================
-- Plugin: urlview.nvim
-- ===========================================================================
M.urlview = {
menu = "<A-u>",
prev = "[u",
next = "]u",
}
M.bind_urlview = function()
require("urlview").setup({
default_action = "system",
jump = {
prev = M.urlview.prev,
next = M.urlview.next,
},
})
map("n", M.urlview.menu, "<Cmd>UrlView<CR>")
end
-- ===========================================================================
-- Plugin: yanky.nvim
-- ===========================================================================
M.bind_yanky = function()
map({ "n", "x" }, "p", "<Plug>(YankyPutAfter)", {
desc = "yanky put after",
})
map({ "n", "x" }, "P", "<Plug>(YankyPutBefore)", {
desc = "yanky put before",
})
map({ "n", "x" }, "gp", "<Plug>(YankyGPutAfter)", {
desc = "yanky gput after",
})
map({ "n", "x" }, "gP", "<Plug>(YankyGPutBefore)", {
desc = "yanky gput before",
})
map("n", "<c-n>", "<Plug>(YankyPreviousEntry)", {
desc = "yanky previous entry",
})
map("n", "<c-p>", "<Plug>(YankyNextEntry)", {
desc = "yanky next entry backward",
})
end
-- ===========================================================================
-- Plugin: zoomwintab.vim
-- ===========================================================================
M.zoomwintab = {
"<C-w>o",
"<C-w><C-o>",
}
-- ===========================================================================
return M