summaryrefslogtreecommitdiffstats
path: root/.config/nvim/lua
diff options
context:
space:
mode:
Diffstat (limited to '.config/nvim/lua')
-rw-r--r--.config/nvim/lua/core/keymaps.lua6
-rw-r--r--.config/nvim/lua/core/lazy.lua21
-rw-r--r--.config/nvim/lua/core/options.lua2
-rw-r--r--.config/nvim/lua/helpers/autocmds.lua127
-rw-r--r--.config/nvim/lua/luasnippets/PKGBUILD.lua36
-rw-r--r--.config/nvim/lua/luasnippets/mail.lua36
-rw-r--r--.config/nvim/lua/luasnippets/vimwiki.lua60
-rw-r--r--.config/nvim/lua/plugins/cmp.lua52
-rw-r--r--.config/nvim/lua/plugins/conform.lua18
-rw-r--r--.config/nvim/lua/plugins/cutlass.lua46
-rw-r--r--.config/nvim/lua/plugins/git.lua30
-rw-r--r--.config/nvim/lua/plugins/lastplace.lua11
-rw-r--r--.config/nvim/lua/plugins/lsp.lua153
-rw-r--r--.config/nvim/lua/plugins/lualine.lua1
-rw-r--r--.config/nvim/lua/plugins/misc.lua7
-rw-r--r--.config/nvim/lua/plugins/nvim-tree.lua12
-rw-r--r--.config/nvim/lua/plugins/telescope.lua5
-rw-r--r--.config/nvim/lua/plugins/trouble.lua45
-rw-r--r--.config/nvim/lua/plugins/typst.lua10
-rw-r--r--.config/nvim/lua/plugins/vimwiki.lua15
20 files changed, 571 insertions, 122 deletions
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
50map("n", "<leader>nr", '<cmd>call CreateReference(expand("<cword>"))<CR>', "vimwiki: new reference word under cursor") 50map("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
53map("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
53map("n", "<leader>nn", "<cmd>call CreateNote()<CR>", "vimwiki: new note for slipbox") 58map("n", "<leader>nn", "<cmd>call CreateNote()<CR>", "vimwiki: new note for slipbox")
54 59
@@ -70,6 +75,7 @@ map('n', "'", '`')
70map("n", "n", "nzzzv") 75map("n", "n", "nzzzv")
71map("n", "N", "Nzzzv") 76map("n", "N", "Nzzzv")
72 77
78
73-- switch between light and dark modes 79-- switch between light and dark modes
74map("n", "<leader>ut", function() 80map("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
2local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" 2local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
3if not vim.loop.fs_stat(lazypath) then 3if 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
12end 15end
13vim.opt.rtp:prepend(lazypath) 16vim.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
68for opt, val in pairs(opts) do 70for 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
35vim.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
52vim.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
68vim.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
84vim.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
103vim.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>
113vim.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
149vim.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 @@
1local ls = require("luasnip")
2local s = ls.snippet
3local sn = ls.snippet_node
4local isn = ls.indent_snippet_node
5local t = ls.text_node
6local i = ls.insert_node
7local f = ls.function_node
8local c = ls.choice_node
9local d = ls.dynamic_node
10local r = ls.restore_node
11local events = require("luasnip.util.events")
12local ai = require("luasnip.nodes.absolute_indexer")
13local extras = require("luasnip.extras")
14local l = extras.lambda
15local rep = extras.rep
16local p = extras.partial
17local m = extras.match
18local n = extras.nonempty
19local dl = extras.dynamic_lambda
20local fmt = require("luasnip.extras.fmt").fmt
21local fmta = require("luasnip.extras.fmt").fmta
22local conds = require("luasnip.extras.expand_conditions")
23local postfix = require("luasnip.extras.postfix").postfix
24local types = require("luasnip.util.types")
25local parse = require("luasnip.util.parser").parse_snippet
26local ms = ls.multi_snippet
27local k = require("luasnip.nodes.key_indexer").new_key
28local strftime = vim.fn.strftime
29
30return {
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 @@
1local ls = require("luasnip")
2local s = ls.snippet
3local sn = ls.snippet_node
4local isn = ls.indent_snippet_node
5local t = ls.text_node
6local i = ls.insert_node
7local f = ls.function_node
8local c = ls.choice_node
9local d = ls.dynamic_node
10local r = ls.restore_node
11local events = require("luasnip.util.events")
12local ai = require("luasnip.nodes.absolute_indexer")
13local extras = require("luasnip.extras")
14local l = extras.lambda
15local rep = extras.rep
16local p = extras.partial
17local m = extras.match
18local n = extras.nonempty
19local dl = extras.dynamic_lambda
20local fmt = require("luasnip.extras.fmt").fmt
21local fmta = require("luasnip.extras.fmt").fmta
22local conds = require("luasnip.extras.expand_conditions")
23local postfix = require("luasnip.extras.postfix").postfix
24local types = require("luasnip.util.types")
25local parse = require("luasnip.util.parser").parse_snippet
26local ms = ls.multi_snippet
27local k = require("luasnip.nodes.key_indexer").new_key
28local strftime = vim.fn.strftime
29
30return {
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 @@
1local ls = require("luasnip")
2local s = ls.snippet
3local sn = ls.snippet_node
4local isn = ls.indent_snippet_node
5local t = ls.text_node
6local i = ls.insert_node
7local f = ls.function_node
8local c = ls.choice_node
9local d = ls.dynamic_node
10local r = ls.restore_node
11local events = require("luasnip.util.events")
12local ai = require("luasnip.nodes.absolute_indexer")
13local extras = require("luasnip.extras")
14local l = extras.lambda
15local rep = extras.rep
16local p = extras.partial
17local m = extras.match
18local n = extras.nonempty
19local dl = extras.dynamic_lambda
20local fmt = require("luasnip.extras.fmt").fmt
21local fmta = require("luasnip.extras.fmt").fmta
22local conds = require("luasnip.extras.expand_conditions")
23local postfix = require("luasnip.extras.postfix").postfix
24local types = require("luasnip.util.types")
25local parse = require("luasnip.util.parser").parse_snippet
26local ms = ls.multi_snippet
27local k = require("luasnip.nodes.key_indexer").new_key
28local strftime = vim.fn.strftime
29
30local function clipboard()
31 local text = vim.fn.system({ 'wl-paste' })
32 local output = string.gsub(text, "^%s*(.-)%s*$", "%1")
33 return output
34end
35
36return {
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 @@
1return {
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 @@
1return { 1return {
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 @@
1return {
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 @@
1return { 1return {
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
31return { 31return {
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 @@
1return { 1return {
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 @@
1return { 1return {
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 @@
1return {
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 @@
1return { 1return {
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}