forked from nvim-lua/kickstart.nvim
-
Notifications
You must be signed in to change notification settings - Fork 0
/
init.lua
1742 lines (1568 loc) · 66.3 KB
/
init.lua
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
vim.g.loaded_netrw = 1
vim.g.loaded_netrwPlugin = 1
--[[
=====================================================================
==================== READ THIS BEFORE CONTINUING ====================
=====================================================================
======== .-----. ========
======== .----------------------. | === | ========
======== |.-""""""""""""""""""-.| |-----| ========
======== || || | === | ========
======== || KICKSTART.NVIM || |-----| ========
======== || || | === | ========
======== || || |-----| ========
======== ||:Tutor || |:::::| ========
======== |'-..................-'| |____o| ========
======== `"")----------------(""` ___________ ========
======== /::::::::::| |::::::::::\ \ no mouse \ ========
======== /:::========| |==hjkl==:::\ \ required \ ========
======== '""""""""""""' '""""""""""""' '""""""""""' ========
======== ========
=====================================================================
=====================================================================
What is Kickstart?
Kickstart.nvim is *not* a distribution.
Kickstart.nvim is a starting point for your own configuration.
The goal is that you can read every line of code, top-to-bottom, understand
what your configuration is doing, and modify it to suit your needs.
Once you've done that, you can start exploring, configuring and tinkering to
make Neovim your own! That might mean leaving Kickstart just the way it is for a while
or immediately breaking it into modular pieces. It's up to you!
If you don't know anything about Lua, I recommend taking some time to read through
a guide. One possible example which will only take 10-15 minutes:
- https://learnxinyminutes.com/docs/lua/
After understanding a bit more about Lua, you can use `:help lua-guide` as a
reference for how Neovim integrates Lua.
- :help lua-guide
- (or HTML version): https://neovim.io/doc/user/lua-guide.html
Kickstart Guide:
TODO: The very first thing you should do is to run the command `:Tutor` in Neovim.
If you don't know what this means, type the following:
- <escape key>
- :
- Tutor
- <enter key>
(If you already know the Neovim basics, you can skip this step.)
Once you've completed that, you can continue working through **AND READING** the rest
of the kickstart init.lua.
Next, run AND READ `:help`.
This will open up a help window with some basic information
about reading, navigating and searching the builtin help documentation.
This should be the first place you go to look when you're stuck or confused
with something. It's one of my favorite Neovim features.
MOST IMPORTANTLY, we provide a keymap "<space>sh" to [s]earch the [h]elp documentation,
which is very useful when you're not exactly sure of what you're looking for.
I have left several `:help X` comments throughout the init.lua
These are hints about where to find more information about the relevant settings,
plugins or Neovim features used in Kickstart.
NOTE: Look for lines like this
Throughout the file. These are for you, the reader, to help you understand what is happening.
Feel free to delete them once you know what you're doing, but they should serve as a guide
for when you are first encountering a few different constructs in your Neovim config.
If you experience any errors while trying to install kickstart, run `:checkhealth` for more info.
I hope you enjoy your Neovim journey,
- TJ
P.S. You can delete this when you're done too. It's your config now! :)
--]]
-- Set <space> as the leader key
-- See `:help mapleader`
-- NOTE: Must happen before plugins are loaded (otherwise wrong leader will be used)
vim.g.mapleader = ' '
vim.g.maplocalleader = ' '
-- Set to true if you have a Nerd Font installed and selected in the terminal
vim.g.have_nerd_font = false
-- [[ Setting options ]]
-- See `:help vim.opt`
-- NOTE: You can change these options as you wish!
-- For more options, you can see `:help option-list`
-- my vim.opt edit begin
vim.opt.colorcolumn = '119'
vim.opt.tabstop = 4
vim.opt.shiftwidth = 4
vim.opt.softtabstop = 4
vim.opt.expandtab = true
vim.opt.autoindent = true
-- Set highlight on search
vim.opt.hlsearch = false
-- Make line numbers default
vim.wo.number = true
-- Enable mouse mode
vim.opt.mouse = 'a'
-- Enable break indent
vim.opt.breakindent = true
-- Save undo history
vim.opt.undofile = true
vim.opt.undodir = vim.fn.expand '~/temp/nvim-undodir'
-- Case-insensitive searching UNLESS \C or capital in search
vim.opt.ignorecase = true
vim.opt.smartcase = true
-- Keep signcolumn on by default
vim.wo.signcolumn = 'yes'
-- Decrease update time
vim.opt.updatetime = 250
vim.opt.timeoutlen = 300
-- Set completeopt to have a better completion experience
vim.opt.completeopt = 'menuone,noselect'
-- NOTE: You should make sure your terminal supports this
vim.opt.termguicolors = true
-- copilot
-- vim.g.copilot_no_tab_map = true
vim.g.copilot_assume_mapped = true
-- vim.api.nvim_set_keymap('i', '<C-J>', 'copilot#Accept("<CR>")', { silent = true, expr = true })
-- my vim.opt edit end
-- Make line numbers default
vim.opt.number = true
-- You can also add relative line numbers, to help with jumping.
-- Experiment for yourself to see if you like it!
-- vim.opt.relativenumber = true
-- Enable mouse mode, can be useful for resizing splits for example!
-- vim.opt.mouse = 'a'
-- Don't show the mode, since it's already in the status line
vim.opt.showmode = false
-- Sync clipboard between OS and Neovim.
-- Schedule the setting after `UiEnter` because it can increase startup-time.
-- Remove this option if you want your OS clipboard to remain independent.
-- See `:help 'clipboard'`
vim.schedule(function()
vim.opt.clipboard = 'unnamedplus'
end)
-- Enable break indent
vim.opt.breakindent = true
-- Save undo history
vim.opt.undofile = true
-- Case-insensitive searching UNLESS \C or one or more capital letters in the search term
vim.opt.ignorecase = true
vim.opt.smartcase = true
-- Keep signcolumn on by default
vim.opt.signcolumn = 'yes'
-- Decrease update time
vim.opt.updatetime = 250
-- Decrease mapped sequence wait time
-- Displays which-key popup sooner
vim.opt.timeoutlen = 300
-- Configure how new splits should be opened
vim.opt.splitright = true
vim.opt.splitbelow = true
-- Sets how neovim will display certain whitespace characters in the editor.
-- See `:help 'list'`
-- and `:help 'listchars'`
vim.opt.list = true
vim.opt.listchars = { tab = '» ', trail = '·', nbsp = '␣' }
-- Preview substitutions live, as you type!
vim.opt.inccommand = 'split'
-- Show which line your cursor is on
vim.opt.cursorline = true
-- Minimal number of screen lines to keep above and below the cursor.
vim.opt.scrolloff = 10
-- [[ Basic Keymaps ]]
-- See `:help vim.keymap.set()`
-- Clear highlights on search when pressing <Esc> in normal mode
-- See `:help hlsearch`
vim.keymap.set('n', '<Esc>', '<cmd>nohlsearch<CR>')
-- Diagnostic keymaps
vim.keymap.set('n', '<leader>q', vim.diagnostic.setloclist, { desc = 'Open diagnostic [Q]uickfix list' })
-- Exit terminal mode in the builtin terminal with a shortcut that is a bit easier
-- for people to discover. Otherwise, you normally need to press <C-\><C-n>, which
-- is not what someone will guess without a bit more experience.
--
-- NOTE: This won't work in all terminal emulators/tmux/etc. Try your own mapping
-- or just use <C-\><C-n> to exit terminal mode
vim.keymap.set('t', '<Esc><Esc>', '<C-\\><C-n>', { desc = 'Exit terminal mode' })
-- TIP: Disable arrow keys in normal mode
-- vim.keymap.set('n', '<left>', '<cmd>echo "Use h to move!!"<CR>')
-- vim.keymap.set('n', '<right>', '<cmd>echo "Use l to move!!"<CR>')
-- vim.keymap.set('n', '<up>', '<cmd>echo "Use k to move!!"<CR>')
-- vim.keymap.set('n', '<down>', '<cmd>echo "Use j to move!!"<CR>')
-- Keybinds to make split navigation easier.
-- Use CTRL+<hjkl> to switch between windows
--
-- See `:help wincmd` for a list of all window commands
vim.keymap.set('n', '<C-h>', '<C-w><C-h>', { desc = 'Move focus to the left window' })
vim.keymap.set('n', '<C-l>', '<C-w><C-l>', { desc = 'Move focus to the right window' })
vim.keymap.set('n', '<C-j>', '<C-w><C-j>', { desc = 'Move focus to the lower window' })
vim.keymap.set('n', '<C-k>', '<C-w><C-k>', { desc = 'Move focus to the upper window' })
-- [[ Basic Autocommands ]]
-- See `:help lua-guide-autocommands`
-- Highlight when yanking (copying) text
-- Try it with `yap` in normal mode
-- See `:help vim.highlight.on_yank()`
vim.api.nvim_create_autocmd('TextYankPost', {
desc = 'Highlight when yanking (copying) text',
group = vim.api.nvim_create_augroup('kickstart-highlight-yank', { clear = true }),
callback = function()
vim.highlight.on_yank()
end,
})
-- [[ Install `lazy.nvim` plugin manager ]]
-- See `:help lazy.nvim.txt` or https://github.com/folke/lazy.nvim for more info
local lazypath = vim.fn.stdpath 'data' .. '/lazy/lazy.nvim'
if not (vim.uv or vim.loop).fs_stat(lazypath) then
local lazyrepo = 'https://github.com/folke/lazy.nvim.git'
local out = vim.fn.system { 'git', 'clone', '--filter=blob:none', '--branch=stable', lazyrepo, lazypath }
if vim.v.shell_error ~= 0 then
error('Error cloning lazy.nvim:\n' .. out)
end
end ---@diagnostic disable-next-line: undefined-field
vim.opt.rtp:prepend(lazypath)
-- [[ Configure and install plugins ]]
--
-- To check the current status of your plugins, run
-- :Lazy
--
-- You can press `?` in this menu for help. Use `:q` to close the window
--
-- To update plugins you can run
-- :Lazy update
--
-- NOTE: Here is where you install your plugins.
require('lazy').setup({
'tpope/vim-sleuth', -- Detect tabstop and shiftwidth automatically
-- my plugins begin
{
'justinmk/vim-syntax-extra',
},
{
'mrcjkb/rustaceanvim',
version = '^4',
lazy = false,
},
{
'Civitasv/cmake-tools.nvim',
config = function()
local osys = require 'cmake-tools.osys'
require('cmake-tools').setup {
cmake_command = 'cmake', -- this is used to specify cmake command path
ctest_command = 'ctest', -- this is used to specify ctest command path
cmake_use_preset = true,
cmake_regenerate_on_save = true, -- auto generate when save CMakeLists.txt
cmake_generate_options = { '-DCMAKE_EXPORT_COMPILE_COMMANDS=ON' }, -- this will be passed when invoke `CMakeGenerate`
cmake_build_options = {}, -- this will be passed when invoke `CMakeBuild`
-- support macro expansion:
-- ${kit}
-- ${kitGenerator}
-- ${variant:xx}
cmake_build_directory = function()
if osys.iswin32 then
return 'out\\${variant:buildType}'
end
return 'out/${variant:buildType}'
end, -- this is used to specify generate directory for cmake, allows macro expansion, can be a string or a function returning the string, relative to cwd.
cmake_soft_link_compile_commands = true, -- this will automatically make a soft link from compile commands file to project root dir
cmake_compile_commands_from_lsp = false, -- this will automatically set compile commands file location using lsp, to use it, please set `cmake_soft_link_compile_commands` to false
cmake_kits_path = nil, -- this is used to specify global cmake kits path, see CMakeKits for detailed usage
cmake_variants_message = {
short = { show = true }, -- whether to show short message
long = { show = true, max_length = 40 }, -- whether to show long message
},
cmake_dap_configuration = { -- debug settings for cmake
name = 'cpp',
type = 'codelldb',
request = 'launch',
stopOnEntry = false,
runInTerminal = true,
console = 'integratedTerminal',
},
cmake_executor = { -- executor to use
name = 'quickfix', -- name of the executor
opts = {}, -- the options the executor will get, possible values depend on the executor type. See `default_opts` for possible values.
default_opts = { -- a list of default and possible values for executors
quickfix = {
show = 'always', -- "always", "only_on_error"
position = 'belowright', -- "vertical", "horizontal", "leftabove", "aboveleft", "rightbelow", "belowright", "topleft", "botright", use `:h vertical` for example to see help on them
size = 10,
encoding = 'utf-8', -- if encoding is not "utf-8", it will be converted to "utf-8" using `vim.fn.iconv`
auto_close_when_success = true, -- typically, you can use it with the "always" option; it will auto-close the quickfix buffer if the execution is successful.
},
toggleterm = {
direction = 'float', -- 'vertical' | 'horizontal' | 'tab' | 'float'
close_on_exit = false, -- whether close the terminal when exit
auto_scroll = true, -- whether auto scroll to the bottom
singleton = true, -- single instance, autocloses the opened one, if present
},
overseer = {
new_task_opts = {
strategy = {
'toggleterm',
direction = 'horizontal',
autos_croll = true,
quit_on_exit = 'success',
},
}, -- options to pass into the `overseer.new_task` command
on_new_task = function(task)
require('overseer').open { enter = false, direction = 'right' }
end, -- a function that gets overseer.Task when it is created, before calling `task:start`
},
terminal = {
name = 'Main Terminal',
prefix_name = '[CMakeTools]: ', -- This must be included and must be unique, otherwise the terminals will not work. Do not use a simple spacebar " ", or any generic name
split_direction = 'horizontal', -- "horizontal", "vertical"
split_size = 11,
-- Window handling
single_terminal_per_instance = true, -- Single viewport, multiple windows
single_terminal_per_tab = true, -- Single viewport per tab
keep_terminal_static_location = true, -- Static location of the viewport if avialable
-- Running Tasks
start_insert = false, -- If you want to enter terminal with :startinsert upon using :CMakeRun
focus = false, -- Focus on terminal when cmake task is launched.
do_not_add_newline = false, -- Do not hit enter on the command inserted when using :CMakeRun, allowing a chance to review or modify the command before hitting enter.
}, -- terminal executor uses the values in cmake_terminal
},
},
cmake_runner = { -- runner to use
name = 'terminal', -- name of the runner
opts = {}, -- the options the runner will get, possible values depend on the runner type. See `default_opts` for possible values.
default_opts = { -- a list of default and possible values for runners
quickfix = {
show = 'always', -- "always", "only_on_error"
position = 'belowright', -- "bottom", "top"
size = 10,
encoding = 'utf-8',
auto_close_when_success = true, -- typically, you can use it with the "always" option; it will auto-close the quickfix buffer if the execution is successful.
},
toggleterm = {
direction = 'float', -- 'vertical' | 'horizontal' | 'tab' | 'float'
close_on_exit = false, -- whether close the terminal when exit
auto_scroll = true, -- whether auto scroll to the bottom
singleton = true, -- single instance, autocloses the opened one, if present
},
overseer = {
new_task_opts = {
strategy = {
'toggleterm',
direction = 'horizontal',
autos_croll = true,
quit_on_exit = 'success',
},
}, -- options to pass into the `overseer.new_task` command
on_new_task = function(task) end, -- a function that gets overseer.Task when it is created, before calling `task:start`
},
terminal = {
name = 'Main Terminal',
prefix_name = '[CMakeTools]: ', -- This must be included and must be unique, otherwise the terminals will not work. Do not use a simple spacebar " ", or any generic name
split_direction = 'horizontal', -- "horizontal", "vertical"
split_size = 11,
-- Window handling
single_terminal_per_instance = true, -- Single viewport, multiple windows
single_terminal_per_tab = true, -- Single viewport per tab
keep_terminal_static_location = true, -- Static location of the viewport if avialable
-- Running Tasks
start_insert = false, -- If you want to enter terminal with :startinsert upon using :CMakeRun
focus = false, -- Focus on terminal when cmake task is launched.
do_not_add_newline = false, -- Do not hit enter on the command inserted when using :CMakeRun, allowing a chance to review or modify the command before hitting enter.
},
},
},
cmake_notifications = {
runner = { enabled = true },
executor = { enabled = true },
spinner = { '⠋', '⠙', '⠹', '⠸', '⠼', '⠴', '⠦', '⠧', '⠇', '⠏' }, -- icons used for progress display
refresh_rate_ms = 100, -- how often to iterate icons
},
cmake_virtual_text_support = true, -- Show the target related to current file using virtual text (at right corner)
}
end,
},
'lambdalisue/vim-suda',
{
'akinsho/toggleterm.nvim',
version = '*',
config = function()
require('toggleterm').setup {
open_mapping = [[<c-t>]],
direction = 'vertical',
size = function(term)
if term.direction == 'horizontal' then
return vim.o.lines * 0.5 -- half of the window height for horizontal terminals
elseif term.direction == 'vertical' then
return vim.o.columns * 0.5 -- half of the window width for vertical terminals
end
end,
float_opts = {
border = 'single',
highlights = {
border = 'Normal',
background = 'Normal',
},
},
}
end,
},
'tpope/vim-fugitive',
{
'fei6409/log-highlight.nvim',
config = function()
require('log-highlight').setup {}
end,
},
-- "gc" to comment visual regions/lines
{ 'numToStr/Comment.nvim', opts = {} },
'github/copilot.vim',
'sindrets/diffview.nvim',
{
'NeogitOrg/neogit',
dependencies = {
'nvim-lua/plenary.nvim', -- required
'sindrets/diffview.nvim', -- optional - Diff integration
-- Only one of these is needed, not both.
'nvim-telescope/telescope.nvim', -- optional
},
config = function()
require('neogit').setup {
-- Hides the hints at the top of the status buffer
disable_hint = false,
-- Disables changing the buffer highlights based on where the cursor is.
disable_context_highlighting = false,
-- Disables signs for sections/items/hunks
disable_signs = false,
-- Changes what mode the Commit Editor starts in. `true` will leave nvim in normal mode, `false` will change nvim to
-- insert mode, and `"auto"` will change nvim to insert mode IF the commit message is empty, otherwise leaving it in
-- normal mode.
disable_insert_on_commit = 'auto',
-- When enabled, will watch the `.git/` directory for changes and refresh the status buffer in response to filesystem
-- events.
filewatcher = {
interval = 1000,
enabled = true,
},
-- "ascii" is the graph the git CLI generates
-- "unicode" is the graph like https://github.com/rbong/vim-flog
graph_style = 'ascii',
-- Used to generate URL's for branch popup action "pull request".
git_services = {
-- ['github.com'] = 'https://github.com/${owner}/${repository}/compare/${branch_name}?expand=1',
-- ['bitbucket.org'] = 'https://bitbucket.org/${owner}/${repository}/pull-requests/new?source=${branch_name}&t=1',
-- ['gitlab.com'] = 'https://gitlab.com/${owner}/${repository}/merge_requests/new?merge_request[source_branch]=${branch_name}',
},
-- Allows a different telescope sorter. Defaults to 'fuzzy_with_index_bias'. The example below will use the native fzf
-- sorter instead. By default, this function returns `nil`.
telescope_sorter = function()
return require('telescope').extensions.fzf.native_fzf_sorter()
end,
-- Persist the values of switches/options within and across sessions
remember_settings = true,
-- Scope persisted settings on a per-project basis
use_per_project_settings = true,
-- Table of settings to never persist. Uses format "Filetype--cli-value"
ignored_settings = {
'NeogitPushPopup--force-with-lease',
'NeogitPushPopup--force',
'NeogitPullPopup--rebase',
'NeogitCommitPopup--allow-empty',
'NeogitRevertPopup--no-edit',
},
-- Configure highlight group features
highlight = {
italic = true,
bold = true,
underline = true,
},
-- Set to false if you want to be responsible for creating _ALL_ keymappings
use_default_keymaps = true,
-- Neogit refreshes its internal state after specific events, which can be expensive depending on the repository size.
-- Disabling `auto_refresh` will make it so you have to manually refresh the status after you open it.
auto_refresh = true,
-- Value used for `--sort` option for `git branch` command
-- By default, branches will be sorted by commit date descending
-- Flag description: https://git-scm.com/docs/git-branch#Documentation/git-branch.txt---sortltkeygt
-- Sorting keys: https://git-scm.com/docs/git-for-each-ref#_options
sort_branches = '-committerdate',
-- Change the default way of opening neogit
kind = 'tab',
-- Disable line numbers and relative line numbers
disable_line_numbers = true,
-- The time after which an output console is shown for slow running commands
console_timeout = 2000,
-- Automatically show console if a command takes more than console_timeout milliseconds
auto_show_console = true,
-- Automatically close the console if the process exits with a 0 (success) status
auto_close_console = true,
status = {
show_head_commit_hash = true,
recent_commit_count = 10,
HEAD_padding = 10,
mode_padding = 3,
mode_text = {
M = 'modified',
N = 'new file',
A = 'added',
D = 'deleted',
C = 'copied',
U = 'updated',
R = 'renamed',
DD = 'unmerged',
AU = 'unmerged',
UD = 'unmerged',
UA = 'unmerged',
DU = 'unmerged',
AA = 'unmerged',
UU = 'unmerged',
['?'] = '',
},
},
commit_editor = {
kind = 'tab',
show_staged_diff = true,
-- Accepted values:
-- "split" to show the staged diff below the commit editor
-- "vsplit" to show it to the right
-- "split_above" Like :top split
-- "vsplit_left" like :vsplit, but open to the left
-- "auto" "vsplit" if window would have 80 cols, otherwise "split"
staged_diff_split_kind = 'split',
},
commit_select_view = {
kind = 'tab',
},
commit_view = {
kind = 'vsplit',
verify_commit = vim.fn.executable 'gpg' == 1, -- Can be set to true or false, otherwise we try to find the binary
},
log_view = {
kind = 'tab',
},
rebase_editor = {
kind = 'auto',
},
reflog_view = {
kind = 'tab',
},
merge_editor = {
kind = 'auto',
},
tag_editor = {
kind = 'auto',
},
preview_buffer = {
kind = 'split',
},
popup = {
kind = 'split',
},
signs = {
-- { CLOSED, OPENED }
hunk = { '', '' },
item = { '>', 'v' },
section = { '>', 'v' },
},
-- Each Integration is auto-detected through plugin presence, however, it can be disabled by setting to `false`
integrations = {
-- If enabled, use telescope for menu selection rather than vim.ui.select.
-- Allows multi-select and some things that vim.ui.select doesn't.
telescope = true,
-- Neogit only provides inline diffs. If you want a more traditional way to look at diffs, you can use `diffview`.
-- The diffview integration enables the diff popup.
--
-- Requires you to have `sindrets/diffview.nvim` installed.
diffview = true,
-- If enabled, uses fzf-lua for menu selection. If the telescope integration
-- is also selected then telescope is used instead
-- Requires you to have `ibhagwan/fzf-lua` installed.
fzf_lua = false,
},
sections = {
-- Reverting/Cherry Picking
sequencer = {
folded = false,
hidden = false,
},
untracked = {
folded = false,
hidden = false,
},
unstaged = {
folded = false,
hidden = false,
},
staged = {
folded = false,
hidden = false,
},
stashes = {
folded = true,
hidden = false,
},
unpulled_upstream = {
folded = true,
hidden = false,
},
unmerged_upstream = {
folded = false,
hidden = false,
},
unpulled_pushRemote = {
folded = true,
hidden = false,
},
unmerged_pushRemote = {
folded = false,
hidden = false,
},
recent = {
folded = true,
hidden = false,
},
rebase = {
folded = true,
hidden = false,
},
},
mappings = {
commit_editor = {
['q'] = 'Close',
['<c-c><c-c>'] = 'Submit',
['<c-c><c-k>'] = 'Abort',
},
commit_editor_I = {
['<c-c><c-c>'] = 'Submit',
['<c-c><c-k>'] = 'Abort',
},
rebase_editor = {
['p'] = 'Pick',
['r'] = 'Reword',
['e'] = 'Edit',
['s'] = 'Squash',
['f'] = 'Fixup',
['x'] = 'Execute',
['d'] = 'Drop',
['b'] = 'Break',
['q'] = 'Close',
['<cr>'] = 'OpenCommit',
['gk'] = 'MoveUp',
['gj'] = 'MoveDown',
['<c-c><c-c>'] = 'Submit',
['<c-c><c-k>'] = 'Abort',
['[c'] = 'OpenOrScrollUp',
[']c'] = 'OpenOrScrollDown',
},
rebase_editor_I = {
['<c-c><c-c>'] = 'Submit',
['<c-c><c-k>'] = 'Abort',
},
finder = {
['<cr>'] = 'Select',
['<c-c>'] = 'Close',
['<esc>'] = 'Close',
['<c-n>'] = 'Next',
['<c-p>'] = 'Previous',
['<down>'] = 'Next',
['<up>'] = 'Previous',
['<tab>'] = 'MultiselectToggleNext',
['<s-tab>'] = 'MultiselectTogglePrevious',
['<c-j>'] = 'NOP',
},
-- Setting any of these to `false` will disable the mapping.
popup = {
['?'] = 'HelpPopup',
['A'] = 'CherryPickPopup',
['D'] = 'DiffPopup',
['M'] = 'RemotePopup',
['P'] = 'PushPopup',
['X'] = 'ResetPopup',
['Z'] = 'StashPopup',
['b'] = 'BranchPopup',
['B'] = 'BisectPopup',
['c'] = 'CommitPopup',
['f'] = 'FetchPopup',
['l'] = 'LogPopup',
['m'] = 'MergePopup',
['p'] = 'PullPopup',
['r'] = 'RebasePopup',
['v'] = 'RevertPopup',
['w'] = 'WorktreePopup',
},
status = {
['k'] = 'MoveUp',
['j'] = 'MoveDown',
['q'] = 'Close',
['o'] = 'OpenTree',
['I'] = 'InitRepo',
['1'] = 'Depth1',
['2'] = 'Depth2',
['3'] = 'Depth3',
['4'] = 'Depth4',
['<tab>'] = 'Toggle',
['x'] = 'Discard',
['s'] = 'Stage',
['S'] = 'StageUnstaged',
['<c-s>'] = 'StageAll',
['K'] = 'Untrack',
['u'] = 'Unstage',
['U'] = 'UnstageStaged',
['$'] = 'CommandHistory',
['Y'] = 'YankSelected',
['<c-r>'] = 'RefreshBuffer',
['<enter>'] = 'GoToFile',
['<c-v>'] = 'VSplitOpen',
['<c-x>'] = 'SplitOpen',
['<c-t>'] = 'TabOpen',
['{'] = 'GoToPreviousHunkHeader',
['}'] = 'GoToNextHunkHeader',
['[c'] = 'OpenOrScrollUp',
[']c'] = 'OpenOrScrollDown',
},
},
}
end,
},
-- my plugins end
-- NOTE: First, some plugins that don't require any configuration
-- NOTE: Plugins can also be added by using a table,
-- with the first argument being the link and the following
-- keys can be used to configure plugin behavior/loading/etc.
--
-- Use `opts = {}` to force a plugin to be loaded.
--
-- This is equivalent to:
-- require('Comment').setup({})
-- "gc" to comment visual regions/lines
{ 'numToStr/Comment.nvim', opts = {} },
-- Here is a more advanced example where we pass configuration
-- options to `gitsigns.nvim`. This is equivalent to the following Lua:
-- require('gitsigns').setup({ ... })
--
-- See `:help gitsigns` to understand what the configuration keys do
{ -- Adds git related signs to the gutter, as well as utilities for managing changes
'lewis6991/gitsigns.nvim',
opts = {
signs = {
add = { text = '+' },
change = { text = '~' },
delete = { text = '_' },
topdelete = { text = '‾' },
changedelete = { text = '~' },
},
},
},
-- NOTE: Plugins can also be configured to run Lua code when they are loaded.
--
-- This is often very useful to both group configuration, as well as handle
-- lazy loading plugins that don't need to be loaded immediately at startup.
--
-- For example, in the following configuration, we use:
-- event = 'VimEnter'
--
-- which loads which-key before all the UI elements are loaded. Events can be
-- normal autocommands events (`:help autocmd-events`).
--
-- Then, because we use the `config` key, the configuration only runs
-- after the plugin has been loaded:
-- config = function() ... end
{ -- Useful plugin to show you pending keybinds.
'folke/which-key.nvim',
event = 'VimEnter', -- Sets the loading event to 'VimEnter'
opts = {
icons = {
-- set icon mappings to true if you have a Nerd Font
mappings = vim.g.have_nerd_font,
-- If you are using a Nerd Font: set icons.keys to an empty table which will use the
-- default whick-key.nvim defined Nerd Font icons, otherwise define a string table
keys = vim.g.have_nerd_font and {} or {
Up = '<Up> ',
Down = '<Down> ',
Left = '<Left> ',
Right = '<Right> ',
C = '<C-…> ',
M = '<M-…> ',
D = '<D-…> ',
S = '<S-…> ',
CR = '<CR> ',
Esc = '<Esc> ',
ScrollWheelDown = '<ScrollWheelDown> ',
ScrollWheelUp = '<ScrollWheelUp> ',
NL = '<NL> ',
BS = '<BS> ',
Space = '<Space> ',
Tab = '<Tab> ',
F1 = '<F1>',
F2 = '<F2>',
F3 = '<F3>',
F4 = '<F4>',
F5 = '<F5>',
F6 = '<F6>',
F7 = '<F7>',
F8 = '<F8>',
F9 = '<F9>',
F10 = '<F10>',
F11 = '<F11>',
F12 = '<F12>',
},
},
-- Document existing key chains
spec = {
{ '<leader>c', group = '[C]ode', mode = { 'n', 'x' } },
{ '<leader>d', group = '[D]ocument' },
{ '<leader>r', group = '[R]ename' },
{ '<leader>s', group = '[S]earch' },
{ '<leader>w', group = '[W]orkspace' },
{ '<leader>t', group = '[T]oggle' },
{ '<leader>h', group = 'Git [H]unk', mode = { 'n', 'v' } },
},
},
},
-- {
-- 'uloco/bluloco.nvim',
-- lazy = false,
-- priority = 1000,
-- dependencies = { 'rktjmp/lush.nvim' },
-- config = function()
-- -- your optional config goes here, see below.
-- vim.cmd.colorscheme 'bluloco-light'
-- end,
-- },
-- NOTE: Plugins can specify dependencies.
--
-- The dependencies are proper plugin specifications as well - anything
-- you do for a plugin at the top level, you can do for a dependency.
--
-- Use the `dependencies` key to specify the dependencies of a particular plugin
{ -- Fuzzy Finder (files, lsp, etc)
'nvim-telescope/telescope.nvim',
event = 'VimEnter',
branch = '0.1.x',
dependencies = {
'nvim-lua/plenary.nvim',
{ -- If encountering errors, see telescope-fzf-native README for installation instructions
'nvim-telescope/telescope-fzf-native.nvim',
-- `build` is used to run some command when the plugin is installed/updated.
-- This is only run then, not every time Neovim starts up.
build = 'make',
-- `cond` is a condition used to determine whether this plugin should be
-- installed and loaded.
cond = function()
return vim.fn.executable 'make' == 1
end,
},
{ 'nvim-telescope/telescope-ui-select.nvim' },
-- Useful for getting pretty icons, but requires a Nerd Font.
{ 'nvim-tree/nvim-web-devicons', enabled = vim.g.have_nerd_font },
},
config = function()
-- Telescope is a fuzzy finder that comes with a lot of different things that
-- it can fuzzy find! It's more than just a "file finder", it can search
-- many different aspects of Neovim, your workspace, LSP, and more!
--
-- The easiest way to use Telescope, is to start by doing something like:
-- :Telescope help_tags
--
-- After running this command, a window will open up and you're able to
-- type in the prompt window. You'll see a list of `help_tags` options and
-- a corresponding preview of the help.
--
-- Two important keymaps to use while in Telescope are:
-- - Insert mode: <c-/>
-- - Normal mode: ?
--
-- This opens a window that shows you all of the keymaps for the current
-- Telescope picker. This is really useful to discover what Telescope can
-- do as well as how to actually do it!
-- [[ Configure Telescope ]]
-- See `:help telescope` and `:help telescope.setup()`
require('telescope').setup {
-- You can put your default mappings / updates / etc. in here
-- All the info you're looking for is in `:help telescope.setup()`
--
-- defaults = {
-- mappings = {
-- i = { ['<c-enter>'] = 'to_fuzzy_refine' },
-- },
-- },
-- pickers = {}
extensions = {
['ui-select'] = {
require('telescope.themes').get_dropdown(),
},
},
}
-- Enable Telescope extensions if they are installed
pcall(require('telescope').load_extension, 'fzf')
pcall(require('telescope').load_extension, 'ui-select')
-- See `:help telescope.builtin`
local builtin = require 'telescope.builtin'
vim.keymap.set('n', '<leader>sh', builtin.help_tags, { desc = '[S]earch [H]elp' })
vim.keymap.set('n', '<leader>sk', builtin.keymaps, { desc = '[S]earch [K]eymaps' })
vim.keymap.set('n', '<leader>sf', builtin.find_files, { desc = '[S]earch [F]iles' })
vim.keymap.set('n', '<leader>ss', builtin.builtin, { desc = '[S]earch [S]elect Telescope' })
vim.keymap.set('n', '<leader>sw', builtin.grep_string, { desc = '[S]earch current [W]ord' })
vim.keymap.set('n', '<leader>sg', builtin.live_grep, { desc = '[S]earch by [G]rep' })
vim.keymap.set('n', '<leader>sd', builtin.diagnostics, { desc = '[S]earch [D]iagnostics' })
vim.keymap.set('n', '<leader>sr', builtin.resume, { desc = '[S]earch [R]esume' })
vim.keymap.set('n', '<leader>s.', builtin.oldfiles, { desc = '[S]earch Recent Files ("." for repeat)' })
vim.keymap.set('n', '<leader><leader>', builtin.buffers, { desc = '[ ] Find existing buffers' })
vim.keymap.set('n', '<leader>sc', builtin.commands, { desc = '[c] Find commands' })
-- Slightly advanced example of overriding default behavior and theme
vim.keymap.set('n', '<leader>/', function()
-- You can pass additional configuration to Telescope to change the theme, layout, etc.
builtin.current_buffer_fuzzy_find(require('telescope.themes').get_dropdown {
winblend = 10,
previewer = false,
})
end, { desc = '[/] Fuzzily search in current buffer' })
-- It's also possible to pass additional configuration options.
-- See `:help telescope.builtin.live_grep()` for information about particular keys