-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinit.lua
More file actions
1063 lines (985 loc) · 37.5 KB
/
init.lua
File metadata and controls
1063 lines (985 loc) · 37.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
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
--test
-- This file is main setting of neovim. Keep It Clean...
-- 基本設定
vim.o.langmenu = "en_US.UTF-8"
vim.env.LANG = "en_US.UTF-8"
vim.api.nvim_command("set encoding=utf-8")
vim.o.encoding = "utf-8"
vim.o.fileencoding = "utf-8"
vim.o.fileformats = "unix"
--vim.o.ambiwidth = 'double' -- 全角は二つ分で表示(->有効化してはならない)
vim.o.number = true -- 行番号表示
vim.o.relativenumber = true -- 相対行番号表示
vim.o.tabstop = 2 -- タブの幅
vim.o.expandtab = true -- 上のタブ幅の有効化
vim.o.softtabstop = 1 -- インデントに使用するスペースの数
vim.o.autoindent = true
vim.o.shiftwidth = 2 -- シフト幅
vim.o.autoindent = true
vim.o.cursorline = true -- 行線表示
vim.o.colorcolumn = "80" -- 列線表示
vim.o.directory = "./" -- swap file place
vim.o.smartindent = true -- mk indent according to the block
--vim.o.guifont="default:h20"
vim.o.guifont = "CaskaydiaMono Nerd Font Mono:h11" --Font
vim.o.guifontwide = "30"
vim.o.hlsearch = true --high light for search
--local setting
vim.opt.undofile = true
vim.opt.autochdir = true --change the work directory automatically
vim.opt.wrap = false --set no wrap
vim.opt.wrap = false --set no wrap
vim.opt.inccommand = "split" --??
vim.opt.clipboard = "unnamedplus" --use clipboard
local option = {
encoding = "utf-8",
fileencoding = "utf-8",
undofile = true,
undodir = "~/.config/nvim",
}
vim.loader.enable()
-- キーマッピング
vim.api.nvim_set_keymap("n", "<Space>", ":nohlsearch<CR>", { noremap = true, silent = true })
vim.api.nvim_set_keymap("n", "<Leader>w", ":w<CR>", { noremap = true, silent = true })
--colorscheme
--
-------------------------------------------------------------------------------
--plugin management (lazy.nvim)
-------------------------------------------------------------------------------
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
if not vim.loop.fs_stat(lazypath) then
vim.fn.system({
"git",
"clone",
"--filter=blob:none",
"https://github.com/folke/lazy.nvim.git",
"--branch=stable", -- latest stable release
lazypath,
})
end
vim.opt.rtp:prepend(lazypath)
require("lazy").setup({
{
"adelarsq/image_preview.nvim",
event = "VeryLazy",
config = function()
require("image_preview").setup()
end,
},
{
"nvim-tree/nvim-tree.lua",
--keys={"<Leader>;;",":NvimTreeOpen", disc="open tree"},
--event="VimEnter",
dependencies = "nvim-tree/nvim-web-devicons",
opts = {
sort = {
sorter = "case_sensitive",
},
view = {
width = 30,
},
renderer = {
group_empty = true,
},
filters = {
dotfiles = true,
},
},
},
{ "lervag/vimtex", ft = { "tex" } },
{ "jxnblk/vim-mdx-js", ft = { "mdx","md" } },
{
"akinsho/toggleterm.nvim",
lazy = true,
version = "*",
config = true,
keys = { "<Leader>tt", ":ToggleTerm", disk = "open terminal" },
},
{ "itchyny/lightline.vim" },
{
"folke/tokyonight.nvim",
event = "VimEnter",
priority = 1000,
opts = require("plugins.tokyonight"),
},
{
"windwp/nvim-autopairs",
event = "InsertEnter",
opts = {}, --this is equalent to setup ({}) fundtion
},
{
"preservim/nerdcommenter",
event = "VimEnter",
},
--{"lambdalisue/glyph-palette.vim"},
{
"nvim-telescope/telescope.nvim",
event = "VimEnter",
tag = "0.1.5",
},
{
"nvim-telescope/telescope-file-browser.nvim",
event = "VimEnter",
},
{
"uga-rosa/ccc.nvim",
event = "VimEnter",
opt = require("plugins.ccc"),
}, --colorlize.luaなんてのもあるようです
--{"BurntSushi/ripgrep"},
{
"nvim-treesitter/nvim-treesitter",
event = "VimEnter",
},
{
"neovim/nvim-lspconfig",
event = "VimEnter",
}, --lsp
{
"williamboman/mason.nvim",
event = "VimEnter",
},
{
"williamboman/mason-lspconfig.nvim",
event = "VimEnter",
dependencies = { "hrsh7th/cmp-nvim-lsp", "williamboman/mason.nvim" },
},
--compilation:ddcを使おうとしていたが挫折
{
"L3MON4D3/LuaSnip",
version = "v2.*",
build = "make install_jsregexp",
dependencies = "saadparwaiz1/cmp_luasnip",
event = "InsertEnter",
},
{
"hrsh7th/nvim-cmp",
event = "InsertEnter",
},
{
"hrsh7th/cmp-nvim-lsp",
event = "InsertEnter",
},
{
"hrsh7th/vim-vsnip",
event = "InsertEnter",
},
{
"hrsh7th/cmp-buffer",
event = "InsertEnter",
},
{
"hrsh7th/cmp-cmdline",
event = "InsertEnter",
},
{
"hrsh7th/cmp-path",
event = "InsertEnter",
},
{
"mhartington/formatter.nvim",
event = "InsertLeave",
},
--{"vim-skk/skkeleton",event="InsertEnter"},
{
"pocco81/auto-save.nvim",
event = "VimEnter",
},
{
"junegunn/rainbow_parentheses.vim",
event = "VimEnter",
},
{
"dstein64/vim-startuptime",
cmd = { "StartupTime" },
},
{
"goolord/alpha-nvim",
event = "VimEnter",
dependencies = {
"nvim-tree/nvim-web-devicons",
"nvim-lua/plenary.nvim",
},
config = function()
require("alpha").setup(require("alpha.themes.theta").config)
end,
},
{
"romgrk/barbar.nvim",
event = "VimEnter",
dependencies = {
"lewis6991/gitsigns.nvim", -- OPTIONAL: for git status
"nvim-tree/nvim-web-devicons", -- OPTIONAL: for file icons
},
init = function()
vim.g.barbar_auto_setup = false
end,
opts = {
-- lazy.nvim will automatically call setup for you. put your options here, anything missing will use the default:
animation = false,
-- insert_at_start = true,
-- …etc.
},
version = "^1.0.0", -- optional: only update when a new 1.x version is released
},
{
"Shatur/neovim-session-manager",
event = "VimEnter",
},
{
"lewis6991/gitsigns.nvim",
event = "VimEnter",
},
{
"echasnovski/mini.indentscope",
event = "VimEnter",
},
{
"EEprotocol/Arduineovim",
event = "VimEnter",
},
{ "EEprotocol/Arduineovim" },
{
"toppair/peek.nvim",
event = { "VeryLazy" },
ft = { "markdown" },
build = "deno task --quiet build:fast",
config = function()
require("peek").setup()
-- refer to `configuration to change defaults`
vim.api.nvim_create_user_command("PeekOpen", require("peek").open, {})
vim.api.nvim_create_user_command("PeekClose", require("peek").close, {})
end,
},
{
"nvim-treesitter/nvim-treesitter-context",
event = "VimEnter",
},
{ "EEprotocol/Arduineovim" },
{ "skanehira/preview-markdown.vim" },
--{ "ray-x/navigator.lua" },
{ "ray-x/guihua.lua" },
{ "ray-x/web-tools.nvim" },
})
-------------------------------------------------------------------------------
--Arduienovim
-------------------------------------------------------------------------------
require("arduineovim").setup()
-------------------------------------------------------------------------------
--Markdown previewer (peek)
-------------------------------------------------------------------------------
require("peek").setup({
auto_load = true, -- whether to automatically load preview when
-- entering another markdown buffer
close_on_bdelete = true, -- close preview window on buffer delete
syntax = true, -- enable syntax highlighting, affects performance
theme = "dark", -- 'dark' or 'light'
update_on_change = true,
app = "webview", -- 'webview', 'browser', string or a table of strings
-- explained below
filetype = { "markdown" }, -- list of filetypes to recognize as markdown
-- relevant if update_on_change is true
throttle_at = 200000, -- start throttling when file exceeds this
-- amount of bytes in size
throttle_time = "auto", -- minimum amount of time in milliseconds
-- that has to pass before starting new render
})
-------------------------------------------------------------------------------
--LSP setting
-------------------------------------------------------------------------------
-- lspのハンドラーに設定
capabilities = require("cmp_nvim_lsp").default_capabilities()
--mason setting
require("mason").setup()
--mason config
require("mason-lspconfig").setup {
ensure_installed = { "lua_ls", "texlab", "pyright", "arduino_language_server", "clangd" }
}
--[[require("mason-lspconfig").setup{
]]
-- launch-test.lua
--require("mason-lspconfig").setup_handlers({
-- require("lspconfig").lua_ls.setup({}),
-- require("lspconfig").pyright.setup({}),
-- require("lspconfig").texlab.setup({}),
-- require("lspconfig").arduino_language_server.setup({}),
-- require("lspconfig").typescript_language_server.setup({}),
--//})
local lspconfig = require('lspconfig')
local util = require('lspconfig.util')
lspconfig.clangd.setup {
root_dir = function(fname)
return util.root_pattern('compile_commands.json', '.git')(fname)
or vim.fn.getcwd()
end
}
-- lspの設定後に追加)
vim.opt.completeopt = "menu,menuone,noselect"
local cmp = require("cmp")
local luasnip = require("luasnip")
cmp.setup({
snippet = {
expand = function(args)
require("luasnip").lsp_expand(args.body)
end,
},
window = {
completion = cmp.config.window.bordered(),
documentation = cmp.config.window.bordered(),
},
mapping = cmp.mapping.preset.insert({
["<S-tab>"] = cmp.mapping.select_prev_item(),
["<tab>"] = cmp.mapping.select_next_item(),
["<C-d>"] = cmp.mapping.scroll_docs(-4),
["<C-f>"] = cmp.mapping.scroll_docs(4),
["<C-Space>"] = cmp.mapping.complete(),
["<C-e>"] = cmp.mapping.close(),
["<CR>"] = cmp.mapping.confirm({ select = true }),
["<C-k>"] = cmp.mapping(function(fallback)
if luasnip.expand_or_jumpable() then
luasnip.expand_or_jump()
else
fallback()
end
end, { "i", "s" }),
}),
sources = cmp.config.sources({
{ name = "nvim_lsp" },
{ name = "luasnip" },
{ name = "nvim_lsp_signature_help" },
{ name = "path" },
}, {
{ name = "buffer" },
}),
})
-------------------------------------------------------------------------------
--navigator
-------------------------------------------------------------------------------
--require("navigator").setup({
-- mason = true,
--})
-------------------------------------------------------------------------------
--arduino
-------------------------------------------------------------------------------
---arduino setup
--[[require("mason-lspconfig").setup_handlers({
require("lspconfig").arduino_language_server.setup {
capabilities = capabilities,
cmd = {
"arduino-language-server",
" -cli-config",
" ~/Appdata/Local/Arduino15/arduino-cli.yaml",
"-cli",
"arduino-cli",
"-clangd",
"clangd",
"-fqbn",
"arduino:avr:uno",
},
-- root_dir = lspconfig.util.find_git_ancestor,
filetypes = { "arduino", "ino" },
print("arduino lsp started.")
}--require("arduineovim").setup()
})]]
-------------------------------------------------------------------------------
--snippet settings
-------------------------------------------------------------------------------
--
local ls = require("luasnip")
local s = ls.snippet
local sn = ls.snippet_node
local isn = ls.indent_snippet_node
local t = ls.text_node
local i = ls.insert_node
local f = ls.function_node
local c = ls.choice_node
local d = ls.dynamic_node
local r = ls.restore_node
local events = require("luasnip.util.events")
local ai = require("luasnip.nodes.absolute_indexer")
local extras = require("luasnip.extras")
local l = extras.lambda
local rep = extras.rep
local p = extras.partial
local m = extras.match
local n = extras.nonempty
local dl = extras.dynamic_lambda
local fmt = require("luasnip.extras.fmt").fmt
local fmta = require("luasnip.extras.fmt").fmta
local conds = require("luasnip.extras.expand_conditions")
local postfix = require("luasnip.extras.postfix").postfix
local types = require("luasnip.util.types")
local parse = require("luasnip.util.parser").parse_snippet
local ms = ls.multi_snippet
local k = require("luasnip.nodes.key_indexer").new_key
--global function for new line
function Nl()
return t("", "")
end
local LuaMS = require("snips.lua")
LuaMS:loader()
local texMS = require("snips.tex")
texMS:loader()
-------------------------------------------------------------------------------
--Formatter settings
-------------------------------------------------------------------------------
-- Utilities for creating configurations
local util = require("formatter.util")
-- Provides the Format, FormatWrite, FormatLock, and FormatWriteLock commands
local biome = function()
return {
exe = "npx",
args = {
"biome",
"format",
"--indent-width=4",
"--indent-style=tab",
-- `--stdin-file-path`の後にutil.escape_path(...)が来るようにする
"--stdin-file-path",
util.escape_path(util.get_current_buffer_file_path()),
},
stdin = true,
}
end
require("formatter").setup({
-- Enable or disable logging
logging = true,
-- Set the log level
log_level = vim.log.levels.WARN,
-- All formatter configurations are opt-in
filetype = {
-- Formatter configurations for filetype "lua" go here
-- and will be executed in order
lua = { biome },
cpp = {
function()
return {
exe = "clang-format",
args = { "--assume-filename", vim.api.nvim_buf_get_name(0) },
stdin = true,
}
end
},
markdown = {},
md = {},
mdx = {},
-- Use the special "*" filetype for defining formatter configurations on
-- any filetype
["*"] = {
-- "formatter.filetypes.any" defines default configurations for any
-- filetype
-- require("formatter.filetypes.any").remove_trailing_whitespace,
},
},
})
vim.api.nvim_create_autocmd("BufWritePost", {
pattern = "*",
command = "silent! FormatWrite",
})
-------------------------------------------------------------------------------
--Start Setting (goolord/alpha-nvim)
-------------------------------------------------------------------------------
local math = require("math")
local status_ok, alpha = pcall(require, "alpha")
if not status_ok then
return
end
local dashboard = require("alpha.themes.dashboard")
local pikachu = {
[[ ▀████▀▄▄ ▄█ ]],
[[ █▀ ▀▀▄▄▄▄▄ ▄▄▀▀█ ]],
[[ ▄ █ ▀▀▀▀▄ ▄▀ ]],
[[ ▄▀ ▀▄ ▀▄ ▀▄▀ ]],
[[ ▄▀ █ █▀ ▄█▀▄ ▄█ ]],
[[ ▀▄ ▀▄ █ ▀██▀ ██▄█ ]],
[[ ▀▄ ▄▀ █ ▄██▄ ▄ ▄ ▀▀ █ ]],
[[ █ ▄▀ █ ▀██▀ ▀▀ ▀▀ ▄▀ ]],
[[ █ █ █ ▄▄ ▄▀ ]],
}
--dashboard.header_color ="AlphaCol".. math.random(11)
dashboard.header_color = "#593822"
local another = {
[[ ▂▟▙▂ ]],
[[ ▂▄▆██▛ ▚▂▁]],
[[ ▛▀▀ ▝▜█▆▃]],
[[ ▞]],
[[]],
[[]],
[[]],
[[]],
[[]],
[[]],
}
local prop = {
[[ ← ]],
[[ ∧_∧ ]],
[[ ∧_∧・ω・`) ↑]],
[[↓ ( ・ω・`)・ω・`) ]],
[[ く| ⊂)ω・`) ]],
[[ (⌒ ヽ・`) ]],
[[ ∪ ̄\⊃ ]],
}
local jigen = {
[[ (X ]],
[[ (J13JZ1vG ]],
[[ ((-+<~(1.JwS3JXWfcX3 ]],
[[ (.zHwZ(H6JXuOXdZuWZdfUVoJ__ ]],
[[ (HZA4WYJGXYjGH6dXHSJ=_J3~jz-_ ]],
[[ (S<W>SddtdGd1Ywv!.~~(l(v(C(7OJ-~ ]],
[[ _(fTTT?!7?<?<~.~~~.__(-v1J<(v(JT&._ ]],
[[ (J<_._~........-.~_..-1(3(v-JCJ<++?ZJ+_ ]],
[[ _J43~....~~.......~._(?!_GZ>JIz1vuwJ<J1vZI+(-_]],
[[ (v1J!T+~~~...~....~_(J=.(vv7<?~1v(JC<J1vzwI_-^ ]],
[[ (JCv~J^_-=(9._~~_~.~_(J=-_-JO>-J!-v<J!(JCzO71x7! ]],
[[ (-?v-J!(C_-=(v~(v?G-(c~(=(Jv_JwC_(>(ciJ^.JCzV1-7~ ]],
[[ (u,.(>(C(J~(=(v~(v_-=-J1/<(Ov_JwO<(C(z<J^(v=.(J>_ ]],
[[ 7Tu.(=(C(Z^.v~J=(J&C_-Ov~JXXv(C(J1J=_J3.(dwk_ ]],
[[ ?T5J<(J:J3(vu=-JOZ!(KUCjv~J=(f!--zI(kw1d2 ]],
[[ TnJ-7~Y<J3dz>(WVjv!_d! .J7jZ!..(kWXXo ]],
[[ ~kSvz4qS-(J:(X<JC..(J7>>(DV~.`..0HSwIn, ]],
[[ (KS2(f777T<<~_-(?6(u&(+--k:....(UX0zSv-1, ]],
[[ (WXkHWS_▒▒▒▒_77▒▒▒▒▒▒▒.`.WV_...-uXVUTuww+?_ ]],
[[ (1WHHHR_1▒▒▒▒J_▒▒▒▒▒▒▒▒▒▒,S>-(JZJWVGJZCvT<- ]],
[[ (5udMW9dKj░░░(-░░░░░░░░░░░dS-JwwXYjV+wwUVXZ$_ ]],
[[ _&X8dq9dK (~ JW0Oz VwZuwXX=iwi- ]],
[[ ._ _4vTWHW% _ (GWXX VXXZXXXJwZwwS~ ]],
[[ (n.(, 4(HWf~ __.___--- ($wXX s3ZTXV1X0o?~ ]],
[[ (4C(Ya&(Z9d! +- -v(vGd +zjY=?=~ ]],
[[ (<JA0G?+uX3--.-_(G_ k((Z(3. ]],
[[ ?5RJjkk0wkZvvXHXd<((((JCJ>J! ]],
[[ ((kX0WWWGwGXHXkXkZ0ZZJJ$J ]],
[[ ?TAXYOHkWWkXWXX0ZjY= ]],
[[ ?<<<IJSUJ6whZ"= ]],
[[ ]],
[[ NeoVim-Qt v.0.9.4 started ]],
}
local major = vim.version()["major"]
local minor = vim.version()["minor"]
local patch = vim.version()["patch"]
local nvim_version = "v" .. major .. "." .. minor .. "." .. patch
local jigen2 = {
[[⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⢿⢋⠏⡁⡻⣿ ]],
[[⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠿⠟⢻⠏⡿⠻⠂⡃⢑⠌⠀⠀⢐⡼⣿ ]],
[[⣿⣿⣿⣿⣿⣿⣿⣿⣿⡍⡂⠔⡡⡊⢐⢕⡀⠐⠁⢠⣲⣽⢢⡶⡙⣿ ]],
[[⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣎⣒⣉⣠⣪⣢⣌⣤⣶⣿⣿⣿⡼⢌⣜⡵⢣⠭⣛⢿ ]],
[[⣿⣿⣿⣿⣿⣿⣿⣿⣿⠏⣸⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡿⣳⣋⢚⠕⠫⡪⡪⡪⡮⡍⡻⠿ ]],
[[⣿⣿⣿⣿⣿⣿⠿⣫⢕⣵⢝⢿⣿⣿⣿⣿⣿⣿⡿⣛⣵⡞⢍⡥⢿⡆⡰⢚⡠⡊⠈⠨⡨⢞⣵]],
[[⣿⣿⢿⡛⣩⢦⣿⣵⢟⡵⣫⢖⣝⠻⠟⡻⣟⠽⢊⡽⠋⣰⢟⡴⡫⢊⡴⢫⢂⡠⣚⣽ ]],
[[⣿⣽⢻⠞⡽⣫⢞⡵⣫⢞⡵⣋⡶⠫⣪⢞⢕⡵⠋⢀⢖⡵⡫⢊⡴⢫⡾⠛⢵⣿ ]],
[[⣿⣿⣿⣿⣶⣥⣟⡾⣡⢋⢜⠕⡴⢟⠑⣵⠋⢄⢔⣵⢫⣞⡠⢟⣇⣧⡁⠐⠁⢿ ]],
[[⣿⣿⣿⣿⣿⣿⣿⣿⠑⢌⣽⢛⡴⠗⣵⣃⡔⣱⡿⣗⣫⡽⡌⢡⣾⣿⣿⠄⠀⡨⡻ ]],
[[⣿⣿⣿⣿⣿⣿⣿⣟⠔⠐⠃⣾⣶⣾⣷⣿⣿⣷⣯⣬⣭⣬⠁⣺⣿⣿⠳⠀⠈⡨⠊⢪⣻ ]],
[[⣿⣿⣿⣿⣿⣿⢟⡂⠀⠀⠼⠞⣿⣿⣳⣿⣿⣿⣿⣿⣿⡟⢀⡛⢋⠕⢀⢄⠄⠄⠴⠛⢿ ]],
[[⣿⣿⣿⣿⣿⣿⣿⠇⠀⠀⠔⢱⣿⣿⣾⣿⣿⣿⣿⣿⣿⠁⡠⠀⠀⠀⠅⠁⢀⠔⢁⢿ ]],
[[⣿⣿⣿⣟⢿⡿⣿⣷⡱⡀⠀⣾⣿⣿⣿⣿⡿⢟⣽⣿⠣⠀⠀⠀⠀⡀⢀⠄⠁⣄⣥⣼ ]],
[[⣿⣿⣿⡿⢮⡘⠔⡹⡃⠀⢸⣿⣿⣯⢽⣿⣿⣿⣿⣯⡎⣆⣥⣭⣬⣴⣷⣶⣿ ]],
[[⣿⣿⣿⣿⣮⣄⡊⠊⠀⠄⠄⠚⠍⠡⠡⠟⢛⡛⢯⢋⢮⣾ ]],
[[⣿⣿⣿⣿⣿⣿⣦⣴⡒⠄⡁⠀⠀⠀⠀⠀⠀⠈⢀⣶ ]],
[[⣿⣿⣿⣿⣿⣿⣿⣿⣷⣾⣶⣿⣤⣾⣤⣬⣷⣾ ]],
[[]],
[[ Neovim ]] .. nvim_version .. [[ started!!]],
}
--used img2art in python
dashboard.section.header.val = jigen2
dashboard.section.buttons.val = {
dashboard.button("e", " New file", ":ene <BAR> startinsert <CR>"),
dashboard.button("b", " Back to the Session", ":SessionManager load_last_session<CR>:set autochdir<CR>"),
dashboard.button("r", " Recently used files", ":Telescope oldfiles <CR>"),
dashboard.button("f", " Find file", ":Telescope find_files <CR>"),
dashboard.button("t", " Find text", ":Telescope live_grep <CR>"),
dashboard.button("c", " Configuration", ":e$MYVIMRC<CR><Shift>U<CR>"),
dashboard.button("u", " Lazy", ":Lazy<CR><Shift-u>"),
dashboard.button("q", " Quit Neovim", ":qa<CR>"),
}
local function footer()
return "New era is coming...!"
end
dashboard.section.footer.val = footer()
dashboard.section.footer.opts.hl = "AlphaFooter"
dashboard.section.header.opts.hl = "AlphaHeader"
dashboard.section.buttons.opts.hl = "AlphaButtons"
dashboard.opts.opts.noautocmd = true
alpha.setup(dashboard.opts)
dashboard.section.buttons.val = {
dashboard.button("e", " New file", ":ene <BAR> startinsert <CR>"),
dashboard.button("b", " Back to the Session", ":SessionManager load_last_session<CR>:set autochdir<CR>"),
dashboard.button("r", " Recently used files", ":Telescope oldfiles <CR>"),
dashboard.button("f", " Find file", ":Telescope find_files <CR>"),
dashboard.button("t", " Find text", ":Telescope live_grep <CR>"),
dashboard.button("c", " Configuration", ":e $MYVIMRC<CR><Shift>U<CR>"),
dashboard.button("u", " Lazy", ":Lazy<CR><Shift-u>"),
dashboard.button("q", " Quit Neovim", ":qa<CR>"),
}
local function footer()
return "New era is coming...!"
end
dashboard.section.footer.val = footer()
dashboard.section.footer.opts.hl = "AlphaFooter"
dashboard.section.header.opts.hl = "AlphaHeader"
dashboard.section.buttons.opts.hl = "AlphaButtons"
dashboard.opts.opts.noautocmd = true
alpha.setup(dashboard.opts)
-------------------------------------------------------------------------------
--Filer setup (nvim-tree)
-------------------------------------------------------------------------------
-- disable netrw at the very start of your init.lua
vim.g.loaded_netrw = 1
vim.g.loaded_netrwPlugin = 1
--optionally enable 24-bit colour
vim.opt.termguicolors = true
--empty setup using defaults
--OR setup with some options
require("nvim-tree").setup({
sort = {
sorter = "case_sensitive",
},
view = {
width = 30,
},
renderer = {
group_empty = true,
},
filters = {
dotfiles = true,
},
})
-------------------------------------------------------------------------------
--Color Scheme (tokyonight)
-------------------------------------------------------------------------------
--tokyonight setting
--"./lua/plugins/tokyonight.lua"
vim.cmd([[colorscheme tokyonight]])
--CCC setting
--"./lua/plugins/ccc.lua"
--ToggleTerm setting
require("toggleterm").setup({
open_mapping = [[<c-\>]],
})
--lightline setting
vim.cmd([[
let g:lightline = {
\ 'colorscheme': 'wombat',
\ 'active': {
\ 'left': [ [ 'mode', 'paste' ],
\ [ 'gitbranch', 'readonly', 'filename', 'modified' ] ]
\ },
\ 'component_function': {
\ 'gitbranch': 'FugitiveHead'
\ }
\ }
]])
-------------------------------------------------------------------------------
--Autosave(pocco81/auto-save)
-------------------------------------------------------------------------------
require("auto-save").setup({
enabled = false, -- start NOT auto-save when the plugin is loaded (i.e. when your package manager loads it)
--vim.api.nvim_get_option_info2なんてのもあるらしい
--[[vim.api.nvim_create_autocmd({'BufEnter',"Filetype"},
{
pattern="*.tex",
callback=function()
if vim.o.filetype == "tex" then
vim.cmd("ASToggle")
end
end
}),]]
execution_message = {
message = function() -- message to print on save
return ("AutoSave: saved at " .. vim.fn.strftime("%Y/%b/%d %H:%M:%S"))
end,
dim = 0.18, -- dim the color of `message`
cleaning_interval = 1250, -- (milliseconds) automatically clean MsgArea after displaying `message`. See :h MsgArea
},
trigger_events = { "InsertLeave", "TextChanged" }, -- vim events that trigger auto-save. See :h events
-- function that determines whether to save the current buffer or not
-- return true: if buffer is ok to be saved
-- return false: if it's not ok to be saved
condition = function(buf)
local fn = vim.fn
local utils = require("auto-save.utils.data")
if fn.getbufvar(buf, "&modifiable") == 1 and utils.not_in(fn.getbufvar(buf, "&filetype"), {}) then
return true -- met condition(s), can save
end
return false -- can't save
end,
write_all_buffers = false, -- write all buffers when the current one meets `condition`
debounce_delay = 135, -- saves the file at most every `debounce_delay` milliseconds
callbacks = { -- functions to be executed at different intervals
enabling = nil, -- ran when enabling auto-save
disabling = nil, -- ran when disabling auto-save
before_asserting_save = nil, -- ran before checking `condition`
before_saving = nil, -- ran before doing the actual save
after_saving = nil, -- ran after doing the actual save
},
})
vim.api.nvim_set_keymap("n", "<leader>as", ":ASToggle<CR>", {})
vim.cmd("ASToggle")
-------------------------------------------------------------------------------
--Session (Shatur/session_manager)
-------------------------------------------------------------------------------
local Path = require("plenary.path")
local config = require("session_manager.config")
require("session_manager").setup({
sessions_dir = Path:new(vim.fn.stdpath("data"), "sessions"), -- The directory where the session files will be saved.
session_filename_to_dir = session_filename_to_dir, -- Function that replaces symbols into separators and colons to transform filename into a session directory.
dir_to_session_filename = dir_to_session_filename, -- Function that replaces separators and colons into special symbols to transform session directory into a filename. Should use `vim.loop.cwd()` if the passed `dir` is `nil`.
autoload_mode = config.AutoloadMode.Disabled, -- Define what to do when Neovim is started without arguments. Possible values: Disabled, CurrentDir, LastSession
autosave_last_session = true, -- Automatically save last session on exit and on session switch.
autosave_ignore_not_normal = true, -- Plugin will not save a session when no buffers are opened, or all of them aren't writable or listed.
autosave_ignore_dirs = {}, -- A list of directories where the session will not be autosaved.
autosave_ignore_filetypes = { -- All buffers of these file types will be closed before the session is saved.
"gitcommit",
"gitrebase",
},
autosave_ignore_buftypes = {}, -- All buffers of these bufer types will be closed before the session is saved.
autosave_only_in_session = false, -- Always autosaves session. If true, only autosaves after a session is active.
max_path_length = 80, -- Shorten the display path if length exceeds this threshold. Use 0 if don't want to shorten the path at all.
})
-------------------------------------------------------------------------------
--Where is changed (gitsigns)
-------------------------------------------------------------------------------
require("gitsigns").setup({
signs = {
add = { text = "" },
change = { text = "│" },
delete = { text = "_" },
topdelete = { text = "‾" },
changedelete = { text = "~" },
untracked = { text = "┆" },
},
signcolumn = true, -- Toggle with `:Gitsigns toggle_signs`
numhl = false, -- Toggle with `:Gitsigns toggle_numhl`
linehl = false, -- Toggle with `:Gitsigns toggle_linehl`
word_diff = false, -- Toggle with `:Gitsigns toggle_word_diff`
watch_gitdir = {
follow_files = true,
},
auto_attach = true,
attach_to_untracked = false,
current_line_blame = false, -- Toggle with `:Gitsigns toggle_current_line_blame`
current_line_blame_opts = {
virt_text = true,
virt_text_pos = "eol", -- 'eol' | 'overlay' | 'right_align'
delay = 1000,
ignore_whitespace = false,
virt_text_priority = 100,
},
current_line_blame_formatter = "<author>, <author_time:%Y-%m-%d> - <summary>",
sign_priority = 6,
update_debounce = 100,
status_formatter = nil, -- Use default
max_file_length = 40000, -- Disable if file is longer than this (in lines)
preview_config = {
-- Options passed to nvim_open_win
border = "single",
style = "minimal",
relative = "cursor",
row = 0,
col = 1,
},
})
-------------------------------------------------------------------------------
-- indent viewer (mini.indentscope)
-------------------------------------------------------------------------------
require("mini.indentscope").setup({
-- Draw options
draw = {
-- Delay (in ms) between event and start of drawing scope indicator
delay = 100,
-- Animation rule for scope's first drawing. A function which, given
-- next and total step numbers, returns wait time (in ms). See
-- |MiniIndentscope.gen_animation| for builtin options. To disable
-- animation, use `require('mini.indentscope').gen_animation.none()`.
--<function: implements constant 20ms between steps>,
-- Symbol priority. Increase to display on top of more symbols.
priority = 2,
},
-- Module mappings. Use `''` (empty string) to disable one.
mappings = {
-- Textobjects
object_scope = "ii",
object_scope_with_border = "ai",
-- Motions (jump to respective border line; if not present - body line)
goto_top = "[i",
goto_bottom = "]i",
},
-- Options which control scope computation
options = {
-- Type of scope's border: which line(s) with smaller indent to
-- categorize as border. Can be one of: 'both', 'top', 'bottom', 'none'.
border = "both",
-- Whether to use cursor column when computing reference indent.
-- Useful to see incremental scopes with horizontal cursor movements.
indent_at_cursor = true,
-- Whether to first check input line to be a border of adjacent scope.
-- Use it if you want to place cursor on function header to get scope of
-- its body.
try_as_border = false,
},
-- Which character to use for drawing scope indicator
symbol = "╎",
})
-------------------------------------------------------------------------------
-- htmlviewer (ray-x/web-tools.nvim)
-------------------------------------------------------------------------------
require 'web-tools'.setup({
keymaps = {
rename = nil, -- by default use same setup of lspconfig
repeat_rename = '.', -- . to repeat
},
hurl = { -- hurl default
show_headers = false, -- do not show http headers
floating = false, -- use floating windows (need guihua.lua)
json5 = false, -- use json5 parser require json5 treesitter
formatters = { -- format the result by filetype
json = { 'jq' },
html = { 'prettier', '--parser', 'html' },
},
},
})
-------------------------------------------------------------------------------
-- tab (romgrk/barbar.nvim)
-------------------------------------------------------------------------------
-- Set the filetypes which barbar will offset itself for
require 'barbar'.setup {
sidebar_filetypes = {
-- Use the default values: {event = 'BufWinLeave', text = '', align = 'left'}
NvimTree = true,
-- Or, specify the text used for the offset:
undotree = {
text = 'undotree',
align = 'center', -- *optionally* specify an alignment (either 'left', 'center', or 'right')
},
-- Or, specify the event which the sidebar executes when leaving:
['neo-tree'] = { event = 'BufWipeout' },
-- Or, specify all three
Outline = { event = 'BufWinLeave', text = 'symbols-outline', align = 'right' },
},
}
-------------------------------------------------------------------------------
-- プラグインのキーマッピング (例: telescope)
-------------------------------------------------------------------------------
vim.api.nvim_set_keymap("n", "<Leader>ff", "<cmd>Telescope find_files<CR>", {
noremap = true,
silent = true,
})
vim.api.nvim_set_keymap("n", "<Leader>d", "\"_d", {
noremap = true,
silent = true,
})
vim.api.nvim_set_keymap("n", "<Leader>;;", "<cmd>NvimTreeOpen<CR>", {
noremap = true,
silent = true,
})
vim.api.nvim_set_keymap(
"n",
"<Leader>tt",
"<cmd>ToggleTerm direction=horizontal size=12 name=here<CR><cmd>set nonumber<CR><cmd>set norelativenumber<CR>",
{
noremap = true,
silent = true, --再帰的マッピング無効化 エラー表示なし
}
)
local window_width = vim.api.nvim_get_option('columns') * 0.4
vim.api.nvim_set_keymap(
"n",
"<Leader>vtt",
"<cmd>ToggleTerm direction=vertical size=" ..
window_width .. " name=here<CR><cmd>set nonumber<CR><cmd>set norelativenumber<CR>",
{
noremap = true,
silent = true, --再帰的マッピング無効化 エラー表示なし
}
)
vim.api.nvim_set_keymap("t", "<Esc>", "<C-\\><C-n>", { noremap = true }) --terminal normalmode
vim.api.nvim_set_keymap("t", "<c-[>", "<C-\\><C-n>", { noremap = true }) --terminal normalmode
--ターミナル分割は2<C-\>でできます!
-- python3のパスを取得する
-- pythonのパスを取得する
local python3_path
local python_path
if vim.fn.has("win32") == 1 then
python3_path = vim.fn.trim(vim.fn.system("gcm python3"))
python_path = vim.fn.trim(vim.fn.system("gcm python"))
else
python3_path = vim.fn.trim(vim.fn.system("which python3"))
python_path = vim.fn.trim(vim.fn.system("which python"))
end
-- g:python3_host_progにpython3のパスを設定する
vim.g.python3_host_prog = python3_path
-- g:loaded_python3_providerを設定する
vim.g.loaded_python3_provider = 0
-------------------------------------------------------------------------------
--javascript Formatter
-------------------------------------------------------------------------------
vim.api.nvim_create_autocmd("BufWritePost", {
pattern = "*.js",
callback = function()
vim.cmd("silent !npx prettier --write %")
end,
})
-------------------------------------------------------------------------------
--VimTex
-------------------------------------------------------------------------------
vim.g.vimtex_view_method = 'okular'
vim.g.vimtex_view_general_viewer = 'okular'
--[[if os.getenv("VIRTUAL_ENV") then
local python_executable = ""
local virtual_env_bin_python = os.getenv("VIRTUAL_ENV") .. "/bin/python3"