init.lua 23 KB

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