21-plugins.lua - dotfiles - dark dots
HTML git clone https://git.drkhsh.at/dotfiles
DIR Log
DIR Files
DIR Refs
DIR Submodules
DIR README
DIR LICENSE
---
21-plugins.lua (4676B)
---
1 local add, now, later = MiniDeps.add, MiniDeps.now, MiniDeps.later
2 local now_if_args = vim.fn.argc(-1) > 0 and now or later
3
4 -- tree-sitter
5 now_if_args(function()
6 if vim.g.my_treesitter_enabled == 1 then
7 add({
8 source = "nvim-treesitter/nvim-treesitter",
9 checkout = "main",
10 hooks = {
11 post_checkout = function()
12 vim.cmd("TSUpdate")
13 end,
14 },
15 })
16 add({
17 source = "nvim-treesitter/nvim-treesitter-textobjects",
18 checkout = "main",
19 })
20
21 -- ensure installed
22 local ensure_installed = {
23 "c",
24 "lua",
25 "markdown",
26 "todotxt",
27 }
28 local isnt_installed = function(lang)
29 return #vim.api.nvim_get_runtime_file("parser/" .. lang .. ".*", false) == 0
30 end
31 local to_install = vim.tbl_filter(isnt_installed, ensure_installed)
32 if #to_install > 0 then
33 require("nvim-treesitter").install(to_install)
34 end
35
36 -- ensure enabled
37 local filetypes = vim.iter(ensure_installed):map(vim.treesitter.language.get_filetypes):flatten():totable()
38 vim.list_extend(filetypes, { "markdown", "pandoc" })
39 local ts_start = function(ev)
40 vim.treesitter.start(ev.buf)
41 end
42 vim.api.nvim_create_autocmd("FileType", { pattern = filetypes, callback = ts_start })
43
44 -- disable injections in 'lua' language
45 local ts_query = require("vim.treesitter.query")
46 local ts_query_set = vim.fn.has("nvim-0.9") == 1 and ts_query.set or ts_query.set_query
47 ts_query_set("lua", "injections", "")
48 end
49 end)
50
51 -- nvim-lspconfig
52 later(function()
53 -- enable LSP only on nvim>=0.11 as it introduced `vim.lsp.config`
54 if vim.fn.has('nvim-0.11') == 0 then return end
55
56 if vim.g.my_lsp_enabled == 1 then
57 add('neovim/nvim-lspconfig')
58 vim.lsp.enable({
59 'yamlls',
60 })
61 end
62 end)
63
64 -- themes
65 now(function()
66 add("folke/tokyonight.nvim")
67 require("tokyonight").setup({
68 dim_inactive = true,
69 })
70
71 add("miikanissi/modus-themes.nvim")
72 require("modus-themes").setup({
73 dim_inactive = true,
74 })
75
76 add("sainnhe/gruvbox-material")
77
78 add({
79 source = "ViViDboarder/wombat.nvim",
80 depends = { "rktjmp/lush.nvim" },
81 })
82 end)
83
84 -- ansiesc
85 later(function()
86 add("powerman/vim-plugin-AnsiEsc")
87 end)
88
89 -- tmux.nvim
90 later(function()
91 add("aserowy/tmux.nvim")
92 require("tmux").setup({
93 copy_sync = {
94 enable = true,
95 },
96 navigation = {
97 enable_default_keybindings = true,
98 },
99 resize = {
100 enable_default_keybindings = true,
101 },
102 })
103 end)
104
105 -- nvim-scrollbar
106 later(function()
107 add({
108 source = "petertriho/nvim-scrollbar",
109 depends = { "kevinhwang91/nvim-hlslens" },
110 })
111
112 local scrollbar = require("scrollbar")
113 scrollbar.setup({
114 show_in_active_only = true,
115 handle = {
116 blend = 0,
117 text = " ",
118 color = "#1c1c1c",
119 color_nr = 234,
120 },
121 marks = {
122 Cursor = { color = "#222222", text = " " },
123 Search = { color = "#C9A554" },
124 Error = { color = "#685742" },
125 Warn = { color = "#B36D43" },
126 Info = { color = "#5f875f" },
127 Hint = { color = "#5f875f" },
128 Misc = { color = "#bb7744" },
129 },
130 handlers = {
131 cursor = true,
132 diagnostic = true,
133 handle = true,
134 search = true,
135 },
136 })
137 require("scrollbar.handlers.search").setup({
138 override_lens = function() end,
139 })
140 end)
141
142 -- conform
143 later(function()
144 add("stevearc/conform.nvim")
145 local conform = require("conform")
146 conform.setup({
147 format_on_save = false,
148 formatters_by_ft = {
149 bitbake = { "oelint" },
150 c = { "clang-format" },
151 cpp = { "clang-format" },
152 css = { "stylelint" },
153 go = { "gofmt" },
154 javascript = { "clang-format" },
155 json = { "jq" },
156 lua = { "stylua" },
157 markdown = { "markdownfmt" },
158 python = { "isort", "black" },
159 rust = { "rustfmt" },
160 sh = { "shellcheck" },
161 typescript = { "clang-format" },
162 yaml = { "yamlfmt" },
163 },
164 formatters = {
165 ["oelint"] = {
166 command = "oelint-adv",
167 prepent_args = { "--fix" },
168 },
169 ["clang-format"] = {
170 command = "clang-format",
171 prepend_args = { "--style=file", "-i" },
172 },
173 },
174 })
175
176 vim.keymap.set("n", "<leader>rf", function()
177 require("conform").format({ async = true })
178 end)
179 end)
180
181 -- auto-save.nvim
182 later(function()
183 add("okuuva/auto-save.nvim")
184 require("auto-save").setup({
185 condition = function(buf)
186 -- don't auto-save for special-buffers
187 if vim.fn.getbufvar(buf, "&buftype") ~= "" then
188 return false
189 end
190
191 -- auto-save markdown, vimwiki, todotxt
192 if vim.bo.filetype == "markdown" then
193 return true
194 end
195 if vim.bo.filetype == "vimwiki" then
196 return true
197 end
198 if vim.bo.filetype == "todotxt" then
199 return true
200 end
201
202 -- default to no auto-save
203 return false
204 end,
205 })
206 end)
207
208 -- nvim-colorizer
209 later(function()
210 add("NvChad/nvim-colorizer.lua")
211 require("colorizer").setup({
212 user_default_options = {
213 css = true,
214 },
215 })
216 end)