diff options
Diffstat (limited to '.config/nvim')
26 files changed, 661 insertions, 207 deletions
diff --git a/.config/nvim/after/ftplugin/rust.vim b/.config/nvim/after/ftplugin/rust.vim deleted file mode 100644 index fb601d1..0000000 --- a/.config/nvim/after/ftplugin/rust.vim +++ /dev/null | |||
@@ -1,3 +0,0 @@ | |||
1 | setlocal tags=./rusty-tags.vi;/ | ||
2 | |||
3 | autocmd BufWritePost *.rs :silent! exec "!rusty-tags vi --quiet --start-dir=" . expand('%:p:h') . "&" | redraw! | ||
diff --git a/.config/nvim/after/ftplugin/tex.lua b/.config/nvim/after/ftplugin/tex.lua index 2a79358..2cd03a7 100644 --- a/.config/nvim/after/ftplugin/tex.lua +++ b/.config/nvim/after/ftplugin/tex.lua | |||
@@ -1,24 +1,29 @@ | |||
1 | require("nvim-surround").buffer_setup({ | 1 | require("nvim-surround").buffer_setup({ |
2 | surrounds = { | 2 | surrounds = { |
3 | ["B"] = { | 3 | ["K"] = { |
4 | add = function() | 4 | add = { "\\textbf{", "}" }, |
5 | return { { '\\textbf{' }, { '}' } } | 5 | find = "\\textbf%b{}", |
6 | end | 6 | delete = "^(\\textbf{)().-(})()$", |
7 | }, | 7 | }, |
8 | ["E"] = { | 8 | ["E"] = { |
9 | add = function() | 9 | add = { "\\emph{", "}" }, |
10 | return { { '\\emph{' }, { '}' } } | 10 | find = "\\emph%b{}", |
11 | end | 11 | delete = "^(\\emph{)().-(})()$", |
12 | }, | 12 | }, |
13 | ["T"] = { | 13 | ["T"] = { |
14 | add = function() | 14 | add = { "\\texttt{", "}" }, |
15 | return { { '\\texttt{' }, { '}' } } | 15 | find = "\\texttt%b{}", |
16 | end | 16 | delete = "^(\\texttt{)().-(})()$", |
17 | }, | 17 | }, |
18 | ['"'] = { | 18 | ['"'] = { |
19 | add = function() | 19 | add = { "\\enquote{", "}" }, |
20 | return { { '\\enquote{' }, { '}' } } | 20 | find = "\\enquote%b{}", |
21 | end, | 21 | delete = "^(\\enquote{)().-(})()$", |
22 | }, | ||
23 | ['P'] = { | ||
24 | add = { "\\paragraph{", "}" }, | ||
25 | find = "\\paragraph%b{}", | ||
26 | delete = "^(\\paragraph{)().-(})()$", | ||
22 | }, | 27 | }, |
23 | } | 28 | } |
24 | }) | 29 | }) |
diff --git a/.config/nvim/after/plugin/autocmds.vim b/.config/nvim/after/plugin/autocmds.vim index d249bef..21c7bc4 100644 --- a/.config/nvim/after/plugin/autocmds.vim +++ b/.config/nvim/after/plugin/autocmds.vim | |||
@@ -1,19 +1,7 @@ | |||
1 | " I don't know how to port this yet | 1 | " I don't know how to port this yet |
2 | autocmd BufRead,BufWrite * if ! &bin | silent! %s/\s\+$//ge | endif | 2 | autocmd BufRead,BufWrite * if ! &bin | silent! %s/\s\+$//ge | endif |
3 | 3 | ||
4 | autocmd BufNewFile,BufRead /tmp/neomutt* set noautoindent filetype=mail wm=0 tw=80 | 4 | augroup vimwiki |
5 | |||
6 | augroup bukugroup | ||
7 | au! BufRead,BufNewFile,BufEnter buku-edit-* set filetype=buku | ||
8 | augroup END | ||
9 | |||
10 | " Restore last position | ||
11 | autocmd BufReadPost * | ||
12 | \ if line("'\"") >= 1 && line("'\"") <= line("$") && &ft !~# 'commit' | ||
13 | \ | exe "normal! g`\"" | ||
14 | \ | endif | ||
15 | |||
16 | augroup pkgbuild | ||
17 | autocmd! | 5 | autocmd! |
18 | autocmd BufRead,BufNewFile PKGBUILD set filetype=PKGBUILD | 6 | autocmd BufRead,BufNewFile *.wiki set filetype=vimwiki |
19 | augroup END | 7 | augroup END |
diff --git a/.config/nvim/after/plugin/functions.vim b/.config/nvim/after/plugin/functions.vim index 87a1072..415ad51 100644 --- a/.config/nvim/after/plugin/functions.vim +++ b/.config/nvim/after/plugin/functions.vim | |||
@@ -11,10 +11,10 @@ function! CreatePaper(citekey) | |||
11 | exe "e! " . fnameescape("~/nextcloud/personal_wiki/text/papers/" . a:citekey . ".wiki") | 11 | exe "e! " . fnameescape("~/nextcloud/personal_wiki/text/papers/" . a:citekey . ".wiki") |
12 | 12 | ||
13 | let l:timestap="%date " . strftime("%F") | 13 | let l:timestap="%date " . strftime("%F") |
14 | let l:text="= Came From =\n\n= Takeaways =\n\n= Might Go To =\n\n" | 14 | let l:title="%title " |
15 | 15 | ||
16 | put! =l:timestap | 16 | put! =l:timestap |
17 | put =l:text | 17 | put =l:title |
18 | endfunction | 18 | endfunction |
19 | 19 | ||
20 | function! CreateReference(citekey) | 20 | function! CreateReference(citekey) |
diff --git a/.config/nvim/lazy-lock.json b/.config/nvim/lazy-lock.json deleted file mode 100644 index fe1e69c..0000000 --- a/.config/nvim/lazy-lock.json +++ /dev/null | |||
@@ -1,53 +0,0 @@ | |||
1 | { | ||
2 | "Comment.nvim": { "branch": "master", "commit": "0236521ea582747b58869cb72f70ccfa967d2e89" }, | ||
3 | "LuaSnip": { "branch": "master", "commit": "8ae1dedd988eb56441b7858bd1e8554dfadaa46d" }, | ||
4 | "barbar.nvim": { "branch": "master", "commit": "71ac376acd000743146b1e08e62151b4d887bbac" }, | ||
5 | "catppuccin": { "branch": "main", "commit": "9703f227bfab20d04bcee62d2f08f1795723b4ae" }, | ||
6 | "cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" }, | ||
7 | "cmp-nvim-lsp": { "branch": "main", "commit": "5af77f54de1b16c34b23cba810150689a3a90312" }, | ||
8 | "cmp-nvim-lsp-signature-help": { "branch": "main", "commit": "3d8912ebeb56e5ae08ef0906e3a54de1c66b92f1" }, | ||
9 | "cmp-nvim-lua": { "branch": "main", "commit": "f12408bdb54c39c23e67cab726264c10db33ada8" }, | ||
10 | "cmp-omni": { "branch": "main", "commit": "4ef610bbd85a5ee4e97e09450c0daecbdc60de86" }, | ||
11 | "cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" }, | ||
12 | "cmp_luasnip": { "branch": "master", "commit": "05a9ab28b53f71d1aece421ef32fee2cb857a843" }, | ||
13 | "dashboard-nvim": { "branch": "master", "commit": "413442b12d85315fc626c44a0ce4929b213ef604" }, | ||
14 | "dial.nvim": { "branch": "master", "commit": "27eb570085db2ef44bff4f620d3806039184651c" }, | ||
15 | "fidget.nvim": { "branch": "main", "commit": "4e854f3299e21d1c18279add340428a97520fc44" }, | ||
16 | "gitsigns.nvim": { "branch": "main", "commit": "2c2463dbd82eddd7dbab881c3a62cfbfbe3c67ae" }, | ||
17 | "indent-blankline.nvim": { "branch": "master", "commit": "821a7acd88587d966f7e464b0b3031dfe7f5680c" }, | ||
18 | "lazy.nvim": { "branch": "main", "commit": "aedcd79811d491b60d0a6577a9c1701063c2a609" }, | ||
19 | "leap.nvim": { "branch": "main", "commit": "52f7ce4fcc1764caac77cf4d43c2c4f5fb42d517" }, | ||
20 | "ltex-extra.nvim": { "branch": "master", "commit": "42dd3572cb09b52a137e91e515f2dff5eb631b1e" }, | ||
21 | "lualine.nvim": { "branch": "master", "commit": "7d131a8d3ba5016229e8a1d08bf8782acea98852" }, | ||
22 | "luasnip-snippets": { "branch": "main", "commit": "94307234ab0b1f37b154e564c80a15f1d5b04f82" }, | ||
23 | "neodev.nvim": { "branch": "main", "commit": "de3685b8c1cd439dd96b7958793f6f381f98652d" }, | ||
24 | "nvim-autopairs": { "branch": "master", "commit": "2e8a10c5fc0dcaf8296a5f1a7077efcd37065cc8" }, | ||
25 | "nvim-cmp": { "branch": "main", "commit": "04e0ca376d6abdbfc8b52180f8ea236cbfddf782" }, | ||
26 | "nvim-lspconfig": { "branch": "master", "commit": "d1bab4cf4b69e49d6058028fd933d8ef5e74e680" }, | ||
27 | "nvim-surround": { "branch": "main", "commit": "703ec63aa798e5e07d309b35e42def34bebe0174" }, | ||
28 | "nvim-tree.lua": { "branch": "master", "commit": "863cf832ceb0b2377c913b7696dd7d64f4978941" }, | ||
29 | "nvim-treesitter": { "branch": "master", "commit": "17d68ac13c902f55253b7facb47df4c0ae532575" }, | ||
30 | "nvim-treesitter-textobjects": { "branch": "master", "commit": "7f00d94543f1fd37cab2afa2e9a6cd54e1c6b9ef" }, | ||
31 | "nvim-ufo": { "branch": "main", "commit": "553d8a9c611caa9f020556d4a26b760698e5b81b" }, | ||
32 | "nvim-web-devicons": { "branch": "master", "commit": "7f30f2da3c3641841ceb0e2c150281f624445e8f" }, | ||
33 | "plenary.nvim": { "branch": "master", "commit": "4f71c0c4a196ceb656c824a70792f3df3ce6bb6d" }, | ||
34 | "promise-async": { "branch": "main", "commit": "94f6f03c6c1e2aab551aacdf0c1e597a7269abb6" }, | ||
35 | "rust-tools.nvim": { "branch": "master", "commit": "676187908a1ce35ffcd727c654ed68d851299d3e" }, | ||
36 | "substitute.nvim": { "branch": "main", "commit": "17ffaeb5a1dc2dbef39cf0865d8a4b6000836714" }, | ||
37 | "tabular": { "branch": "master", "commit": "339091ac4dd1f17e225fe7d57b48aff55f99b23a" }, | ||
38 | "targets.vim": { "branch": "master", "commit": "642d3a4ce306264b05ea3219920b13ea80931767" }, | ||
39 | "telescope-fzf-native.nvim": { "branch": "main", "commit": "6c921ca12321edaa773e324ef64ea301a1d0da62" }, | ||
40 | "telescope.nvim": { "branch": "master", "commit": "b744cf59752aaa01561afb4223006de26f3836fd" }, | ||
41 | "trouble.nvim": { "branch": "main", "commit": "f1168feada93c0154ede4d1fe9183bf69bac54ea" }, | ||
42 | "turkish-deasciifier.vim": { "branch": "master", "commit": "5b3a0bfef7424d218df7ab3dac8ee9dab42a105e" }, | ||
43 | "vim-characterize": { "branch": "master", "commit": "7fc5b75e7a9e46676cf736b56d99dd32004ff3d6" }, | ||
44 | "vim-cutlass": { "branch": "master", "commit": "7afd649415541634c8ce317fafbc31cd19d57589" }, | ||
45 | "vim-fugitive": { "branch": "master", "commit": "011cf4fcb93a9649ffc6dcdff56ef948f5d0f7cc" }, | ||
46 | "vim-illuminate": { "branch": "master", "commit": "305bf07b919ac526deb5193280379e2f8b599926" }, | ||
47 | "vim-move": { "branch": "master", "commit": "3c4195de0748da9bba25c54d78d959d349e93c55" }, | ||
48 | "vim-repeat": { "branch": "master", "commit": "24afe922e6a05891756ecf331f39a1f6743d3d5a" }, | ||
49 | "vim-unimpaired": { "branch": "master", "commit": "6d44a6dc2ec34607c41ec78acf81657248580bf1" }, | ||
50 | "vimtex": { "branch": "master", "commit": "9df79e15bf035d1cfb32c11fffed38dd7b6a0501" }, | ||
51 | "vimwiki": { "branch": "dev", "commit": "5f0a6c7523df3a15cc0331dc050a680ee4ddff04" }, | ||
52 | "yanky.nvim": { "branch": "main", "commit": "7c5cbf0122ff2dfbb6a92f14885894f65949cc8b" } | ||
53 | } \ No newline at end of file | ||
diff --git a/.config/nvim/lua/core/keymaps.lua b/.config/nvim/lua/core/keymaps.lua index 95e5fcd..318cfc7 100644 --- a/.config/nvim/lua/core/keymaps.lua +++ b/.config/nvim/lua/core/keymaps.lua | |||
@@ -49,6 +49,11 @@ map("n", "<leader>lp", "gewi[[/papers/<ESC>Ea]]<ESC>", "vimwiki: link wrap word | |||
49 | -- call CreateReference on word below cursor | 49 | -- call CreateReference on word below cursor |
50 | map("n", "<leader>nr", '<cmd>call CreateReference(expand("<cword>"))<CR>', "vimwiki: new reference word under cursor") | 50 | map("n", "<leader>nr", '<cmd>call CreateReference(expand("<cword>"))<CR>', "vimwiki: new reference word under cursor") |
51 | 51 | ||
52 | -- nr2char(10) is, of course, a newline character | ||
53 | map("n", "<leader>yp", | ||
54 | "<cmd>call setreg('+', expand('%:h') . '/' . expand('%:t') . ':' . line('.') . nr2char(10) . getline('.'))<CR>", | ||
55 | "yank the current line contents, filename and line number to clipboard") | ||
56 | |||
52 | -- create a new note | 57 | -- create a new note |
53 | map("n", "<leader>nn", "<cmd>call CreateNote()<CR>", "vimwiki: new note for slipbox") | 58 | map("n", "<leader>nn", "<cmd>call CreateNote()<CR>", "vimwiki: new note for slipbox") |
54 | 59 | ||
@@ -70,6 +75,7 @@ map('n', "'", '`') | |||
70 | map("n", "n", "nzzzv") | 75 | map("n", "n", "nzzzv") |
71 | map("n", "N", "Nzzzv") | 76 | map("n", "N", "Nzzzv") |
72 | 77 | ||
78 | |||
73 | -- switch between light and dark modes | 79 | -- switch between light and dark modes |
74 | map("n", "<leader>ut", function() | 80 | map("n", "<leader>ut", function() |
75 | if vim.o.background == "dark" then | 81 | if vim.o.background == "dark" then |
diff --git a/.config/nvim/lua/core/lazy.lua b/.config/nvim/lua/core/lazy.lua index 8a91029..815953f 100644 --- a/.config/nvim/lua/core/lazy.lua +++ b/.config/nvim/lua/core/lazy.lua | |||
@@ -1,14 +1,17 @@ | |||
1 | -- install lazy.nvim if not already installed | 1 | -- install lazy.nvim if not already installed |
2 | local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" | 2 | local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" |
3 | if not vim.loop.fs_stat(lazypath) then | 3 | if not (vim.uv or vim.loop).fs_stat(lazypath) then |
4 | vim.fn.system({ | 4 | local lazyrepo = "https://github.com/folke/lazy.nvim.git" |
5 | "git", | 5 | local out = vim.fn.system({ "git", "clone", "--filter=blob:none", "--branch=stable", lazyrepo, lazypath }) |
6 | "clone", | 6 | if vim.v.shell_error ~= 0 then |
7 | "--filter=blob:none", | 7 | vim.api.nvim_echo({ |
8 | "https://github.com/folke/lazy.nvim.git", | 8 | { "Failed to clone lazy.nvim:\n", "ErrorMsg" }, |
9 | "--branch=stable", -- latest stable release | 9 | { out, "WarningMsg" }, |
10 | lazypath, | 10 | { "\nPress any key to exit..." }, |
11 | }) | 11 | }, true, {}) |
12 | vim.fn.getchar() | ||
13 | os.exit(1) | ||
14 | end | ||
12 | end | 15 | end |
13 | vim.opt.rtp:prepend(lazypath) | 16 | vim.opt.rtp:prepend(lazypath) |
14 | 17 | ||
diff --git a/.config/nvim/lua/core/options.lua b/.config/nvim/lua/core/options.lua index 1a45b8f..9962f4f 100644 --- a/.config/nvim/lua/core/options.lua +++ b/.config/nvim/lua/core/options.lua | |||
@@ -63,6 +63,8 @@ local opts = { | |||
63 | -- switch case labels | 63 | -- switch case labels |
64 | cinoptions = "l1", | 64 | cinoptions = "l1", |
65 | 65 | ||
66 | signcolumn = "yes:1", | ||
67 | |||
66 | } | 68 | } |
67 | 69 | ||
68 | for opt, val in pairs(opts) do | 70 | for opt, val in pairs(opts) do |
diff --git a/.config/nvim/lua/helpers/autocmds.lua b/.config/nvim/lua/helpers/autocmds.lua index 11f4480..7461090 100644 --- a/.config/nvim/lua/helpers/autocmds.lua +++ b/.config/nvim/lua/helpers/autocmds.lua | |||
@@ -29,3 +29,130 @@ vim.api.nvim_create_autocmd("VimResized", { | |||
29 | }, | 29 | }, |
30 | command = "wincmd =", | 30 | command = "wincmd =", |
31 | }) | 31 | }) |
32 | |||
33 | -- https://github.com/LazyVim/LazyVim/blob/main/lua/lazyvim/config/autocmds.lua | ||
34 | -- Set typst filetype | ||
35 | vim.api.nvim_create_autocmd( | ||
36 | { | ||
37 | "BufNewFile", | ||
38 | "BufRead", | ||
39 | }, | ||
40 | { | ||
41 | group = augroup("typst"), | ||
42 | pattern = "*.typ", | ||
43 | callback = function() | ||
44 | local buf = vim.api.nvim_get_current_buf() | ||
45 | vim.api.nvim_set_option_value("filetype", "typst", { buf = buf }) | ||
46 | vim.api.nvim_set_option_value("shiftwidth", 2, { buf = buf }) | ||
47 | end | ||
48 | } | ||
49 | ) | ||
50 | |||
51 | -- Set PKGBUILD filetype | ||
52 | vim.api.nvim_create_autocmd( | ||
53 | { | ||
54 | "BufNewFile", | ||
55 | "BufRead", | ||
56 | }, | ||
57 | { | ||
58 | group = augroup("pkgbuild"), | ||
59 | pattern = "PKGBUILD", | ||
60 | callback = function() | ||
61 | local buf = vim.api.nvim_get_current_buf() | ||
62 | vim.api.nvim_set_option_value("filetype", "PKGBUILD", { buf = buf }) | ||
63 | end | ||
64 | } | ||
65 | ) | ||
66 | |||
67 | -- Set buku-edit filetype | ||
68 | vim.api.nvim_create_autocmd( | ||
69 | { | ||
70 | "BufNewFile", | ||
71 | "BufRead", | ||
72 | }, | ||
73 | { | ||
74 | group = augroup("buku-edit"), | ||
75 | pattern = "buku-edit-*", | ||
76 | callback = function() | ||
77 | local buf = vim.api.nvim_get_current_buf() | ||
78 | vim.api.nvim_set_option_value("filetype", "buku", { buf = buf }) | ||
79 | end | ||
80 | } | ||
81 | ) | ||
82 | |||
83 | -- Set mail filetype | ||
84 | vim.api.nvim_create_autocmd( | ||
85 | { | ||
86 | "BufNewFile", | ||
87 | "BufRead", | ||
88 | }, | ||
89 | { | ||
90 | group = augroup("mail"), | ||
91 | pattern = "/tmp/neomutt*", | ||
92 | callback = function() | ||
93 | local buf = vim.api.nvim_get_current_buf() | ||
94 | vim.api.nvim_set_option_value("autoindent", false, { buf = buf }) | ||
95 | vim.api.nvim_set_option_value("filetype", "mail", { buf = buf }) | ||
96 | vim.api.nvim_set_option_value("wrapmargin", 0, { buf = buf }) | ||
97 | vim.api.nvim_set_option_value("textwidth", 80, { buf = buf }) | ||
98 | end | ||
99 | } | ||
100 | ) | ||
101 | |||
102 | -- Resize splits if window got resized | ||
103 | vim.api.nvim_create_autocmd({ "VimResized" }, { | ||
104 | group = augroup("resize_splits"), | ||
105 | callback = function() | ||
106 | local current_tab = vim.fn.tabpagenr() | ||
107 | vim.cmd("tabdo wincmd =") | ||
108 | vim.cmd("tabnext " .. current_tab) | ||
109 | end, | ||
110 | }) | ||
111 | |||
112 | -- close some filetypes with <q> | ||
113 | vim.api.nvim_create_autocmd("FileType", { | ||
114 | group = augroup("close_with_q"), | ||
115 | pattern = { | ||
116 | "PlenaryTestPopup", | ||
117 | "checkhealth", | ||
118 | "dbout", | ||
119 | "gitsigns-blame", | ||
120 | "grug-far", | ||
121 | "help", | ||
122 | "lspinfo", | ||
123 | "neotest-output", | ||
124 | "neotest-output-panel", | ||
125 | "neotest-summary", | ||
126 | "notify", | ||
127 | "qf", | ||
128 | "snacks_win", | ||
129 | "spectre_panel", | ||
130 | "startuptime", | ||
131 | "tsplayground", | ||
132 | }, | ||
133 | callback = function(event) | ||
134 | vim.bo[event.buf].buflisted = false | ||
135 | vim.schedule(function() | ||
136 | vim.keymap.set("n", "q", function() | ||
137 | vim.cmd("close") | ||
138 | pcall(vim.api.nvim_buf_delete, event.buf, { force = true }) | ||
139 | end, { | ||
140 | buffer = event.buf, | ||
141 | silent = true, | ||
142 | desc = "Quit buffer", | ||
143 | }) | ||
144 | end) | ||
145 | end, | ||
146 | }) | ||
147 | |||
148 | -- Auto create dir when saving a file, in case some intermediate directory does not exist | ||
149 | vim.api.nvim_create_autocmd({ "BufWritePre" }, { | ||
150 | group = augroup("auto_create_dir"), | ||
151 | callback = function(event) | ||
152 | if event.match:match("^%w%w+:[\\/][\\/]") then | ||
153 | return | ||
154 | end | ||
155 | local file = vim.uv.fs_realpath(event.match) or event.match | ||
156 | vim.fn.mkdir(vim.fn.fnamemodify(file, ":p:h"), "p") | ||
157 | end, | ||
158 | }) | ||
diff --git a/.config/nvim/lua/luasnippets/PKGBUILD.lua b/.config/nvim/lua/luasnippets/PKGBUILD.lua new file mode 100644 index 0000000..334baf1 --- /dev/null +++ b/.config/nvim/lua/luasnippets/PKGBUILD.lua | |||
@@ -0,0 +1,36 @@ | |||
1 | local ls = require("luasnip") | ||
2 | local s = ls.snippet | ||
3 | local sn = ls.snippet_node | ||
4 | local isn = ls.indent_snippet_node | ||
5 | local t = ls.text_node | ||
6 | local i = ls.insert_node | ||
7 | local f = ls.function_node | ||
8 | local c = ls.choice_node | ||
9 | local d = ls.dynamic_node | ||
10 | local r = ls.restore_node | ||
11 | local events = require("luasnip.util.events") | ||
12 | local ai = require("luasnip.nodes.absolute_indexer") | ||
13 | local extras = require("luasnip.extras") | ||
14 | local l = extras.lambda | ||
15 | local rep = extras.rep | ||
16 | local p = extras.partial | ||
17 | local m = extras.match | ||
18 | local n = extras.nonempty | ||
19 | local dl = extras.dynamic_lambda | ||
20 | local fmt = require("luasnip.extras.fmt").fmt | ||
21 | local fmta = require("luasnip.extras.fmt").fmta | ||
22 | local conds = require("luasnip.extras.expand_conditions") | ||
23 | local postfix = require("luasnip.extras.postfix").postfix | ||
24 | local types = require("luasnip.util.types") | ||
25 | local parse = require("luasnip.util.parser").parse_snippet | ||
26 | local ms = ls.multi_snippet | ||
27 | local k = require("luasnip.nodes.key_indexer").new_key | ||
28 | local strftime = vim.fn.strftime | ||
29 | |||
30 | return { | ||
31 | s("m", | ||
32 | { | ||
33 | t("# Maintainer: Yigit Sever <yigit at yigitsever dot com>") | ||
34 | } | ||
35 | ) | ||
36 | } | ||
diff --git a/.config/nvim/lua/luasnippets/mail.lua b/.config/nvim/lua/luasnippets/mail.lua new file mode 100644 index 0000000..3d60baa --- /dev/null +++ b/.config/nvim/lua/luasnippets/mail.lua | |||
@@ -0,0 +1,36 @@ | |||
1 | local ls = require("luasnip") | ||
2 | local s = ls.snippet | ||
3 | local sn = ls.snippet_node | ||
4 | local isn = ls.indent_snippet_node | ||
5 | local t = ls.text_node | ||
6 | local i = ls.insert_node | ||
7 | local f = ls.function_node | ||
8 | local c = ls.choice_node | ||
9 | local d = ls.dynamic_node | ||
10 | local r = ls.restore_node | ||
11 | local events = require("luasnip.util.events") | ||
12 | local ai = require("luasnip.nodes.absolute_indexer") | ||
13 | local extras = require("luasnip.extras") | ||
14 | local l = extras.lambda | ||
15 | local rep = extras.rep | ||
16 | local p = extras.partial | ||
17 | local m = extras.match | ||
18 | local n = extras.nonempty | ||
19 | local dl = extras.dynamic_lambda | ||
20 | local fmt = require("luasnip.extras.fmt").fmt | ||
21 | local fmta = require("luasnip.extras.fmt").fmta | ||
22 | local conds = require("luasnip.extras.expand_conditions") | ||
23 | local postfix = require("luasnip.extras.postfix").postfix | ||
24 | local types = require("luasnip.util.types") | ||
25 | local parse = require("luasnip.util.parser").parse_snippet | ||
26 | local ms = ls.multi_snippet | ||
27 | local k = require("luasnip.nodes.key_indexer").new_key | ||
28 | local strftime = vim.fn.strftime | ||
29 | |||
30 | return { | ||
31 | s("~", | ||
32 | { | ||
33 | t("~yigit") | ||
34 | } | ||
35 | ) | ||
36 | } | ||
diff --git a/.config/nvim/lua/luasnippets/vimwiki.lua b/.config/nvim/lua/luasnippets/vimwiki.lua new file mode 100644 index 0000000..c5e8532 --- /dev/null +++ b/.config/nvim/lua/luasnippets/vimwiki.lua | |||
@@ -0,0 +1,60 @@ | |||
1 | local ls = require("luasnip") | ||
2 | local s = ls.snippet | ||
3 | local sn = ls.snippet_node | ||
4 | local isn = ls.indent_snippet_node | ||
5 | local t = ls.text_node | ||
6 | local i = ls.insert_node | ||
7 | local f = ls.function_node | ||
8 | local c = ls.choice_node | ||
9 | local d = ls.dynamic_node | ||
10 | local r = ls.restore_node | ||
11 | local events = require("luasnip.util.events") | ||
12 | local ai = require("luasnip.nodes.absolute_indexer") | ||
13 | local extras = require("luasnip.extras") | ||
14 | local l = extras.lambda | ||
15 | local rep = extras.rep | ||
16 | local p = extras.partial | ||
17 | local m = extras.match | ||
18 | local n = extras.nonempty | ||
19 | local dl = extras.dynamic_lambda | ||
20 | local fmt = require("luasnip.extras.fmt").fmt | ||
21 | local fmta = require("luasnip.extras.fmt").fmta | ||
22 | local conds = require("luasnip.extras.expand_conditions") | ||
23 | local postfix = require("luasnip.extras.postfix").postfix | ||
24 | local types = require("luasnip.util.types") | ||
25 | local parse = require("luasnip.util.parser").parse_snippet | ||
26 | local ms = ls.multi_snippet | ||
27 | local k = require("luasnip.nodes.key_indexer").new_key | ||
28 | local strftime = vim.fn.strftime | ||
29 | |||
30 | local function clipboard() | ||
31 | local text = vim.fn.system({ 'wl-paste' }) | ||
32 | local output = string.gsub(text, "^%s*(.-)%s*$", "%1") | ||
33 | return output | ||
34 | end | ||
35 | |||
36 | return { | ||
37 | s("datasrc", | ||
38 | { | ||
39 | t({ "= " }), i(1), t({ " =", "" }), | ||
40 | t({ "", "== Used By ==", "" }), i(2), | ||
41 | t({ "", "== URL ==", "" }), i(3), | ||
42 | t({ "", "== API ==", "" }), i(4), | ||
43 | t({ "", "=== Example ===", "" }), i(5), | ||
44 | t({ "", "== Cost ==", "" }), i(6), | ||
45 | t({ "", "== Limits ==", "" }), i(0), | ||
46 | } | ||
47 | ), | ||
48 | s("s", | ||
49 | { | ||
50 | t({ "- (" }), | ||
51 | t({ strftime("%F %R") }), | ||
52 | t({ ") " }), | ||
53 | i(1, clipboard()), | ||
54 | t({ " -- " }), | ||
55 | i(2, "Summary") | ||
56 | |||
57 | } | ||
58 | ) | ||
59 | } | ||
60 | |||
diff --git a/.config/nvim/lua/plugins/cmp.lua b/.config/nvim/lua/plugins/cmp.lua index 2e8fade..097d413 100644 --- a/.config/nvim/lua/plugins/cmp.lua +++ b/.config/nvim/lua/plugins/cmp.lua | |||
@@ -3,14 +3,22 @@ return { | |||
3 | "hrsh7th/nvim-cmp", | 3 | "hrsh7th/nvim-cmp", |
4 | dependencies = { | 4 | dependencies = { |
5 | "hrsh7th/cmp-nvim-lsp", | 5 | "hrsh7th/cmp-nvim-lsp", |
6 | "hrsh7th/cmp-nvim-lsp-signature-help", | ||
6 | "hrsh7th/cmp-nvim-lua", | 7 | "hrsh7th/cmp-nvim-lua", |
7 | "hrsh7th/cmp-buffer", | 8 | "hrsh7th/cmp-buffer", |
8 | "hrsh7th/cmp-path", | 9 | "hrsh7th/cmp-path", |
9 | "hrsh7th/cmp-omni", | 10 | "hrsh7th/cmp-omni", |
10 | "hrsh7th/cmp-nvim-lsp-signature-help", | 11 | "micangl/cmp-vimtex", |
11 | "L3MON4D3/LuaSnip", | 12 | "L3MON4D3/LuaSnip", |
12 | "saadparwaiz1/cmp_luasnip", | 13 | "saadparwaiz1/cmp_luasnip", |
13 | }, | 14 | }, |
15 | opts = function(_, opts) | ||
16 | opts.sources = opts.sources or {} | ||
17 | table.insert(opts.sources, { | ||
18 | name = "lazydev", | ||
19 | group_index = 0, -- set group index to 0 to skip loading LuaLS completions | ||
20 | }) | ||
21 | end, | ||
14 | config = function() | 22 | config = function() |
15 | local cmp = require("cmp") | 23 | local cmp = require("cmp") |
16 | local luasnip = require("luasnip") | 24 | local luasnip = require("luasnip") |
@@ -45,15 +53,13 @@ return { | |||
45 | TypeParameter = "", | 53 | TypeParameter = "", |
46 | } | 54 | } |
47 | 55 | ||
48 | ---@diagnostic disable-next-line: missing-fields | ||
49 | cmp.setup({ | 56 | cmp.setup({ |
50 | enabled = function() | 57 | enabled = function() |
51 | -- disable autocompletion in telescope prompt | 58 | -- disable autocompletion in telescope prompt |
52 | local buftype = vim.api.nvim_buf_get_option(0, "buftype") | 59 | local buftype = vim.api.nvim_get_option_value("buftype", {}) |
53 | 60 | ||
54 | return buftype ~= "prompt" | 61 | return buftype ~= "prompt" |
55 | end, | 62 | end, |
56 | ---@diagnostic disable-next-line: missing-fields | ||
57 | completion = { | 63 | completion = { |
58 | completeopt = "menu,menuone,noselect", | 64 | completeopt = "menu,menuone,noselect", |
59 | }, | 65 | }, |
@@ -67,32 +73,25 @@ return { | |||
67 | end, | 73 | end, |
68 | }, | 74 | }, |
69 | mapping = cmp.mapping.preset.insert({ | 75 | mapping = cmp.mapping.preset.insert({ |
70 | ["<C-f>"] = cmp.mapping.scroll_docs(-4), | 76 | ["<C-l>"] = cmp.mapping.confirm({ |
71 | ["<C-d>"] = cmp.mapping.scroll_docs(4), | ||
72 | ["<CR>"] = cmp.mapping.confirm({ | ||
73 | behavior = cmp.ConfirmBehavior.Replace, | 77 | behavior = cmp.ConfirmBehavior.Replace, |
74 | select = false, | 78 | select = true, |
75 | }), | 79 | }), |
76 | ["<Tab>"] = cmp.mapping(function(fallback) | 80 | ["<Tab>"] = cmp.mapping(function(fallback) |
77 | if cmp.visible() then | 81 | if luasnip.locally_jumpable(1) then |
78 | cmp.select_next_item() | 82 | luasnip.jump(1) |
79 | elseif luasnip.expand_or_jumpable() then | ||
80 | luasnip.expand_or_jump() | ||
81 | else | 83 | else |
82 | fallback() | 84 | fallback() |
83 | end | 85 | end |
84 | end, { "i", "s" }), | 86 | end, { "i", "s" }), |
85 | ["<S-Tab>"] = cmp.mapping(function(fallback) | 87 | ["<S-Tab>"] = cmp.mapping(function(fallback) |
86 | if cmp.visible() then | 88 | if luasnip.locally_jumpable(-1) then |
87 | cmp.select_prev_item() | ||
88 | elseif luasnip.jumpable(-1) then | ||
89 | luasnip.jump(-1) | 89 | luasnip.jump(-1) |
90 | else | 90 | else |
91 | fallback() | 91 | fallback() |
92 | end | 92 | end |
93 | end, { "i", "s" }), | 93 | end, { "i", "s" }), |
94 | }), | 94 | }), |
95 | ---@diagnostic disable-next-line: missing-fields | ||
96 | formatting = { | 95 | formatting = { |
97 | fields = { "kind", "abbr", "menu" }, | 96 | fields = { "kind", "abbr", "menu" }, |
98 | format = function(entry, vim_item) | 97 | format = function(entry, vim_item) |
@@ -106,15 +105,18 @@ return { | |||
106 | buffer = "[ ]", | 105 | buffer = "[ ]", |
107 | path = "[ ]", | 106 | path = "[ ]", |
108 | })[entry.source.name] | 107 | })[entry.source.name] |
109 | return vim_item | 108 | -- return vim_item |
109 | return require("nvim-highlight-colors").format(entry, vim_item) | ||
110 | end, | 110 | end, |
111 | }, | 111 | }, |
112 | sources = { | 112 | sources = { |
113 | { name = "nvim_lsp" }, | 113 | { name = "nvim_lsp" }, |
114 | { name = "nvim_lsp_signature_help" }, | 114 | { name = "nvim_lua" }, |
115 | { name = "luasnip" }, | ||
116 | { name = "buffer" }, | 115 | { name = "buffer" }, |
117 | { name = "path" }, | 116 | { name = "path" }, |
117 | { name = "vimtex" }, | ||
118 | { name = "nvim_lsp_signature_help" }, | ||
119 | { name = "luasnip" }, | ||
118 | }, | 120 | }, |
119 | }) | 121 | }) |
120 | 122 | ||
@@ -126,7 +128,6 @@ return { | |||
126 | ) | 128 | ) |
127 | 129 | ||
128 | -- use omnifunc in vimwiki to complete paths and tags | 130 | -- use omnifunc in vimwiki to complete paths and tags |
129 | ---@diagnostic disable-next-line: missing-fields | ||
130 | cmp.setup.filetype('vimwiki', { | 131 | cmp.setup.filetype('vimwiki', { |
131 | sources = cmp.config.sources({ | 132 | sources = cmp.config.sources({ |
132 | { name = "omni" }, | 133 | { name = "omni" }, |
@@ -142,7 +143,7 @@ return { | |||
142 | }, | 143 | }, |
143 | { | 144 | { |
144 | 'mireq/luasnip-snippets', | 145 | 'mireq/luasnip-snippets', |
145 | dependencies = {'L3MON4D3/LuaSnip'}, | 146 | dependencies = { 'L3MON4D3/LuaSnip' }, |
146 | init = function() | 147 | init = function() |
147 | require('luasnip_snippets.common.snip_utils').setup() | 148 | require('luasnip_snippets.common.snip_utils').setup() |
148 | end | 149 | end |
@@ -166,15 +167,10 @@ return { | |||
166 | -- Required to automatically include base snippets, like "c" snippets for "cpp" | 167 | -- Required to automatically include base snippets, like "c" snippets for "cpp" |
167 | load_ft_func = require('luasnip_snippets.common.snip_utils').load_ft_func, | 168 | load_ft_func = require('luasnip_snippets.common.snip_utils').load_ft_func, |
168 | ft_func = require('luasnip_snippets.common.snip_utils').ft_func, | 169 | ft_func = require('luasnip_snippets.common.snip_utils').ft_func, |
169 | -- To enable auto expansin | 170 | -- To enable auto expansion |
170 | enable_autosnippets = true, | 171 | enable_autosnippets = true, |
171 | -- Uncomment to enable visual snippets triggered using <c-x> | ||
172 | -- store_selection_keys = '<c-x>', | ||
173 | }) | 172 | }) |
174 | -- LuaSnip key bindings | 173 | require("luasnip.loaders.from_lua").lazy_load({ paths = "./lua/luasnippets" }) |
175 | vim.keymap.set({"i", "s"}, "<C-l>", function() if ls.expand_or_jumpable() then ls.expand_or_jump() else vim.api.nvim_input('<C-l>') end end, {silent = true}) | ||
176 | vim.keymap.set({"i", "s"}, "<C-k>", function() ls.jump(-1) end, {silent = true}) | ||
177 | vim.keymap.set({"i", "s"}, "<C-E>", function() if ls.choice_active() then ls.change_choice(1) end end, {silent = true}) | ||
178 | end | 174 | end |
179 | 175 | ||
180 | }, | 176 | }, |
diff --git a/.config/nvim/lua/plugins/conform.lua b/.config/nvim/lua/plugins/conform.lua new file mode 100644 index 0000000..9f15bbb --- /dev/null +++ b/.config/nvim/lua/plugins/conform.lua | |||
@@ -0,0 +1,18 @@ | |||
1 | return { | ||
2 | { | ||
3 | 'stevearc/conform.nvim', | ||
4 | opts = { | ||
5 | formatters_by_ft = { | ||
6 | lua = { "stylua" }, | ||
7 | -- Conform will run multiple formatters sequentially | ||
8 | python = { "isort", "black" }, | ||
9 | -- You can customize some of the format options for the filetype (:help conform.format) | ||
10 | rust = { "rustfmt", lsp_format = "fallback" }, | ||
11 | -- Conform will run the first available formatter | ||
12 | javascript = { "prettierd", "prettier", stop_after_first = true }, | ||
13 | -- latex | ||
14 | tex = { "tex-fmt" }, | ||
15 | }, | ||
16 | } | ||
17 | }, | ||
18 | } | ||
diff --git a/.config/nvim/lua/plugins/cutlass.lua b/.config/nvim/lua/plugins/cutlass.lua index b9332a9..c3cabe4 100644 --- a/.config/nvim/lua/plugins/cutlass.lua +++ b/.config/nvim/lua/plugins/cutlass.lua | |||
@@ -32,19 +32,39 @@ return { | |||
32 | { | 32 | { |
33 | "gbprod/yanky.nvim", | 33 | "gbprod/yanky.nvim", |
34 | config = function() | 34 | config = function() |
35 | -- fix Target STRING not available | 35 | if os.getenv("WAYLAND_DISPLAY") then |
36 | vim.g.clipboard = { | 36 | vim.g.clipboard = { |
37 | name = 'xsel_override', | 37 | name = "wl-clipboard", |
38 | copy = { | 38 | copy = { |
39 | ['+'] = 'xsel --input --clipboard', | 39 | ["+"] = 'wl-copy --foreground --type text/plain', |
40 | ['*'] = 'xsel --input --primary', | 40 | ["*"] = 'wl-copy --foreground --primary --type text/plain', |
41 | }, | 41 | }, |
42 | paste = { | 42 | paste = { |
43 | ['+'] = 'xsel --output --clipboard', | 43 | ["+"] = (function() |
44 | ['*'] = 'xsel --output --primary', | 44 | return vim.fn.systemlist('wl-paste --no-newline', { '' }, 1) -- '1' keeps empty lines |
45 | }, | 45 | end), |
46 | cache_enabled = 1, | 46 | ["*"] = (function() |
47 | } | 47 | return vim.fn.systemlist('wl-paste --primary --no-newline', { '' }, 1) |
48 | end), | ||
49 | }, | ||
50 | cache_enabled = true | ||
51 | } | ||
52 | else | ||
53 | -- fix Target STRING not available | ||
54 | -- if we are using xsel (X11) | ||
55 | vim.g.clipboard = { | ||
56 | name = 'xsel_override', | ||
57 | copy = { | ||
58 | ['+'] = 'xsel --input --clipboard', | ||
59 | ['*'] = 'xsel --input --primary', | ||
60 | }, | ||
61 | paste = { | ||
62 | ['+'] = 'xsel --output --clipboard', | ||
63 | ['*'] = 'xsel --output --primary', | ||
64 | }, | ||
65 | cache_enabled = 1, | ||
66 | } | ||
67 | end | ||
48 | 68 | ||
49 | local map = require("helpers.keys").map | 69 | local map = require("helpers.keys").map |
50 | 70 | ||
diff --git a/.config/nvim/lua/plugins/git.lua b/.config/nvim/lua/plugins/git.lua index 0e4d7f5..5f1c1e3 100644 --- a/.config/nvim/lua/plugins/git.lua +++ b/.config/nvim/lua/plugins/git.lua | |||
@@ -1,15 +1,27 @@ | |||
1 | return { | 1 | return { |
2 | { | 2 | { |
3 | "purarue/gitsigns-yadm.nvim", | ||
4 | lazy = true, | ||
5 | }, | ||
6 | { | ||
3 | "lewis6991/gitsigns.nvim", | 7 | "lewis6991/gitsigns.nvim", |
8 | event = { "BufReadPost", "VeryLazy" }, | ||
4 | opts = { | 9 | opts = { |
5 | signs = { | 10 | signs = { |
6 | add = { text = '│' }, | 11 | add = { text = '│' }, |
7 | change = { text = '│' }, | 12 | change = { text = '~' }, |
8 | delete = { text = '_' }, | 13 | delete = { text = '_' }, |
9 | topdelete = { text = '‾' }, | 14 | topdelete = { text = '‾' }, |
10 | changedelete = { text = '~' }, | 15 | changedelete = { text = '~' }, |
11 | untracked = { text = '┆' }, | 16 | untracked = { text = '┆' }, |
12 | }, | 17 | }, |
18 | _on_attach_pre = function(_, callback) | ||
19 | if vim.fn.executable("yadm") == 1 then | ||
20 | require("gitsigns-yadm").yadm_signs(callback) | ||
21 | else | ||
22 | callback() | ||
23 | end | ||
24 | end, | ||
13 | signcolumn = true, -- Toggle with `:Gitsigns toggle_signs` | 25 | signcolumn = true, -- Toggle with `:Gitsigns toggle_signs` |
14 | numhl = false, -- Toggle with `:Gitsigns toggle_numhl` | 26 | numhl = false, -- Toggle with `:Gitsigns toggle_numhl` |
15 | linehl = false, -- Toggle with `:Gitsigns toggle_linehl` | 27 | linehl = false, -- Toggle with `:Gitsigns toggle_linehl` |
@@ -38,10 +50,6 @@ return { | |||
38 | row = 0, | 50 | row = 0, |
39 | col = 1 | 51 | col = 1 |
40 | }, | 52 | }, |
41 | yadm = { | ||
42 | enable = true | ||
43 | }, | ||
44 | |||
45 | on_attach = function(bufnr) | 53 | on_attach = function(bufnr) |
46 | local gs = package.loaded.gitsigns | 54 | local gs = package.loaded.gitsigns |
47 | 55 | ||
@@ -89,7 +97,13 @@ return { | |||
89 | }, | 97 | }, |
90 | }, | 98 | }, |
91 | { | 99 | { |
92 | "tpope/vim-fugitive", | 100 | "NeogitOrg/neogit", |
93 | cmd = { 'Git', 'Gstatus', 'Gblame', 'Gpush', 'Gpull' }, | 101 | dependencies = { |
94 | }, | 102 | "nvim-lua/plenary.nvim", -- required |
103 | "sindrets/diffview.nvim", -- optional - Diff integration | ||
104 | "nvim-telescope/telescope.nvim", -- optional | ||
105 | }, | ||
106 | cmd = "Neogit", | ||
107 | config = true | ||
108 | } | ||
95 | } | 109 | } |
diff --git a/.config/nvim/lua/plugins/lastplace.lua b/.config/nvim/lua/plugins/lastplace.lua new file mode 100644 index 0000000..72e5c7f --- /dev/null +++ b/.config/nvim/lua/plugins/lastplace.lua | |||
@@ -0,0 +1,11 @@ | |||
1 | return { | ||
2 | { | ||
3 | "ethanholz/nvim-lastplace", | ||
4 | |||
5 | opts = { | ||
6 | lastplace_ignore_buftype = { "quickfix", "nofile", "help" }, | ||
7 | lastplace_ignore_filetype = { "gitcommit", "gitrebase", "svn", "hgcommit" }, | ||
8 | lastplace_open_folds = true, | ||
9 | }, | ||
10 | } | ||
11 | } | ||
diff --git a/.config/nvim/lua/plugins/lsp.lua b/.config/nvim/lua/plugins/lsp.lua index 029a0f1..e710fd7 100644 --- a/.config/nvim/lua/plugins/lsp.lua +++ b/.config/nvim/lua/plugins/lsp.lua | |||
@@ -1,9 +1,10 @@ | |||
1 | return { | 1 | return { |
2 | { | 2 | { |
3 | "neovim/nvim-lspconfig", | 3 | "neovim/nvim-lspconfig", |
4 | event = { "BufReadPost", "BufNewFile" }, | ||
5 | cmd = { "LspInfo", "LspInstall", "LspUninstall" }, | ||
4 | dependencies = { | 6 | dependencies = { |
5 | "j-hui/fidget.nvim", | 7 | "j-hui/fidget.nvim", |
6 | "folke/neodev.nvim", | ||
7 | "RRethy/vim-illuminate", | 8 | "RRethy/vim-illuminate", |
8 | "hrsh7th/cmp-nvim-lsp", | 9 | "hrsh7th/cmp-nvim-lsp", |
9 | }, | 10 | }, |
@@ -14,9 +15,6 @@ return { | |||
14 | map('n', '[d', vim.diagnostic.goto_prev, "lsp: goto previous diagnostic") | 15 | map('n', '[d', vim.diagnostic.goto_prev, "lsp: goto previous diagnostic") |
15 | map('n', ']d', vim.diagnostic.goto_next, "lsp: goto next diagnostic") | 16 | map('n', ']d', vim.diagnostic.goto_next, "lsp: goto next diagnostic") |
16 | 17 | ||
17 | -- neodev setup before lsp config | ||
18 | require("neodev").setup() | ||
19 | |||
20 | -- set up cool signs for diagnostics | 18 | -- set up cool signs for diagnostics |
21 | local signs = { Error = " ", Warn = "", Hint = "", Info = "" } | 19 | local signs = { Error = " ", Warn = "", Hint = "", Info = "" } |
22 | for type, icon in pairs(signs) do | 20 | for type, icon in pairs(signs) do |
@@ -72,6 +70,29 @@ return { | |||
72 | local capabilities = vim.lsp.protocol.make_client_capabilities() | 70 | local capabilities = vim.lsp.protocol.make_client_capabilities() |
73 | capabilities = require("cmp_nvim_lsp").default_capabilities(capabilities) | 71 | capabilities = require("cmp_nvim_lsp").default_capabilities(capabilities) |
74 | 72 | ||
73 | -- misc. | ||
74 | local lspconfig = require('lspconfig') | ||
75 | local servers = { 'ts_ls', 'jsonls', 'eslint', 'cssls', 'html', 'vala_ls', 'gopls' } | ||
76 | for _, lsp in pairs(servers) do | ||
77 | lspconfig[lsp].setup { | ||
78 | on_attach = on_attach, | ||
79 | capabilites = capabilities, | ||
80 | } | ||
81 | end | ||
82 | |||
83 | -- typst/tinymist | ||
84 | require("lspconfig")["tinymist"].setup({ | ||
85 | on_attach = on_attach, | ||
86 | capabilities = capabilities, | ||
87 | single_file_support = true, | ||
88 | root_dir = function() | ||
89 | return vim.fn.getcwd() | ||
90 | end, | ||
91 | settings = { | ||
92 | formatterMode = "typstyle", | ||
93 | } | ||
94 | }) | ||
95 | |||
75 | -- lua | 96 | -- lua |
76 | require("lspconfig")["lua_ls"].setup({ | 97 | require("lspconfig")["lua_ls"].setup({ |
77 | on_attach = on_attach, | 98 | on_attach = on_attach, |
@@ -120,10 +141,52 @@ return { | |||
120 | -- efm | 141 | -- efm |
121 | require("lspconfig")["efm"].setup({ | 142 | require("lspconfig")["efm"].setup({ |
122 | on_attach = on_attach, | 143 | on_attach = on_attach, |
123 | filetypes = { 'sh' }, | 144 | settings = { |
124 | capabilities = capabilities | 145 | initializationOptions = { |
146 | documentFormatting = true, | ||
147 | documentRangeFormatting = true, | ||
148 | hover = true, | ||
149 | documentSymbol = true, | ||
150 | codeAction = true, | ||
151 | completion = true | ||
152 | } | ||
153 | }, | ||
154 | capabilities = capabilities, | ||
155 | filetypes = { 'sh', 'tex' }, | ||
125 | }) | 156 | }) |
126 | 157 | ||
158 | require("lspconfig")["harper_ls"].setup { | ||
159 | on_attach = on_attach, | ||
160 | capabilities = capabilities, | ||
161 | settings = { | ||
162 | ["harper-ls"] = { | ||
163 | linters = { | ||
164 | spell_check = true, | ||
165 | spelled_numbers = false, | ||
166 | an_a = true, | ||
167 | sentence_capitalization = true, | ||
168 | unclosed_quotes = true, | ||
169 | wrong_quotes = false, | ||
170 | long_sentences = true, | ||
171 | repeated_words = true, | ||
172 | spaces = true, | ||
173 | matcher = true, | ||
174 | correct_number_suffix = true, | ||
175 | number_suffix_capitalization = true, | ||
176 | multiple_sequential_pronouns = true, | ||
177 | linking_verbs = false, | ||
178 | avoid_curses = true, | ||
179 | } | ||
180 | } | ||
181 | }, | ||
182 | filetypes = { | ||
183 | "markdown", "rust", "typescript", "typescriptreact", "javascript", "python", "c", "cpp", "ruby", "swift", "csharp", "toml", "lua", "gitcommit", "java", "html", "vimwiki", "tex" | ||
184 | }, | ||
185 | root_dir = function(fname) | ||
186 | return vim.fs.dirname(vim.fs.find('.git', { path = fname, upward = true })[1]) | ||
187 | end, | ||
188 | } | ||
189 | |||
127 | -- ltex | 190 | -- ltex |
128 | require("lspconfig")["ltex"].setup({ | 191 | require("lspconfig")["ltex"].setup({ |
129 | capabilities = capabilities, | 192 | capabilities = capabilities, |
@@ -135,51 +198,38 @@ return { | |||
135 | log_level = "none", | 198 | log_level = "none", |
136 | } | 199 | } |
137 | end, | 200 | end, |
201 | filetypes = { "bib", "gitcommit", "markdown", "org", "plaintex", "rst", "rnoweb", "tex", "pandoc", "quarto", "rmd", "context", "mail", "text" }, | ||
138 | settings = { | 202 | settings = { |
139 | ltex = { | 203 | ltex = { |
140 | -- my settings here | 204 | enabled = { "bibtex", "gitcommit", "markdown", "org", "tex", "restructuredtext", "rsweave", "latex", "quarto", "rmd", "context", "mail", "plaintext" } |
141 | } | 205 | } |
142 | } | 206 | } |
143 | }) | 207 | }) |
144 | 208 | ||
145 | -- rust-tools | 209 | vim.g.rustaceanvim = { |
146 | local rust_opts = { | 210 | -- Plugin configuration |
147 | tools = { | 211 | tools = { |
148 | runnables = { | ||
149 | use_telescope = true, | ||
150 | }, | ||
151 | inlay_hints = { | ||
152 | auto = true, | ||
153 | show_parameter_hints = true, | ||
154 | parameter_hints_prefix = "↸ ", | ||
155 | other_hints_prefix = "❱ ", | ||
156 | }, | ||
157 | }, | 212 | }, |
158 | 213 | -- LSP configuration | |
159 | -- all the opts to send to nvim-lspconfig | ||
160 | -- these override the defaults set by rust-tools.nvim | ||
161 | -- see https://github.com/neovim/nvim-lspconfig/blob/master/CONFIG.md#rust_analyzer | ||
162 | server = { | 214 | server = { |
163 | on_attach = on_attach, | 215 | on_attach = on_attach, |
164 | settings = { | 216 | vim.lsp.inlay_hint.enable(true), |
165 | -- to enable rust-analyzer settings visit: | 217 | default_settings = { |
166 | -- https://github.com/rust-analyzer/rust-analyzer/blob/master/docs/user/generated_config.adoc | 218 | -- rust-analyzer language server configuration |
167 | ["rust-analyzer"] = { | 219 | ['rust-analyzer'] = { |
168 | -- enable clippy on save | ||
169 | checkOnSave = { | ||
170 | command = "clippy", | ||
171 | }, | ||
172 | }, | 220 | }, |
173 | }, | 221 | }, |
174 | }, | 222 | }, |
223 | -- DAP configuration | ||
224 | dap = { | ||
225 | }, | ||
175 | } | 226 | } |
176 | |||
177 | require('rust-tools').setup(rust_opts) | ||
178 | end, | 227 | end, |
179 | }, | 228 | }, |
180 | { | 229 | { |
181 | "barreiroleo/ltex-extra.nvim", | 230 | "barreiroleo/ltex_extra.nvim", |
182 | event = "LspAttach", | 231 | ft = { "markdown", "tex" }, |
232 | dependencies = { "neovim/nvim-lspconfig" }, | ||
183 | }, | 233 | }, |
184 | { | 234 | { |
185 | "j-hui/fidget.nvim", | 235 | "j-hui/fidget.nvim", |
@@ -199,7 +249,38 @@ return { | |||
199 | }, | 249 | }, |
200 | }, | 250 | }, |
201 | { | 251 | { |
202 | "simrat39/rust-tools.nvim", | 252 | 'mrcjkb/rustaceanvim', |
203 | event = "LspAttach", | 253 | version = '^5', -- Recommended |
254 | lazy = false, -- This plugin is already lazy | ||
255 | }, | ||
256 | { | ||
257 | "folke/lazydev.nvim", | ||
258 | ft = "lua", | ||
259 | }, | ||
260 | { | ||
261 | 'fatih/vim-go' | ||
204 | }, | 262 | }, |
263 | { | ||
264 | "danymat/neogen", | ||
265 | config = true, | ||
266 | opts = { | ||
267 | snippet_engine = "luasnip", | ||
268 | languages = { | ||
269 | python = { | ||
270 | template = { | ||
271 | annotation_convention = "reST", | ||
272 | } | ||
273 | } | ||
274 | } | ||
275 | } | ||
276 | }, | ||
277 | { | ||
278 | 'marcelofern/vale.nvim', | ||
279 | config = function() | ||
280 | require("vale").setup({ | ||
281 | bin = "/usr/bin/vale", | ||
282 | vale_config_path = "$HOME/.config/vale/.vale.ini", | ||
283 | }) | ||
284 | end, | ||
285 | } | ||
205 | } | 286 | } |
diff --git a/.config/nvim/lua/plugins/lualine.lua b/.config/nvim/lua/plugins/lualine.lua index c4e936e..ba1099e 100644 --- a/.config/nvim/lua/plugins/lualine.lua +++ b/.config/nvim/lua/plugins/lualine.lua | |||
@@ -30,6 +30,7 @@ end | |||
30 | 30 | ||
31 | return { | 31 | return { |
32 | "nvim-lualine/lualine.nvim", | 32 | "nvim-lualine/lualine.nvim", |
33 | event = "VeryLazy", | ||
33 | dependencies = { | 34 | dependencies = { |
34 | "nvim-tree/nvim-web-devicons" | 35 | "nvim-tree/nvim-web-devicons" |
35 | }, | 36 | }, |
diff --git a/.config/nvim/lua/plugins/misc.lua b/.config/nvim/lua/plugins/misc.lua index f99051e..fc28ffa 100644 --- a/.config/nvim/lua/plugins/misc.lua +++ b/.config/nvim/lua/plugins/misc.lua | |||
@@ -80,4 +80,11 @@ return { | |||
80 | npairs.add_rule(Rule('%"', '%"', "remind")) | 80 | npairs.add_rule(Rule('%"', '%"', "remind")) |
81 | end | 81 | end |
82 | }, | 82 | }, |
83 | { | ||
84 | "brenoprata10/nvim-highlight-colors", | ||
85 | event = { "BufReadPost", "VeryLazy" }, | ||
86 | config = function() | ||
87 | require('nvim-highlight-colors').setup({}) | ||
88 | end | ||
89 | } | ||
83 | } | 90 | } |
diff --git a/.config/nvim/lua/plugins/nvim-tree.lua b/.config/nvim/lua/plugins/nvim-tree.lua index a2d4532..667a873 100644 --- a/.config/nvim/lua/plugins/nvim-tree.lua +++ b/.config/nvim/lua/plugins/nvim-tree.lua | |||
@@ -1,14 +1,15 @@ | |||
1 | return { | 1 | return { |
2 | { | 2 | { |
3 | "nvim-tree/nvim-tree.lua", | 3 | "nvim-tree/nvim-tree.lua", |
4 | lazy = false, | ||
5 | dependencies = { | 4 | dependencies = { |
6 | "nvim-tree/nvim-web-devicons", | 5 | "nvim-tree/nvim-web-devicons", |
7 | }, | 6 | }, |
8 | opts = { | 7 | opts = { |
9 | sort_by = "case_sensitive", | 8 | sort = { |
9 | sorter = "case_sensitive" | ||
10 | }, | ||
10 | diagnostics = { | 11 | diagnostics = { |
11 | enable = false, | 12 | enable = true, |
12 | icons = { | 13 | icons = { |
13 | hint = "❔", | 14 | hint = "❔", |
14 | info = "❕", | 15 | info = "❕", |
@@ -16,9 +17,6 @@ return { | |||
16 | error = "❌", | 17 | error = "❌", |
17 | } | 18 | } |
18 | }, | 19 | }, |
19 | view = { | ||
20 | adaptive_size = true, | ||
21 | }, | ||
22 | renderer = { | 20 | renderer = { |
23 | group_empty = true, | 21 | group_empty = true, |
24 | }, | 22 | }, |
@@ -34,7 +32,7 @@ return { | |||
34 | 32 | ||
35 | map("n", "vt", "<cmd>NvimTreeToggle<cr>") | 33 | map("n", "vt", "<cmd>NvimTreeToggle<cr>") |
36 | map("n", "vr", "<cmd>NvimTreeRefresh<cr>") | 34 | map("n", "vr", "<cmd>NvimTreeRefresh<cr>") |
37 | map("n", "vs", "<cmd>NvimTreeFindFile<cr>") | 35 | map("n", "vs", "<cmd>NvimTreeFindFile!<cr>") |
38 | end, | 36 | end, |
39 | }, | 37 | }, |
40 | } | 38 | } |
diff --git a/.config/nvim/lua/plugins/telescope.lua b/.config/nvim/lua/plugins/telescope.lua index 6acc9a6..bfda4aa 100644 --- a/.config/nvim/lua/plugins/telescope.lua +++ b/.config/nvim/lua/plugins/telescope.lua | |||
@@ -11,7 +11,6 @@ return { | |||
11 | }, | 11 | }, |
12 | "gbprod/yanky.nvim", | 12 | "gbprod/yanky.nvim", |
13 | }, | 13 | }, |
14 | lazy = false, | ||
15 | config = function() | 14 | config = function() |
16 | require('telescope').setup({ | 15 | require('telescope').setup({ |
17 | defaults = { | 16 | defaults = { |
@@ -47,6 +46,10 @@ return { | |||
47 | map("n", "<leader>sw", require("telescope.builtin").grep_string, "🔭: current word") | 46 | map("n", "<leader>sw", require("telescope.builtin").grep_string, "🔭: current word") |
48 | map("n", "<leader>sg", require("telescope.builtin").live_grep, "🔭: live grep") | 47 | map("n", "<leader>sg", require("telescope.builtin").live_grep, "🔭: live grep") |
49 | map("n", "<leader>sd", require("telescope.builtin").diagnostics, "🔭: diagnostics") | 48 | map("n", "<leader>sd", require("telescope.builtin").diagnostics, "🔭: diagnostics") |
49 | map("n", "<leader>sc", function() | ||
50 | require("telescope.builtin").lsp_document_symbols({ symbols = 'function' }) | ||
51 | end, "🔭: lsp symbols (functions)") | ||
52 | |||
50 | map("n", "<leader>st", function() | 53 | map("n", "<leader>st", function() |
51 | require("telescope.builtin").spell_suggest(require("telescope.themes").get_cursor({ | 54 | require("telescope.builtin").spell_suggest(require("telescope.themes").get_cursor({ |
52 | prompt_title = "", | 55 | prompt_title = "", |
diff --git a/.config/nvim/lua/plugins/trouble.lua b/.config/nvim/lua/plugins/trouble.lua index b80aed3..c11778c 100644 --- a/.config/nvim/lua/plugins/trouble.lua +++ b/.config/nvim/lua/plugins/trouble.lua | |||
@@ -1,16 +1,37 @@ | |||
1 | return { | 1 | return { |
2 | "folke/trouble.nvim", | 2 | "folke/trouble.nvim", |
3 | dependencies = { "nvim-tree/nvim-web-devicons" }, | 3 | cmd = "Trouble", |
4 | opts = {}, | 4 | opts = {}, |
5 | config = function() | 5 | keys = { |
6 | local map = require("helpers.keys").map | 6 | { |
7 | map("n", "<leader>xx", function() require("trouble").open() end, "trouble: open") | 7 | "<leader>xx", |
8 | map("n", "<leader>xw", function() require("trouble").open("workspace_diagnostics") end, | 8 | "<cmd>Trouble diagnostics toggle<cr>", |
9 | "trouble: open workspace diagnostics") | 9 | desc = "Diagnostics (Trouble)", |
10 | map("n", "<leader>xd", function() require("trouble").open("document_diagnostics") end, | 10 | }, |
11 | "trouble: open document diagnostics") | 11 | { |
12 | map("n", "<leader>xq", function() require("trouble").open("quickfix") end, "trouble: open quickfix") | 12 | "<leader>xX", |
13 | map("n", "<leader>xl", function() require("trouble").open("loclist") end, "trouble: open loclist") | 13 | "<cmd>Trouble diagnostics toggle filter.buf=0<cr>", |
14 | map("n", "gR", function() require("trouble").open("lsp_references") end, "trouble: open lsp references") | 14 | desc = "Buffer Diagnostics (Trouble)", |
15 | end, | 15 | }, |
16 | { | ||
17 | "<leader>cs", | ||
18 | "<cmd>Trouble symbols toggle focus=false<cr>", | ||
19 | desc = "Symbols (Trouble)", | ||
20 | }, | ||
21 | { | ||
22 | "<leader>cl", | ||
23 | "<cmd>Trouble lsp toggle focus=false win.position=right<cr>", | ||
24 | desc = "LSP Definitions / references / ... (Trouble)", | ||
25 | }, | ||
26 | { | ||
27 | "<leader>xL", | ||
28 | "<cmd>Trouble loclist toggle<cr>", | ||
29 | desc = "Location List (Trouble)", | ||
30 | }, | ||
31 | { | ||
32 | "<leader>xQ", | ||
33 | "<cmd>Trouble qflist toggle<cr>", | ||
34 | desc = "Quickfix List (Trouble)", | ||
35 | }, | ||
36 | }, | ||
16 | } | 37 | } |
diff --git a/.config/nvim/lua/plugins/typst.lua b/.config/nvim/lua/plugins/typst.lua new file mode 100644 index 0000000..c04ea70 --- /dev/null +++ b/.config/nvim/lua/plugins/typst.lua | |||
@@ -0,0 +1,10 @@ | |||
1 | return { | ||
2 | { | ||
3 | 'chomosuke/typst-preview.nvim', | ||
4 | ft = 'typst', | ||
5 | version = '1.*', | ||
6 | config = function() | ||
7 | require 'typst-preview'.setup {} | ||
8 | end, | ||
9 | } | ||
10 | } | ||
diff --git a/.config/nvim/lua/plugins/vimwiki.lua b/.config/nvim/lua/plugins/vimwiki.lua index a114b04..75d69cf 100644 --- a/.config/nvim/lua/plugins/vimwiki.lua +++ b/.config/nvim/lua/plugins/vimwiki.lua | |||
@@ -1,6 +1,6 @@ | |||
1 | return { | 1 | return { |
2 | { | 2 | { |
3 | "yigitsever/vimwiki", | 3 | "vimwiki/vimwiki", |
4 | init = function() | 4 | init = function() |
5 | vim.g.vimwiki_list = { | 5 | vim.g.vimwiki_list = { |
6 | { | 6 | { |
@@ -17,13 +17,12 @@ return { | |||
17 | } | 17 | } |
18 | vim.g.vimwiki_global_ext = 0 | 18 | vim.g.vimwiki_global_ext = 0 |
19 | vim.g.vimwiki_hl_headers = 1 | 19 | vim.g.vimwiki_hl_headers = 1 |
20 | |||
21 | local map = require("helpers.keys").map | ||
22 | |||
23 | --toggle checkmarks | ||
24 | map('n', '<leader>v', '<Plug>VimwikiToggleListItem', "vimwiki: toggle checkmark") | ||
25 | -- add/increase header level | ||
26 | map('n', '<leader>a', '<Plug>VimwikiAddHeaderLevel', "vimwiki: add header level") | ||
27 | end, | 20 | end, |
21 | keys = { | ||
22 | { "<leader>ww", "<Plug>VimwikiIndex", "vimwiki: goto wiki" }, | ||
23 | { "<leader>v", "<Plug>VimwikiToggleListItem", "vimwiki: toggle list item" }, | ||
24 | { "<leader>a", "<Plug>VimwikiAddHeaderLevel", "vimwiki: add header level" } | ||
25 | }, | ||
26 | ft = { "vimwiki" } | ||
28 | }, | 27 | }, |
29 | } | 28 | } |
diff --git a/.config/nvim/spell/en.utf-8.add b/.config/nvim/spell/en.utf-8.add index 3a1e37b..8374b5b 100644 --- a/.config/nvim/spell/en.utf-8.add +++ b/.config/nvim/spell/en.utf-8.add | |||
@@ -61,3 +61,71 @@ microcontroller | |||
61 | kubernetes | 61 | kubernetes |
62 | Kubernetes | 62 | Kubernetes |
63 | microdata | 63 | microdata |
64 | Tranco | ||
65 | CNAME | ||
66 | MX | ||
67 | NS | ||
68 | Alexa | ||
69 | AXFR | ||
70 | CTLs | ||
71 | PSL | ||
72 | subbrute | ||
73 | dnsrecon | ||
74 | CTL | ||
75 | FQDN | ||
76 | massdns | ||
77 | FQDNs | ||
78 | USENIX | ||
79 | AQUATONE | ||
80 | Sublist3r | ||
81 | Dorking | ||
82 | DNSDumpster | ||
83 | CyberSA | ||
84 | RNN | ||
85 | Degani | ||
86 | Recon | ||
87 | ICONAT | ||
88 | subfinder | ||
89 | ICICIS | ||
90 | crt | ||
91 | puredns | ||
92 | TakeOver | ||
93 | th | ||
94 | ICCIT | ||
95 | censys | ||
96 | NSDI | ||
97 | st | ||
98 | PDNS | ||
99 | Rapid7 | ||
100 | Zhang | ||
101 | AAAA | ||
102 | yigit | ||
103 | GAN | ||
104 | SIGAPP | ||
105 | altdns | ||
106 | com | ||
107 | bugcrowd | ||
108 | SecLists | ||
109 | IOP | ||
110 | Sudomy | ||
111 | OneForAll | ||
112 | HackerTarget | ||
113 | Spyse | ||
114 | GraphTunnel | ||
115 | Cloudflare | ||
116 | NSEC5 | ||
117 | S3 | ||
118 | a4paper | ||
119 | letterpaper | ||
120 | bibtex | ||
121 | SIGSAC | ||
122 | ICOEI | ||
123 | Gelernter | ||
124 | Global500 | ||
125 | Defenses | ||
126 | Analyzing | ||
127 | analyze | ||
128 | Wayback | ||
129 | FarSight | ||
130 | Zetalytics | ||
131 | VirusTotal | ||