-
Notifications
You must be signed in to change notification settings - Fork 0
/
config.norg
3223 lines (3027 loc) · 104 KB
/
config.norg
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
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
@document.meta
title: Neovim Config
description: My personal neovim config
authors: Simon H Moore
categories: [
config
neovim
lua
]
tangle: {
languages: {
lua: ./lua/config.lua
}
}
created: 2024-03-06T23:01:44+0100
updated: 2024-03-20T22:36:41+0100
version: 1.1.1
@end
.toc TABLE OF CONTENTS
* INSTALL INSTRUCTIONS
All of my main config is contained in this file `config.norg`, to be able to use this config you have to first `tangle` the file to generate the `config.lua` file.
___
1. Create `lua` directory.
A `lua` directory is needed so that the `config.lua` file can be crated inside of it.
Run the below command inside of your shell at the root of this config:
@code sh
mkdir lua
@end
2. Open Neovim to bootstrap the config.
A. Because the Lazy.nvim package manager and Neorg plugin is required to `tangle` the config, you have to bootstrap the config for the first time.
Don't worry this happens automatically, you just have to open Neovim by running:
@code sh
nvim
@end
You will see some errors pop up, don't worry about them this just happens because Neovim expects there to be a config which is not there yet.
B. After this is done, close Neovim again by running the below command:
@code vim
:qa
@end
4. Tangle the `config.norg` file.
A. Last, we need to `tangle` the config.norg file, to do so open the file with Neovim by running the following command:
@code sh
nvim config.norg
@end
B. After the `config.norg` file is opened in Neovim, run the following command inside Neovim:
@code vim
:Neorg tangle
@end
Neovim will ask you which file to tangle, select `config.norg`
5. Reopen Neovim and enjoy
Close and reopen Neovim and the `Lazy` plugin manager will install everything needed.
You might have to reopen Neovim a few times to make sure everything is installed.
* SETUP VARIABLES AND FUNCTIONS
** Leader keys
Used by many plugins for keybindings, need to be set early as plugins can be dependant on it.
___
@code lua
vim.g.mapleader = ' '
vim.g.maplocalleader = ' '
@end
** API Variables
Declare common API variables, will be used throughout the config.
___
@table
| Variable | Value | Descriptions |
|----------+---------+------------------------|
| o | vim.opt | Inbuilt vim options |
| g | vim.g | Inbuilt global options |
| cmd | vim.cmd | Run vim ex commands |
@end
@code lua
local o = vim.opt
local g = vim.g
local cmd = vim.cmd
@end
** Global Print Table Function
The `P()` function can be used globally to print a lua table for inspection.
___
@code lua
P = function(v)
print(vim.inspect(v))
return v
end
@end
** Lazy Helper Function
The `plug()` function is used to add plugins to the `plugins` table.
The `plugins` table will be used by lazy to install and load plugins.
___
@code lua
local plugins = {}
function plug(plugin)
plugins[#plugins +1] = plugin
end
@end
* OPTIONS
Configure inbuilt Neovim options.
___
@code lua
o.autowrite = true -- Enable auto write
o.clipboard = "unnamedplus" -- Sync with system clipboard
o.completeopt = "menu,menuone,noselect"
o.conceallevel = 3 -- Hide * markup for bold and italic
o.confirm = true -- Confirm to save changes before exiting modified buffer
o.cursorline = true -- Enable highlighting of the current line
o.breakindent = true -- Every like wrapped will honor indent
o.expandtab = true -- Use spaces instead of tabs
o.formatoptions = "jcroqlnt" -- tcqj
o.grepformat = "%f:%l:%c:%m"
o.grepprg = "rg --vimgrep"
o.ignorecase = true -- Ignore case
o.inccommand = "nosplit" -- preview incremental substitute
o.laststatus = 0
o.list = true -- Show some invisible characters (tabs...
o.mouse = "a" -- Enable mouse mode
o.number = true -- Print line number
o.pumblend = 10 -- Popup blend
o.pumheight = 10 -- Maximum number of entries in a popup
o.relativenumber = true -- Relative line numbers
o.scrolloff = 4 -- Lines of context
o.sessionoptions = { "buffers", "curdir", "tabpages", "winsize" }
o.shiftround = true -- Round indent
o.shiftwidth = 2 -- Size of an indent
o.shortmess:append({ W = true, I = true, c = true })
o.showmode = false -- Dont show mode since we have a statusline
o.sidescrolloff = 8 -- Columns of context
o.signcolumn = "yes" -- Always show the signcolumn, otherwise it would shift the text each time
o.smartcase = true -- Don't ignore case with capitals
o.smartindent = true -- Insert indents automatically
o.spelllang = { "en" }
o.splitbelow = true -- Put new windows below current
o.splitright = true -- Put new windows right of current
o.tabstop = 2 -- Number of spaces tabs count for
o.termguicolors = true -- True color support
o.timeoutlen = 300
o.undofile = true
o.undolevels = 10000
o.updatetime = 200 -- Save swap file and trigger CursorHold
o.wildmode = "longest:full,full" -- Command-line completion mode
o.winminwidth = 5 -- Minimum window width
o.wrap = false -- Disable line wrap
o.foldlevelstart = 0 -- Enable foldlevel when opening file
o.foldnestmax = 2 -- Set max nested foldlevel
vim.opt.foldenable = true
vim.opt.foldmethod = "expr"
vim.opt.foldexpr = "v:lua.vim.treesitter.foldexpr()"
vim.o.foldtext = ''
vim.o.fillchars = 'fold: '
if vim.fn.has("nvim-0.9.0") == 1 then
o.splitkeep = "screen"
o.shortmess:append({ C = true })
end
-- use powershell on windows
if vim.fn.has("win32") == 1 then
o.shell = vim.fn.executable "pwsh" == 1 and "pwsh" or "powershell"
o.shellcmdflag =
"-NoLogo -NoProfile -ExecutionPolicy RemoteSigned -Command [Console]::InputEncoding=[Console]::OutputEncoding=[System.Text.Encoding]::UTF8;"
o.shellredir = "-RedirectStandardOutput %s -NoNewWindow -Wait"
o.shellpipe = "2>&1 | Out-File -Encoding UTF8 %s; exit LastExitCode"
o.shellquote = ""
o.shellxquote = ""
end
-- if in a wsl environment WSL_DISTRO_NAME should be set
local in_wsl = os.getenv('WSL_DISTRO_NAME') ~= nil
if in_wsl then
-- Need to install win32yank in windows
-- see https://mitchellt.com/2022/05/15/WSL-Neovim-Lua-and-the-Windows-Clipboard.html
vim.g.clipboard = {
name = "win32yank-wsl",
copy = {
["+"] = "win32yank.exe -i --crlf",
["*"] = "win32yank.exe -i --crlf",
},
paste = {
["+"] = "win32yank.exe -o --lf",
["*"] = "win32yank.exe -o --lf",
},
cache_enabled = true,
}
end
@end
* SYNTAX HIGHLIGHTS & COLOR
Here I set up the color and syntax used in Neovim buffers.
___
** Options
Enable true color support:
___
@code lua
o.termguicolors = true
@end
** Gruvebox Colorscheme
A port of gruvbox community theme to lua with treesitter and semantic highlights support.
___
@code lua
plug({
"ellisonleao/gruvbox.nvim",
enabled = true,
lazy = false,
priority = 10000,
config = function()
require("gruvbox").setup({
transparent_mode = true,
terminal_colors = false, -- disable gruvbox in terminal
overrides = {
Folded = { bg = "#202020" },
-- fix markdown todo colors
["@lsp.type.class.markdown"] = { fg = "#000000" },
["@neorg.tags.ranged_verbatim.code_block"] = { bg = "#222222" },
}
})
o.background = "dark"
g.gruvbox_italic = true
g.gruvbox_bold = false
g.gruvbox_transparent_bg = true
g.gruvbox_constrast_dark = "hard"
g.gruvbox_improved_strings = false
cmd([[colorscheme gruvbox]])
end,
})
@end
** Indent Blankline
This plugin adds indentation guides to all lines.
___
@code lua
plug({
"lukas-reineke/indent-blankline.nvim",
enabled = true,
event = { "BufReadPost", "BufNewFile" },
main = "ibl",
opts = {
exclude = {
filetypes = {
"help",
"alpha",
"dashboard",
"fugitive",
"neo-tree",
"Trouble",
"lazy",
"mason",
"notify",
"toggleterm",
"lazyterm",
"lspinfo",
"packer",
"checkhealth",
"help",
"man",
"gitcommit",
"TelescopePrompt",
"TelescopeResults",
},
},
},
})
@end
** Colorizer
Color highlighter, shows color of color codes
___
@code lua
plug({
"norcalli/nvim-colorizer.lua",
enabled = true,
event = { "BufReadPost", "BufNewFile" },
opts = {
default_options = {
RGB = true,
RRGGBB = true,
names = true,
RRGGBBAA = true,
rgb_fn = true,
hsl_fn = true,
css = true,
css_fn = true,
mode = "background",
},
"*", -- highlight all files
},
})
@end
** Rainbow
Use different colors for matching brackets.
___
@code lua
plug({
"p00f/nvim-ts-rainbow",
event = { "BufReadPost", "BufNewFile" },
main = 'nvim-treesitter.configs',
opts = {
-- for nvim-ts-rainbow plugin
rainbow = {
enable = true,
extended_mode = true, -- Also highlight non-bracket delimiters like html tags, boolean or table: lang -> boolean
max_file_lines = 10000, -- Do not enable for files with more than 10000 lines, int
-- colors = {}, -- table of hex strings
-- termcolors = {} -- table of colour name strings
},
}
})
@end
** Sentiment
To highlight the outer pair of brackets/parenthesis.
___
@code lua
plug({
"utilyre/sentiment.nvim",
version = "*",
event = "VeryLazy", -- keep for lazy loading
opts = {
-- config
},
init = function()
-- `matchparen.vim` needs to be disabled manually in case of lazy loading
vim.g.loaded_matchparen = 1
end,
})
@end
** Headlines
This plugin adds highlights for text filetypes, like markdown, orgmode, and neorg.
___
[GitHub]{https://github.com/lukas-reineke/headlines.nvim}
@code lua
plug({
"lukas-reineke/headlines.nvim",
dependencies = "nvim-treesitter/nvim-treesitter",
config = function()
vim.cmd [[highlight Headline1 guibg=#1e2718]]
vim.cmd [[highlight Headline2 guibg=#21262d]]
vim.cmd [[highlight CodeBlock guibg=#1c1c1c]]
vim.cmd [[highlight Dash guibg=#D19A66 gui=bold]]
require("headlines").setup {
norg = {
query = vim.treesitter.query.parse(
"norg",
[[
[
(heading1_prefix)
(heading2_prefix)
(heading3_prefix)
(heading4_prefix)
(heading5_prefix)
(heading6_prefix)
] @headline
(weak_paragraph_delimiter) @dash
(strong_paragraph_delimiter) @doubledash
([(ranged_tag
name: (tag_name) @_name
(#eq? @_name "code")
)
(ranged_verbatim_tag
name: (tag_name) @_name
(#eq? @_name "code")
)] @codeblock (#offset! @codeblock 0 0 1 0))
(quote1_prefix) @quote
]]
),
headline_highlights = { "Headline1", "Headline2" },
bullet_highlights = {
"@neorg.headings.1.prefix",
"@neorg.headings.2.prefix",
"@neorg.headings.3.prefix",
"@neorg.headings.4.prefix",
"@neorg.headings.5.prefix",
"@neorg.headings.6.prefix",
},
bullets = { "◉", "○", "✸", "✿" },
codeblock_highlight = false,
dash_highlight = "Dash",
dash_string = "-",
doubledash_highlight = "DoubleDash",
doubledash_string = "=",
quote_highlight = "Quote",
quote_string = "┃",
fat_headlines = true,
fat_headline_upper_string = "▄",
fat_headline_lower_string = "▀",
},
}
end,
})
@end
* UI
Here we configure the user interface for Neovim.
___
** Lualine
A blazing fast and easy to configure Neovim statusline written in Lua.
___
[GitHub]{https://github.com/nvim-lualine/lualine.nvim}
@code lua
local colors = {
black = "#000000",
white = "#ffffff",
gray = "#444444",
light_gray = "#666666",
background = "#0c0c0c",
green = "#005000",
yellow = "#706000",
blue = "#004090",
paste = "#5518ab",
red = "#800000",
}
local lualine_theme = {
normal = {
a = { fg = colors.white, bg = colors.green },
b = { fg = colors.white, bg = colors.grey },
c = { fg = colors.white, bg = colors.black },
},
insert = { a = { fg = colors.white, bg = colors.blue } },
command = { a = { fg = colors.white, bg = colors.red } },
visual = { a = { fg = colors.white, bg = colors.yellow } },
replace = { a = { fg = colors.white, bg = colors.red } },
inactive = {
a = { fg = colors.white, bg = colors.black },
b = { fg = colors.white, bg = colors.black },
c = { fg = colors.light_gray, bg = colors.black },
},
}
plug({
{
"nvim-lualine/lualine.nvim",
event = "VeryLazy",
opts = function()
return {
options = {
theme = lualine_theme,
component_separators = { left = "", right = "" },
section_separators = { left = "|", right = "|" },
},
sections = {
lualine_a = { "mode" },
lualine_b = { "branch", "diff", "diagnostics" },
lualine_c = {
{
"filename",
path = 4
},
},
lualine_x = { "encoding", "fileformat", "filetype" },
lualine_y = { "progress" },
lualine_z = { "location" },
},
inactive_sections = {
lualine_a = {},
lualine_b = {},
lualine_c = {
{
"filename",
path = 4
},
},
lualine_x = { "location" },
lualine_y = {},
lualine_z = {},
},
tabline = {},
winbar = {
lualine_c = {
{
"filename",
path = 4,
},
"navic"
},
},
inactive_winbar = {
lualine_c = {
{
"filename",
path = 3
}
},
},
extensions = {},
}
end,
},
})
@end
** Dressing
Neovim plugin to improve the default vim.ui interfaces.
___
[GitHub]{https://github.com/stevearc/dressing.nvim}
@code lua
plug({
'stevearc/dressing.nvim',
opts = {},
})
@end
** Notify
A fancy, configurable notification manager for NeoVim.
___
[GitHub]{https://github.com/rcarriga/nvim-notify}
@code lua
plug({
"rcarriga/nvim-notify",
enabled = true,
lazy = false,
config = function ()
local notify = require("notify")
notify.setup({
minimum_width = 20,
max_width = 50,
max_height = 50,
render = "compact",
timeout = 1000,
top_down = true
})
vim.notify = notify
pcall(require('telescope').load_extension, "notify")
end,
keys = {
{
"<leader>;n",
function () require("telescope").extensions.notify.notify() end,
desc = "Notificiation History"
},
}
})
@end
* NEORG
An all-encompassing tool based around structured note taking, project and task management, time tracking, slideshows, writing typeset documents and much more.
___
[GitHub]{https://github.com/nvim-neorg/neorg}
[Spec]{https://github.com/nvim-neorg/norg-specs/blob/main/1.0-specification.norg}
@code lua
plug({
"nvim-neorg/neorg",
build = ":Neorg sync-parsers",
dependencies = {
"nvim-lua/plenary.nvim",
"Pocco81/true-zen.nvim",
"nvim-neorg/neorg-telescope",
"nvim-treesitter/nvim-treesitter",
"nvim-treesitter/nvim-treesitter-textobjects",
"hrsh7th/nvim-cmp",
},
ft = "norg",
cmd = "Neorg",
config = function()
require("neorg").setup({
load = {
["core.defaults"] = {}, -- Loads default behaviour
["core.concealer"] = { -- Adds pretty icons to your documents
config = {
foldlevelstart = "0",
icon_preset = "diamond",
icons = {
code_block = {
width = "content",
min_width = 85,
conceal = true,
},
},
},
},
["core.dirman"] = { -- Manages Neorg workspaces
config = {
workspaces = {
documents = "~/Documents",
notes = "~/Documents/Notes",
career = "~/Documents/Career",
profiles = "~/Documents/Profiles",
},
default_workspace = "documents",
},
},
["core.completion"] = {
config = {
engine = 'nvim-cmp',
name = "[Norg]",
}
},
["core.integrations.nvim-cmp"] = {},
["core.qol.toc"] = {
config = {
close_split_on_jump = true,
toc_split_placement = "right",
}
},
["core.export"] = {},
["core.export.markdown"] = {
config = {
extensions = "all",
}
},
["core.integrations.telescope"] = {},
["core.presenter"] = {
config = {
zen_mode = "truezen",
}
},
["core.journal"] = {
config = {
workspace = "journal",
strategy = "flat",
}
},
["core.summary"] = {},
["core.esupports.metagen"] = { config = { type = "auto", update_date = true } },
["core.ui.calendar"] = {},
}
})
local neorg_callbacks = require("neorg.core.callbacks")
neorg_callbacks.on_event("core.keybinds.events.enable_keybinds", function(_, keybinds)
-- Map all the below keybinds only when the "norg" mode is active
keybinds.map_event_to_mode("norg", {
n = { -- Bind keys in normal mode
{ "<localleader>ff", "core.integrations.telescope.find_norg_files", opts = { desc = 'Find Norg Files' } },
{ "<localleader>fl", "core.integrations.telescope.find_linkable", opts = { desc = 'Find Linkable' } },
{ "<localleader>sh", "core.integrations.telescope.search_headings", opts = { desc = 'Search Headings' } },
{ "<localleader>sw", "core.integrations.telescope.switch_workspace", opts = { desc = 'Switch Workspace' } },
{ "<localleader>cg", "core.looking-glass.magnify-code-block", opts = { desc = 'Looking Glass' } },
},
i = { -- Bind in insert mode
{ "<C-l>", "core.integrations.telescope.insert_link", opts = { desc = 'Insert Link' } },
{ "<C-L>", "core.integrations.telescope.insert_file_link", opts = { desc = 'Insert Neorg File Link' } },
},
}, {
silent = true,
noremap = true,
})
end)
end,
})
@end
* TELESCOPE
** Telescope
A highly extendable fuzzy finder over lists, files, buffers, git status and more.
___
[GitHub]{https://github.com/nvim-telescope/telescope.nvim}
@code lua
plug({
"nvim-telescope/telescope.nvim",
enabled = true,
lazy = false,
dependencies = {
'nvim-lua/plenary.nvim',
-- Fuzzy Finder Algorithm which requires local dependencies to be built.
-- Only load if `make` is available. Make sure you have the system
-- requirements installed.
{
'nvim-telescope/telescope-fzf-native.nvim',
-- NOTE: If you are having trouble with this installation,
-- refer to the README for telescope-fzf-native for more instructions.
build = 'make',
cond = function()
return vim.fn.executable 'make' == 1
end,
},
},
config = function()
require('telescope').setup{
defaults = {
mappings = {
n = {
['<c-d>'] = require('telescope.actions').delete_buffer
}, -- n
i = {
["<C-h>"] = "which_key",
['<c-d>'] = require('telescope.actions').delete_buffer
} -- i
} -- mappings
}, -- defaults
}
-- Enable telescope fzf native, if installed
pcall(require('telescope').load_extension, 'fzf')
local ts = require('telescope.builtin')
local fuzzy_search = function()
-- You can pass additional configuration to telescope to change theme, layout, etc.
ts.current_buffer_fuzzy_find(require('telescope.themes').get_dropdown {
winblend = 10,
previewer = false,
})
end
-- Shortcuts
vim.keymap.set('n', '<leader>?', ts.oldfiles, { desc = 'Find Recently Files' })
vim.keymap.set('n', '<leader>,', ts.buffers, { desc = 'Find buffers' })
vim.keymap.set('n', '<leader>/', fuzzy_search , { desc = 'Fuzzy Search in buffer' })
-- Find Files
vim.keymap.set('n', '<leader>ff', ts.find_files, { desc = 'Find Files' })
vim.keymap.set('n', '<leader>fb', ts.buffers, { desc = 'Find Buffers' })
vim.keymap.set('n', '<leader>fr', ts.oldfiles, { desc = 'Find Recent Files' })
vim.keymap.set('n', '<leader>fg', ts.git_files, { desc = 'Find Git Files' })
vim.keymap.set('n', '<leader>fs', ts.git_status, { desc = 'Find Git Status' })
vim.keymap.set('n', '<leader>fS', ts.git_stash, { desc = 'Find Git Stash' })
vim.keymap.set('n', '<leader>fd', function() ts.find_files({ cwd = '~/Documents' }) end,
{ desc = 'Find Documents' })
vim.keymap.set('n', '<leader>fD', function() ts.find_files({ cwd = '~/Downloads' }) end,
{ desc = 'Find Downloads' })
vim.keymap.set('n', '<leader>fp', function() ts.find_files({ cwd = '~/Projects' }) end, { desc = 'Find Projects' })
vim.keymap.set('n', '<leader>fc', function() ts.find_files({ cwd = vim.fn.stdpath('config') }) end,
{ desc = 'Find Config' })
vim.keymap.set('n', '<leader>fB', function() ts.find_files({ cwd = '~/.local/bin' }) end,
{ desc = 'Find Local Bin' })
-- Search for content, help and functions
vim.keymap.set('n', '<leader>sc', ts.git_commits, { desc = 'Search Git Commits' })
vim.keymap.set('n', '<leader>st', ts.builtin, { desc = 'Search Telescope' })
vim.keymap.set('n', '<leader>sh', ts.help_tags, { desc = 'Search Help' })
vim.keymap.set('n', '<leader>sw', ts.grep_string, { desc = 'Search Current Word' })
vim.keymap.set('n', '<leader>sg', ts.live_grep, { desc = 'Search by Grep' })
vim.keymap.set('n', '<leader>sd', ts.diagnostics, { desc = 'Search Diagnostics' })
vim.keymap.set('n', '<leader>sk', ts.keymaps, { desc = 'Search Keymaps' })
vim.keymap.set('n', "<leader>s'", ts.marks, { desc = 'Search Marks' })
vim.keymap.set('n', '<leader>s"', ts.registers, { desc = 'Search Registers' })
vim.keymap.set('n', '<leader>sf', fuzzy_search , { desc = 'Fuzzy Search in buffer' })
end,
})
@end
** Telescope Sessions Picker
Load nvim session files from target directory.
___
[GitHub]{https://github.com/JoseConseco/telescope_sessions_picker.nvim}
@code lua
plug({
"JoseConseco/telescope_sessions_picker.nvim",
enabled = true,
lazy = true,
config = function()
require('telescope').load_extension('sessions_picker')
end,
keys = {
{ "<leader>sS",
function() require('telescope').extensions.sessions_picker.sessions_picker() end,
desc = "Search Neovim Sessions"
},
}
})
@end
** Telescope Tmux
A Telescope.nvim extension for fuzzy-finding over tmux targets.
___
[GitHub]{https://github.com/camgraff/telescope-tmux.nvim}
@code lua
plug({ -- https://github.com/camgraff/telescope-tmux.nvim
"camgraff/telescope-tmux.nvim",
enabled = true,
lazy = true,
config = function ()
require('telescope').load_extension('tmux')
end,
keys = {
{ "<leader>ss",
function() require('telescope').extensions.tmux.sessions({}) end,
desc = "Search Tmux Sessions"
},
}
})
@end
** Telescope Tabs
A Telescope.nvim extension for fuzzy-finding over vim tabs.
___
[GitHub]{https://github.com/LukasPietzschmann/telescope-tabs}
@code lua
plug({
'LukasPietzschmann/telescope-tabs',
dependencies = { 'nvim-telescope/telescope.nvim' },
enabled = true,
lazy = true,
config = function()
require('telescope').load_extension 'telescope-tabs'
require('telescope-tabs').setup {
show_preview = true,
}
end,
keys = {
{"<tab>", mode = { "n" }, function() require("telescope-tabs").list_tabs() end, desc = "Open Tabs"}
}
})
@end
** URL VIEW
Extracts URL's from buffer for search in telescope
___
[GitHub]{https://github.com/axieax/urlview.nvim}
@code lua
plug({
"axieax/urlview.nvim",
enabled = true,
lazy = true,
config = function()
require("urlview").setup({
default_picker = "telescope",
log_level_min = 4,
})
end,
keys = {
{
"<leader>su",
"<Cmd>UrlView<CR>",
desc = "View buffer URLs",
},
{
"<leader>sU",
"<Cmd>UrlView lazy<CR>",
desc = "View lazy plugin URLs",
},
},
})
@end
* FILE NAVIGATION
** Oil
A file explorer that lets you edit your filesystem like a normal Neovim buffer.
___
[GitHub]{https://github.com/stevearc/oil.nvim}
@code lua
plug({
"stevearc/oil.nvim",
dependencies = { "nvim-tree/nvim-web-devicons" },
enabled = true,
lazy = true,
config = function ()
require("oil").setup({
default_file_explorer = true,
})
end,
cmd = "Oil",
keys = {
{ "<leader>o", function() require("oil").toggle_float() end, desc = "Oil File Manager" },
{ "<leader>O", function() require("oil").toggle_float(vim.fn.getcwd()) end, desc = "Oil File Manager" },
}
})
@end
** Neo-Tree
To browse the file system and other tree like structures
___
[GitHub]{https://github.com/nvim-neo-tree/neo-tree.nvim}
@code lua
plug({
"nvim-neo-tree/neo-tree.nvim",
branch = "v3.x",
dependencies = {
"nvim-lua/plenary.nvim",
"nvim-tree/nvim-web-devicons", -- not strictly required, but recommended
"MunifTanjim/nui.nvim",
},
cmd = "Neotree",
keys = {
{
"<leader>e",
function()
require("neo-tree.command").execute({ toggle = true, dir = vim.loop.cwd() })
end,
desc = "Explorer NeoTree",
},
{
"<leader>be",
function()
require("neo-tree.command").execute({ toggle = true, source = "buffers" })
end,
desc = "Explorer NeoTree Buffers",
},
},
deactivate = function()
vim.cmd([[Neotree close]])
end,
opts = {
sources = { "filesystem", "buffers", "git_status", "document_symbols" },
open_files_do_not_replace_types = { "terminal", "Trouble", "qf", "Outline" },
filesystem = {
bind_to_cwd = false,
follow_current_file = { enabled = true },
use_libuv_file_watcher = true,
},
window = {
mappings = {
["<space>"] = "none",
},
},
default_component_configs = {
indent = {
with_expanders = true, -- if nil and file nesting is enabled, will enable expanders
expander_collapsed = "",
expander_expanded = "",
expander_highlight = "NeoTreeExpander",
},
},
},
})
@end
** Harpoon
A per project file bookmark plugin
___
[GitHub]{https://github.com/ThePrimeagen/harpoon}
@code lua
plug({
'ThePrimeagen/harpoon',
enabled = true,
dependencies = { 'nvim-lua/plenary.nvim' },
opts = {},
config = function()
-- enable telescope extension
local tsh = require("telescope").load_extension('harpoon')
-- set keymaps
vim.keymap.set('n', "<leader>'a", require('harpoon.mark').add_file, { desc = 'Harpoon Add File' })
vim.keymap.set('n', "<leader>']", require('harpoon.ui').nav_next, { desc = 'Harpoon Next' })
vim.keymap.set('n', "<leader>'[", require('harpoon.ui').nav_prev, { desc = 'Harpoon Previous' })
vim.keymap.set("n", "<leader>fh", tsh.marks, { desc = "Find Harpoon" })
for i = 1, 9 do
vim.keymap.set('n', "<leader>'" .. i, function() require('harpoon.ui').nav_file(i) end,
{ desc = 'Harpoon Nav File' })
end
require('which-key').register({
['<leader>'] = {
["'"] = { name = "+Harpoon" },
},
})
end,
})
@end
** Project.nvim
An all in one neovim plugin written in lua that provides superior project management.
___
[GitHub]{https://github.com/ahmedkhalf/project.nvim}
@code lua
plug({
"ahmedkhalf/project.nvim",
enabled = true,
lazy = false,
config = function()
require("project_nvim").setup({
detection_methods = { "lsp", "pattern" },
patterns = { ".project", ".git", "_darcs", ".hg", ".bzr", ".svn", "Makefile", "package.json" },
silent_chdir = false,
})
pcall(require('telescope').load_extension('projects'))
end,
keys = {
{
"<leader>sp",
function() require('telescope').load_extension('projects').projects() end,
desc = 'Search for Project',
},
},
})
@end
* BUFFER NAVIGATION
** EYELINER
Move faster with unique f/F indicators for each word on the line.
___
[GitHub]{https://github.com/jinh0/eyeliner.nvim}
@code lua
plug({
"jinh0/eyeliner.nvim",
priority = 200,
keys = { "f", "F", "t", "T" },
opts = {
highlight_on_key = true,
dim = true
},
init = function()
vim.api.nvim_create_autocmd('ColorScheme', {
pattern = '*',
callback = function()
vim.api.nvim_set_hl(0, 'EyelinerPrimary', { fg = '#aa00aa', bold = true, underline = false })
vim.api.nvim_set_hl(0, 'EyelinerSecondary', { fg = '#a0f050', bold = true, underline = false })
end,
})
end,
})