init.lua 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689
  1. -- Set <space> as the leader key
  2. -- See `:help mapleader`
  3. -- NOTE: Must happen before plugins are loaded (otherwise wrong leader will be used)
  4. vim.g.mapleader = ' '
  5. vim.g.maplocalleader = '\\'
  6. -- Set to true if you have a Nerd Font installed and selected in the terminal
  7. vim.g.have_nerd_font = true
  8. -- [[ Setting options ]]
  9. -- See `:help vim.o`
  10. -- NOTE: You can change these options as you wish!
  11. -- For more options, you can see `:help option-list`
  12. -- formatoptions add "r"
  13. vim.o.formatoptions = 'jcroql'
  14. -- j = true,
  15. -- c = true,
  16. -- r = true,
  17. -- o = true,
  18. -- q = true,
  19. -- l = true,
  20. -- }
  21. -- Set default indent and shift width to 4
  22. vim.o.shiftwidth = 4
  23. vim.o.tabstop = 4
  24. -- Expand tabs to spaces
  25. vim.o.expandtab = true
  26. -- Color the 80-th column of the buffer
  27. vim.o.colorcolumn = '80'
  28. -- Make line numbers default
  29. vim.o.number = true
  30. -- You can also add relative line numbers, to help with jumping.
  31. -- Experiment for yourself to see if you like it!
  32. vim.o.relativenumber = true
  33. -- Enable mouse mode, can be useful for resizing splits for example!
  34. vim.o.mouse = 'a'
  35. -- Don't show the mode, since it's already in the status line
  36. vim.o.showmode = false
  37. -- Use LSP for folding when possible
  38. vim.o.foldmethod = 'expr'
  39. vim.o.foldexpr = 'v:lua.vim.lsp.foldexpr()'
  40. vim.o.foldlevelstart = 99
  41. -- Sync clipboard between OS and Neovim.
  42. -- Schedule the setting after `UiEnter` because it can increase startup-time.
  43. -- Remove this option if you want your OS clipboard to remain independent.
  44. -- See `:help 'clipboard'`
  45. vim.schedule(function()
  46. vim.o.clipboard = 'unnamedplus'
  47. end)
  48. -- Enable break indent
  49. vim.o.breakindent = true
  50. -- Save undo history
  51. vim.o.undofile = true
  52. -- Case-insensitive searching UNLESS \C or one or more capital letters in the search term
  53. vim.o.ignorecase = true
  54. vim.o.smartcase = true
  55. -- Keep signcolumn on by default
  56. vim.o.signcolumn = 'yes'
  57. -- Decrease update time
  58. vim.o.updatetime = 250
  59. -- Decrease mapped sequence wait time
  60. vim.o.timeoutlen = 300
  61. -- Configure how new splits should be opened
  62. vim.o.splitright = true
  63. vim.o.splitbelow = true
  64. -- Sets how neovim will display certain whitespace characters in the editor.
  65. -- See `:help 'list'`
  66. -- and `:help 'listchars'`
  67. --
  68. -- Notice listchars is set using `vim.opt` instead of `vim.o`.
  69. -- It is very similar to `vim.o` but offers an interface for conveniently interacting with tables.
  70. -- See `:help lua-options`
  71. -- and `:help lua-options-guide`
  72. vim.o.list = false
  73. vim.opt.listchars = { trail = '·' }
  74. -- Preview substitutions live, as you type!
  75. vim.o.inccommand = 'split'
  76. -- Show which line your cursor is on
  77. vim.o.cursorline = true
  78. -- Minimal number of screen lines to keep above and below the cursor.
  79. vim.o.scrolloff = 10
  80. -- if performing an operation that would fail due to unsaved changes in the buffer (like `:q`),
  81. -- instead raise a dialog asking if you wish to save the current file(s)
  82. -- See `:help 'confirm'`
  83. vim.o.confirm = true
  84. -- [[ Basic Keymaps ]]
  85. -- See `:help vim.keymap.set()`
  86. -- Clear highlights on search when pressing <Esc> in normal mode
  87. -- See `:help hlsearch`
  88. vim.keymap.set('n', '<Esc>', '<cmd>nohlsearch<CR>')
  89. -- Diagnostic keymaps
  90. vim.keymap.set('n', '<leader>q', vim.diagnostic.setloclist, { desc = 'Open diagnostic [Q]uickfix list' })
  91. -- Exit terminal mode in the builtin terminal with a shortcut that is a bit easier
  92. -- for people to discover. Otherwise, you normally need to press <C-\><C-n>, which
  93. -- is not what someone will guess without a bit more experience.
  94. --
  95. -- NOTE: This won't work in all terminal emulators/tmux/etc. Try your own mapping
  96. -- or just use <C-\><C-n> to exit terminal mode
  97. vim.keymap.set('t', '<Esc><Esc>', '<C-\\><C-n>', { desc = 'Exit terminal mode' })
  98. vim.keymap.set('t', '<C-/>', '<C-\\><C-n><cmd>hide<CR>', { desc = 'Hide the terminal' })
  99. -- TIP: Disable arrow keys in normal mode
  100. -- vim.keymap.set('n', '<left>', '<cmd>echo "Use h to move!!"<CR>')
  101. -- vim.keymap.set('n', '<right>', '<cmd>echo "Use l to move!!"<CR>')
  102. -- vim.keymap.set('n', '<up>', '<cmd>echo "Use k to move!!"<CR>')
  103. -- vim.keymap.set('n', '<down>', '<cmd>echo "Use j to move!!"<CR>')
  104. -- Keybinds to make split navigation easier.
  105. -- Use CTRL+<hjkl> to switch between windows
  106. --
  107. -- See `:help wincmd` for a list of all window commands
  108. vim.keymap.set('n', '<C-h>', '<C-w><C-h>', { desc = 'Move focus to the left window' })
  109. vim.keymap.set('n', '<C-l>', '<C-w><C-l>', { desc = 'Move focus to the right window' })
  110. vim.keymap.set('n', '<C-j>', '<C-w><C-j>', { desc = 'Move focus to the lower window' })
  111. vim.keymap.set('n', '<C-k>', '<C-w><C-k>', { desc = 'Move focus to the upper window' })
  112. -- NOTE: Some terminals have colliding keymaps or are not able to send distinct keycodes
  113. -- vim.keymap.set("n", "<C-S-h>", "<C-w>H", { desc = "Move window to the left" })
  114. -- vim.keymap.set("n", "<C-S-l>", "<C-w>L", { desc = "Move window to the right" })
  115. -- vim.keymap.set("n", "<C-S-j>", "<C-w>J", { desc = "Move window to the lower" })
  116. -- vim.keymap.set("n", "<C-S-k>", "<C-w>K", { desc = "Move window to the upper" })
  117. -- Reselect highlight after indent
  118. vim.keymap.set('v', '>', '>gv', { desc = 'Indent selection one tabstop' })
  119. vim.keymap.set('v', '<', '<gv', { desc = 'Unindent selection one tabstop' })
  120. -- [[ Basic Autocommands ]]
  121. -- See `:help lua-guide-autocommands`
  122. -- Highlight when yanking (copying) text
  123. -- Try it with `yap` in normal mode
  124. -- See `:help vim.hl.on_yank()`
  125. vim.api.nvim_create_autocmd('TextYankPost', {
  126. desc = 'Highlight when yanking (copying) text',
  127. group = vim.api.nvim_create_augroup('kickstart-highlight-yank', { clear = true }),
  128. callback = function()
  129. vim.hl.on_yank()
  130. end,
  131. })
  132. -- Fix caret jumping around when pressing tab. Requires luasnip
  133. -- https://github.com/NvChad/NvChad/issues/1223#issuecomment-1159392548
  134. vim.api.nvim_create_autocmd('InsertLeave', {
  135. callback = function()
  136. if require('luasnip').session.current_nodes[vim.api.nvim_get_current_buf()] and not require('luasnip').session.jump_active then
  137. require('luasnip').unlink_current()
  138. end
  139. end,
  140. })
  141. -- [[ Install `lazy.nvim` plugin manager ]]
  142. -- See `:help lazy.nvim.txt` or https://github.com/folke/lazy.nvim for more info
  143. local lazypath = vim.fn.stdpath 'data' .. '/lazy/lazy.nvim'
  144. if not (vim.uv or vim.loop).fs_stat(lazypath) then
  145. local lazyrepo = 'https://github.com/folke/lazy.nvim.git'
  146. local out = vim.fn.system { 'git', 'clone', '--filter=blob:none', '--branch=stable', lazyrepo, lazypath }
  147. if vim.v.shell_error ~= 0 then
  148. error('Error cloning lazy.nvim:\n' .. out)
  149. end
  150. end
  151. ---@type vim.Option
  152. local rtp = vim.opt.rtp
  153. rtp:prepend(lazypath)
  154. -- [[ Configure and install plugins ]]
  155. --
  156. -- To check the current status of your plugins, run
  157. -- :Lazy
  158. --
  159. -- You can press `?` in this menu for help. Use `:q` to close the window
  160. --
  161. -- To update plugins you can run
  162. -- :Lazy update
  163. --
  164. -- NOTE: Here is where you install your plugins.
  165. require('lazy').setup({
  166. -- NOTE: Plugins can be added with a link (or for a github repo: 'owner/repo' link).
  167. 'NMAC427/guess-indent.nvim', -- Detect tabstop and shiftwidth automatically
  168. { -- Adds git related signs to the gutter, as well as utilities for managing changes
  169. 'lewis6991/gitsigns.nvim',
  170. opts = {
  171. signs = {
  172. add = { text = '+' },
  173. change = { text = '~' },
  174. delete = { text = '_' },
  175. topdelete = { text = '‾' },
  176. changedelete = { text = '~' },
  177. },
  178. },
  179. },
  180. { -- Useful plugin to show you pending keybinds.
  181. 'folke/which-key.nvim',
  182. event = 'VimEnter', -- Sets the loading event to 'VimEnter'
  183. opts = {
  184. preset = 'modern',
  185. -- delay between pressing a key and opening which-key (milliseconds)
  186. -- this setting is independent of vim.o.timeoutlen
  187. delay = 0,
  188. icons = {
  189. -- set icon mappings to true if you have a Nerd Font
  190. mappings = vim.g.have_nerd_font,
  191. -- If you are using a Nerd Font: set icons.keys to an empty table which will use the
  192. -- default which-key.nvim defined Nerd Font icons, otherwise define a string table
  193. keys = vim.g.have_nerd_font and {} or {
  194. Up = '<Up> ',
  195. Down = '<Down> ',
  196. Left = '<Left> ',
  197. Right = '<Right> ',
  198. C = '<C-…> ',
  199. M = '<M-…> ',
  200. D = '<D-…> ',
  201. S = '<S-…> ',
  202. CR = '<CR> ',
  203. Esc = '<Esc> ',
  204. ScrollWheelDown = '<ScrollWheelDown> ',
  205. ScrollWheelUp = '<ScrollWheelUp> ',
  206. NL = '<NL> ',
  207. BS = '<BS> ',
  208. Space = '<Space> ',
  209. Tab = '<Tab> ',
  210. F1 = '<F1>',
  211. F2 = '<F2>',
  212. F3 = '<F3>',
  213. F4 = '<F4>',
  214. F5 = '<F5>',
  215. F6 = '<F6>',
  216. F7 = '<F7>',
  217. F8 = '<F8>',
  218. F9 = '<F9>',
  219. F10 = '<F10>',
  220. F11 = '<F11>',
  221. F12 = '<F12>',
  222. },
  223. },
  224. -- Document existing key chains
  225. spec = {
  226. { '<leader>s', group = '[S]earch' },
  227. { '<leader>t', group = '[T]oggle' },
  228. { '<leader>h', group = 'Git [H]unk', mode = { 'n', 'v' } },
  229. },
  230. },
  231. },
  232. { -- Fuzzy Finder (files, lsp, etc)
  233. 'nvim-telescope/telescope.nvim',
  234. event = 'VimEnter',
  235. dependencies = {
  236. 'nvim-lua/plenary.nvim',
  237. { -- If encountering errors, see telescope-fzf-native README for installation instructions
  238. 'nvim-telescope/telescope-fzf-native.nvim',
  239. -- `build` is used to run some command when the plugin is installed/updated.
  240. -- This is only run then, not every time Neovim starts up.
  241. build = 'make',
  242. -- `cond` is a condition used to determine whether this plugin should be
  243. -- installed and loaded.
  244. cond = function()
  245. return vim.fn.executable 'make' == 1
  246. end,
  247. },
  248. { 'nvim-telescope/telescope-ui-select.nvim' },
  249. -- Useful for getting pretty icons, but requires a Nerd Font.
  250. { 'nvim-tree/nvim-web-devicons', enabled = vim.g.have_nerd_font },
  251. },
  252. config = function()
  253. require('telescope').setup {
  254. extensions = {
  255. ['ui-select'] = {
  256. require('telescope.themes').get_dropdown(),
  257. },
  258. },
  259. }
  260. -- Enable Telescope extensions if they are installed
  261. pcall(require('telescope').load_extension, 'fzf')
  262. pcall(require('telescope').load_extension, 'ui-select')
  263. -- See `:help telescope.builtin`
  264. local builtin = require 'telescope.builtin'
  265. vim.keymap.set('n', '<leader>sh', builtin.help_tags, { desc = '[S]earch [H]elp' })
  266. vim.keymap.set('n', '<leader>sk', builtin.keymaps, { desc = '[S]earch [K]eymaps' })
  267. vim.keymap.set('n', '<leader>sf', builtin.find_files, { desc = '[S]earch [F]iles' })
  268. vim.keymap.set('n', '<leader>ss', builtin.builtin, { desc = '[S]earch [S]elect Telescope' })
  269. vim.keymap.set('n', '<leader>sw', builtin.grep_string, { desc = '[S]earch current [W]ord' })
  270. vim.keymap.set('n', '<leader>sg', builtin.live_grep, { desc = '[S]earch by [G]rep' })
  271. vim.keymap.set('n', '<leader>sd', builtin.diagnostics, { desc = '[S]earch [D]iagnostics' })
  272. vim.keymap.set('n', '<leader>sr', builtin.resume, { desc = '[S]earch [R]esume' })
  273. vim.keymap.set('n', '<leader>s.', builtin.oldfiles, { desc = '[S]earch Recent Files ("." for repeat)' })
  274. vim.keymap.set('n', '<leader><leader>', builtin.buffers, { desc = '[ ] Find existing buffers' })
  275. -- Slightly advanced example of overriding default behavior and theme
  276. vim.keymap.set('n', '<leader>/', function()
  277. -- You can pass additional configuration to Telescope to change the theme, layout, etc.
  278. builtin.current_buffer_fuzzy_find(require('telescope.themes').get_dropdown {
  279. winblend = 10,
  280. previewer = false,
  281. })
  282. end, { desc = '[/] Fuzzily search in current buffer' })
  283. -- It's also possible to pass additional configuration options.
  284. -- See `:help telescope.builtin.live_grep()` for information about particular keys
  285. vim.keymap.set('n', '<leader>s/', function()
  286. builtin.live_grep {
  287. grep_open_files = true,
  288. prompt_title = 'Live Grep in Open Files',
  289. }
  290. end, { desc = '[S]earch [/] in Open Files' })
  291. -- Shortcut for searching your Neovim configuration files
  292. vim.keymap.set('n', '<leader>sn', function()
  293. builtin.find_files { cwd = vim.fn.stdpath 'config' }
  294. end, { desc = '[S]earch [N]eovim files' })
  295. end,
  296. },
  297. -- LSP Plugins
  298. {
  299. -- `lazydev` configures Lua LSP for your Neovim config, runtime and plugins
  300. -- used for completion, annotations and signatures of Neovim apis
  301. 'folke/lazydev.nvim',
  302. ft = 'lua',
  303. opts = {
  304. library = {
  305. -- Load luvit types when the `vim.uv` word is found
  306. { path = '${3rd}/luv/library', words = { 'vim%.uv' } },
  307. },
  308. },
  309. },
  310. { -- Autoformat
  311. 'stevearc/conform.nvim',
  312. event = { 'BufWritePre' },
  313. cmd = { 'ConformInfo' },
  314. keys = {
  315. {
  316. '<leader>f',
  317. function()
  318. require('conform').format { async = true, lsp_format = 'fallback' }
  319. end,
  320. mode = '',
  321. desc = '[F]ormat buffer',
  322. },
  323. },
  324. opts = {
  325. notify_on_error = false,
  326. format_on_save = function(_)
  327. -- edited by me: disable format on safe. <leader>f is good enough for
  328. -- when i want to format.
  329. return nil
  330. -- Disable "format_on_save lsp_fallback" for languages that don't
  331. -- have a well standardized coding style. You can add additional
  332. -- languages here or re-enable it for the disabled ones.
  333. -- local disable_filetypes = { c = true, cpp = true }
  334. -- if disable_filetypes[vim.bo[bufnr].filetype] then
  335. -- return nil
  336. -- else
  337. -- return {
  338. -- timeout_ms = 500,
  339. -- lsp_format = 'fallback',
  340. -- }
  341. -- end
  342. end,
  343. formatters_by_ft = {
  344. lua = { 'stylua' },
  345. -- Conform can also run multiple formatters sequentially
  346. -- python = { "isort", "black" },
  347. --
  348. -- You can use 'stop_after_first' to run the first available formatter from the list
  349. -- javascript = { "prettierd", "prettier", stop_after_first = true },
  350. },
  351. },
  352. },
  353. { -- Autocompletion
  354. 'saghen/blink.cmp',
  355. event = 'VimEnter',
  356. version = '1.*',
  357. dependencies = {
  358. -- Snippet Engine
  359. {
  360. 'L3MON4D3/LuaSnip',
  361. version = '2.*',
  362. build = (function()
  363. -- Build Step is needed for regex support in snippets.
  364. -- This step is not supported in many windows environments.
  365. -- Remove the below condition to re-enable on windows.
  366. if vim.fn.has 'win32' == 1 or vim.fn.executable 'make' == 0 then
  367. return
  368. end
  369. return 'make install_jsregexp'
  370. end)(),
  371. dependencies = {
  372. -- `friendly-snippets` contains a variety of premade snippets.
  373. -- See the README about individual language/framework/plugin snippets:
  374. -- https://github.com/rafamadriz/friendly-snippets
  375. -- {
  376. -- 'rafamadriz/friendly-snippets',
  377. -- config = function()
  378. -- require('luasnip.loaders.from_vscode').lazy_load()
  379. -- end,
  380. -- },
  381. },
  382. opts = {},
  383. config = function()
  384. require('luasnip.loaders.from_lua').load { paths = '~/.config/kickstart-nvim/snippets/lua/' }
  385. end,
  386. },
  387. 'folke/lazydev.nvim',
  388. },
  389. --- @module 'blink.cmp'
  390. --- @type blink.cmp.Config
  391. opts = {
  392. keymap = {
  393. -- 'default' (recommended) for mappings similar to built-in completions
  394. -- <c-y> to accept ([y]es) the completion.
  395. -- This will auto-import if your LSP supports it.
  396. -- This will expand snippets if the LSP sent a snippet.
  397. -- 'super-tab' for tab to accept
  398. -- 'enter' for enter to accept
  399. -- 'none' for no mappings
  400. --
  401. -- For an understanding of why the 'default' preset is recommended,
  402. -- you will need to read `:help ins-completion`
  403. --
  404. -- No, but seriously. Please read `:help ins-completion`, it is really good!
  405. --
  406. -- All presets have the following mappings:
  407. -- <tab>/<s-tab>: move to right/left of your snippet expansion
  408. -- <c-space>: Open menu or open docs if already open
  409. -- <c-n>/<c-p> or <up>/<down>: Select next/previous item
  410. -- <c-e>: Hide menu
  411. -- <c-k>: Toggle signature help
  412. --
  413. -- See :h blink-cmp-config-keymap for defining your own keymap
  414. preset = 'default',
  415. -- For more advanced Luasnip keymaps (e.g. selecting choice nodes, expansion) see:
  416. -- https://github.com/L3MON4D3/LuaSnip?tab=readme-ov-file#keymaps
  417. },
  418. appearance = {
  419. -- 'mono' (default) for 'Nerd Font Mono' or 'normal' for 'Nerd Font'
  420. -- Adjusts spacing to ensure icons are aligned
  421. nerd_font_variant = 'mono',
  422. },
  423. completion = {
  424. -- By default, you may press `<c-space>` to show the documentation.
  425. -- Optionally, set `auto_show = true` to show the documentation after a delay.
  426. documentation = { auto_show = false, auto_show_delay_ms = 500 },
  427. },
  428. sources = {
  429. default = { 'lsp', 'path', 'snippets', 'lazydev' },
  430. providers = {
  431. lazydev = { module = 'lazydev.integrations.blink', score_offset = 100 },
  432. },
  433. },
  434. snippets = { preset = 'luasnip' },
  435. -- Blink.cmp includes an optional, recommended rust fuzzy matcher,
  436. -- which automatically downloads a prebuilt binary when enabled.
  437. --
  438. -- By default, we use the Lua implementation instead, but you may enable
  439. -- the rust implementation via `'prefer_rust_with_warning'`
  440. --
  441. -- See :h blink-cmp-config-fuzzy for more information
  442. fuzzy = { implementation = 'lua' },
  443. -- Shows a signature help window while you type arguments for a function
  444. signature = { enabled = true },
  445. },
  446. },
  447. --- THEMES FOR NEOVIM
  448. {
  449. 'miikanissi/modus-themes.nvim',
  450. priority = 1000,
  451. opts = {
  452. variants = {
  453. modus_vivendi = 'default',
  454. },
  455. line_nr_column_background = false,
  456. sign_column_background = true,
  457. on_colors = function(color)
  458. color.bg_active = color.bg_dim
  459. end,
  460. },
  461. },
  462. {
  463. 'folke/tokyonight.nvim',
  464. priority = 1000, -- Make sure to load this before all the other start plugins.
  465. config = function()
  466. ---@diagnostic disable-next-line: missing-fields
  467. require('tokyonight').setup {
  468. styles = {
  469. comments = { italic = false }, -- Disable italics in comments
  470. },
  471. }
  472. end,
  473. },
  474. {
  475. 'Yazeed1s/oh-lucy.nvim',
  476. priority = 1000,
  477. },
  478. {
  479. 'embark-theme/vim',
  480. lazy = false,
  481. priority = 1000,
  482. name = 'embark',
  483. },
  484. -- Highlight todo, notes, etc in comments
  485. { 'folke/todo-comments.nvim', event = 'VimEnter', dependencies = { 'nvim-lua/plenary.nvim' }, opts = { signs = false } },
  486. { -- Collection of various small independent plugins/modules
  487. 'nvim-mini/mini.nvim',
  488. config = function()
  489. -- Better Around/Inside textobjects
  490. --
  491. -- Examples:
  492. -- - va) - [V]isually select [A]round [)]paren
  493. -- - yinq - [Y]ank [I]nside [N]ext [Q]uote
  494. -- - ci' - [C]hange [I]nside [']quote
  495. -- require('mini.ai').setup { n_lines = 500 }
  496. -- Add/delete/replace surroundings (brackets, quotes, etc.)
  497. --
  498. -- - saiw) - [S]urround [A]dd [I]nner [W]ord [)]Paren
  499. -- - sd' - [S]urround [D]elete [']quotes
  500. -- - sr)' - [S]urround [R]eplace [)] [']
  501. require('mini.surround').setup {
  502. custom_surroundings = {
  503. ['m'] = {
  504. input = function()
  505. local tagname = MiniSurround.user_input 'name of html tag'
  506. return { '^.()<' .. tagname .. '>().*()</' .. tagname .. '>().$' }
  507. end,
  508. output = function()
  509. local tagname = MiniSurround.user_input 'name of html tag'
  510. return { left = '<' .. tagname .. '>', right = '</' .. tagname .. '>' }
  511. end,
  512. },
  513. },
  514. }
  515. -- Simple and easy statusline.
  516. -- You could remove this setup call if you don't like it,
  517. -- and try some other statusline plugin
  518. local statusline = require 'mini.statusline'
  519. -- set use_icons to true if you have a Nerd Font
  520. statusline.setup { use_icons = vim.g.have_nerd_font }
  521. -- You can configure sections in the statusline by overriding their
  522. -- default behavior. For example, here we set the section for
  523. -- cursor location to LINE:COLUMN
  524. ---@diagnostic disable-next-line: duplicate-set-field
  525. statusline.section_location = function()
  526. return '%2l:%-2v'
  527. end
  528. -- -- ... and there is more!
  529. -- -- Check out: https://github.com/nvim-mini/mini.nvim
  530. -- local animate = require 'mini.animate'
  531. -- animate.setup()
  532. end,
  533. },
  534. { -- Highlight, edit, and navigate code
  535. 'nvim-treesitter/nvim-treesitter',
  536. branch = 'main',
  537. build = ':TSUpdate',
  538. dependencies = {},
  539. main = 'nvim-treesitter.config', -- Sets main module to use for opts
  540. -- [[ Configure Treesitter ]] See `:help nvim-treesitter`
  541. opts = {
  542. ensure_installed = {
  543. 'bash',
  544. 'c',
  545. 'diff',
  546. 'html',
  547. 'lua',
  548. 'luadoc',
  549. 'markdown',
  550. 'markdown_inline',
  551. 'query',
  552. 'vim',
  553. 'vimdoc',
  554. },
  555. -- Autoinstall languages that are not installed
  556. auto_install = true,
  557. highlight = {
  558. enable = true,
  559. -- Some languages depend on vim's regex highlighting system (such as Ruby) for indent rules.
  560. -- If you are experiencing weird indenting issues, add the language to
  561. -- the list of additional_vim_regex_highlighting and disabled languages for indent.
  562. additional_vim_regex_highlighting = { 'ruby' },
  563. },
  564. indent = { enable = true, disable = { 'ruby' } },
  565. },
  566. -- There are additional nvim-treesitter modules that you can use to interact
  567. -- with nvim-treesitter. You should go explore a few and see what interests you:
  568. --
  569. -- - Incremental selection: Included, see `:help nvim-treesitter-incremental-selection-mod`
  570. -- - Show your current context: https://github.com/nvim-treesitter/nvim-treesitter-context
  571. -- - Treesitter + textobjects: https://github.com/nvim-treesitter/nvim-treesitter-textobjects
  572. },
  573. -- The following comments only work if you have downloaded the kickstart repo, not just copy pasted the
  574. -- init.lua. If you want these files, they are in the repository, so you can just download them and
  575. -- place them in the correct locations.
  576. -- NOTE: Next step on your Neovim journey: Add/Configure additional plugins for Kickstart
  577. --
  578. -- Here are some example plugins that I've included in the Kickstart repository.
  579. -- Uncomment any of the lines below to enable them (you will need to restart nvim).
  580. --
  581. -- require 'kickstart.plugins.debug',
  582. require 'kickstart.plugins.indent_line',
  583. require 'kickstart.plugins.lint',
  584. -- require 'kickstart.plugins.neo-tree',
  585. -- require 'kickstart.plugins.gitsigns', -- adds gitsigns recommend keymaps
  586. -- NOTE: The import below can automatically add your own plugins, configuration, etc from `lua/custom/plugins/*.lua`
  587. -- This is the easiest way to modularize your config.
  588. --
  589. -- Uncomment the following line and add your plugins to `lua/custom/plugins/*.lua` to get going.
  590. { import = 'custom.plugins' },
  591. --
  592. -- For additional information with loading, sourcing and examples see `:help lazy.nvim-🔌-plugin-spec`
  593. -- Or use telescope!
  594. -- In normal mode type `<space>sh` then write `lazy.nvim-plugin`
  595. -- you can continue same window with `<space>sr` which resumes last telescope search
  596. }, {
  597. ui = {
  598. -- If you are using a Nerd Font: set icons to an empty table which will use the
  599. -- default lazy.nvim defined Nerd Font icons, otherwise define a unicode icons table
  600. icons = vim.g.have_nerd_font and {} or {
  601. cmd = '⌘',
  602. config = '🛠',
  603. event = '📅',
  604. ft = '📂',
  605. init = '⚙',
  606. keys = '🗝',
  607. plugin = '🔌',
  608. runtime = '💻',
  609. require = '🌙',
  610. source = '📄',
  611. start = '🚀',
  612. task = '📌',
  613. lazy = '💤 ',
  614. },
  615. },
  616. })
  617. -- Custom settings that require plugins
  618. vim.cmd 'colorscheme modus_vivendi'
  619. -- The line beneath this is called `modeline`. See `:help modeline`
  620. -- vim: ts=2 sts=2 sw=2 et