From 63e5f7b0742409069fef610f80457f8140ccd008 Mon Sep 17 00:00:00 2001 From: tsegaye27 Date: Sat, 8 Feb 2025 10:16:31 +0300 Subject: [PATCH] made some changes --- init.lua | 255 +++++++++++----------- lazy-lock.json | 14 +- lua/keymaps.lua | 7 + lua/plugins.lua | 540 ----------------------------------------------- lua/settings.lua | 33 ++- 5 files changed, 171 insertions(+), 678 deletions(-) delete mode 100644 lua/plugins.lua diff --git a/init.lua b/init.lua index 4592a62e..17062b11 100644 --- a/init.lua +++ b/init.lua @@ -1,10 +1,10 @@ vim.g.mapleader = ' ' vim.g.maplocalleader = ' ' -require('settings') -require('keymaps') +require 'settings' +require 'keymaps' -local lazypath = vim.fn.stdpath('data') .. '/lazy/lazy.nvim' +local lazypath = vim.fn.stdpath 'data' .. '/lazy/lazy.nvim' if not (vim.uv or vim.loop).fs_stat(lazypath) then local lazyrepo = 'https://github.com/folke/lazy.nvim.git' local out = vim.fn.system { 'git', 'clone', '--filter=blob:none', '--branch=stable', lazyrepo, lazypath } @@ -14,23 +14,24 @@ if not (vim.uv or vim.loop).fs_stat(lazypath) then end vim.opt.rtp:prepend(lazypath) -require('lazy').setup({ - { - 'tpope/vim-sleuth', -- Automatically set the 'shiftwidth' and 'expandtab' options based on the current file +require('lazy').setup { + ------------------------------------------------------------------------------ + -- 1. Basic Plugins & Utilities + ------------------------------------------------------------------------------ + { -- Automatically adjust shiftwidth and expandtab + 'tpope/vim-sleuth', }, - { - 'lewis6991/gitsigns.nvim', -- Git signs in the sign column - opts = { - signs = { - add = { text = '+' }, - change = { text = '' }, - delete = { text = '_' }, - topdelete = { text = '‾' }, - changedelete = { text = '' }, - }, - }, + + { -- Gitsigns: Display Git changes and blame + 'lewis6991/gitsigns.nvim', + config = function() + require('gitsigns').setup { + current_line_blame = true, + } + end, }, - { + + { -- Which-key: Shows available keybindings 'folke/which-key.nvim', event = 'VimEnter', opts = { @@ -68,23 +69,29 @@ require('lazy').setup({ F12 = '', }, }, - spec = { - { 'c', group = '[C]ode', mode = { 'n', 'x' } }, - { 'd', group = '[D]ocument' }, - { 'r', group = '[R]ename' }, - { 's', group = '[S]earch' }, - { 'w', group = '[W]orkspace' }, - { 't', group = '[T]oggle' }, - { 'h', group = 'Git [H]unk', mode = { 'n', 'v' } }, - }, + spec = { + { 'c', group = '[C]ode', mode = { 'n', 'x' } }, + { 'd', group = '[D]ocument' }, + { 'r', group = '[R]ename' }, + { 's', group = '[S]earch' }, + { 'w', group = '[W]orkspace' }, + { 't', group = '[T]oggle' }, + { 'h', group = 'Git [H]unk', mode = { 'n', 'v' } }, + }, }, }, - { + + { -- Nvim-tree: File explorer with keybinding 'nvim-tree/nvim-tree.lua', event = 'VimEnter', config = function() require('nvim-tree').setup { + filters = { + dotfiles = false, -- Keep this false to show dotfiles, or true to hide all dotfiles + custom = { '^.git$' }, -- Hide .git folder + }, renderer = { + root_folder_label = false, -- Remove the `~` indicator at the top icons = { glyphs = { default = '', @@ -114,27 +121,67 @@ require('lazy').setup({ vim.keymap.set('n', 'e', 'NvimTreeToggle', { desc = 'Toggle File Explorer' }) end, }, - { - 'wakatime/vim-wakatime', - }, - { - 'github/copilot.vim', - }, - { + + { 'wakatime/vim-wakatime' }, + { 'github/copilot.vim' }, + + ------------------------------------------------------------------------------ + -- 2. Formatting & Linting + ------------------------------------------------------------------------------ + { -- null-ls: Integrates external formatters and linters 'jose-elias-alvarez/null-ls.nvim', dependencies = { 'nvim-lua/plenary.nvim' }, config = function() local null_ls = require 'null-ls' - null_ls.setup { + null_ls.setup { sources = { - null_ls.builtins.formatting.prettier, + null_ls.builtins.formatting.stylua, -- Stylua for Lua formatting (ensure it's installed in your PATH) + null_ls.builtins.formatting.prettier, -- Prettier for HTML, JavaScript, etc. null_ls.builtins.diagnostics.eslint, null_ls.builtins.code_actions.eslint, }, } end, }, - { + + { -- Conform: Format on save using external formatters + 'stevearc/conform.nvim', + event = { 'BufWritePre' }, + cmd = { 'ConformInfo' }, + keys = { + { + 'f', + function() + require('conform').format { async = true, lsp_format = 'fallback' } + end, + mode = '', + desc = '[F]ormat buffer', + }, + }, + opts = { + notify_on_error = false, + format_on_save = function(bufnr) + local disable_filetypes = { c = true, cpp = true } + return { + timeout_ms = 500, + lsp_format = disable_filetypes[vim.bo[bufnr].filetype] and 'never' or 'fallback', + } + end, + formatters_by_ft = { + lua = { 'stylua' }, -- Use stylua for Lua + javascript = { 'prettier' }, + typescript = { 'prettier' }, + css = { 'prettier' }, + scss = { 'prettier' }, + html = { 'prettier' }, -- Use prettier for HTML + }, + }, + }, + + ------------------------------------------------------------------------------ + -- 3. Statusline, Debugging, & Miscellaneous Utilities + ------------------------------------------------------------------------------ + { -- Lualine: Statusline 'nvim-lualine/lualine.nvim', dependencies = { 'nvim-tree/nvim-web-devicons' }, config = function() @@ -155,24 +202,16 @@ require('lazy').setup({ } end, }, - { - 'lewis6991/gitsigns.nvim', - config = function() - require('gitsigns').setup { - current_line_blame = true, - } - end, - }, - { + + { -- nvim-dap: Debug Adapter Protocol for debugging JavaScript 'mfussenegger/nvim-dap', config = function() local dap = require 'dap' - dap.adapters.node2 = { + dap.adapters.node2 = { type = 'executable', command = 'node', args = { os.getenv 'HOME' .. '/.local/share/nvim/mason/packages/node-debug2-adapter/out/src/nodeDebug.js' }, } - dap.configurations.javascript = { { name = 'Launch Node.js', @@ -188,14 +227,14 @@ require('lazy').setup({ end, }, - { + { -- Comment.nvim: Easily comment code 'numToStr/Comment.nvim', config = function() require('Comment').setup() end, }, - { + { -- nvim-autopairs: Automatically complete pairs 'windwp/nvim-autopairs', event = 'InsertEnter', config = function() @@ -203,20 +242,21 @@ require('lazy').setup({ end, }, - { + { -- Spectre: Search and replace tool 'nvim-pack/nvim-spectre', dependencies = { 'nvim-lua/plenary.nvim' }, config = function() require('spectre').setup() end, }, - { + + { -- Telescope: Fuzzy finder and more 'nvim-telescope/telescope.nvim', event = 'VimEnter', branch = '0.1.x', dependencies = { 'nvim-lua/plenary.nvim', - { -- If encountering errors, see telescope-fzf-native README for installation instructions + { 'nvim-telescope/telescope-fzf-native.nvim', build = 'make', cond = function() @@ -234,9 +274,8 @@ require('lazy').setup({ }, }, } - pcall(require('telescope').load_extension, 'fzf') + pcall(require('telescope').load_extension, 'fzf') pcall(require('telescope').load_extension, 'ui-select') - local builtin = require 'telescope.builtin' vim.keymap.set('n', 'sh', builtin.help_tags, { desc = '[S]earch [H]elp' }) vim.keymap.set('n', 'sk', builtin.keymaps, { desc = '[S]earch [K]eymaps' }) @@ -248,28 +287,25 @@ require('lazy').setup({ vim.keymap.set('n', 'sr', builtin.resume, { desc = '[S]earch [R]esume' }) vim.keymap.set('n', 's.', builtin.oldfiles, { desc = '[S]earch Recent Files ("." for repeat)' }) vim.keymap.set('n', '', builtin.buffers, { desc = '[ ] Find existing buffers' }) - vim.keymap.set('n', '/', function() builtin.current_buffer_fuzzy_find(require('telescope.themes').get_dropdown { winblend = 10, previewer = false, }) end, { desc = '[/] Fuzzily search in current buffer' }) - vim.keymap.set('n', 's/', function() builtin.live_grep { grep_open_files = true, prompt_title = 'Live Grep in Open Files', } end, { desc = '[S]earch [/] in Open Files' }) - vim.keymap.set('n', 'sn', function() builtin.find_files { cwd = vim.fn.stdpath 'config' } end, { desc = '[S]earch [N]eovim files' }) end, }, - { + { -- Lazydev: For developing local Lua plugins with lazy.nvim 'folke/lazydev.nvim', ft = 'lua', opts = { @@ -278,10 +314,14 @@ require('lazy').setup({ }, }, }, + + ------------------------------------------------------------------------------ + -- 4. LSP & Autocompletion Configuration + ------------------------------------------------------------------------------ { 'neovim/nvim-lspconfig', dependencies = { - { 'williamboman/mason.nvim', opts = {} }, + { 'williamboman/mason.nvim', opts = { ensure_installed = { 'prettier', 'stylua', 'eslint', 'eslint_d' } } }, 'williamboman/mason-lspconfig.nvim', 'WhoIsSethDaniel/mason-tool-installer.nvim', { 'j-hui/fidget.nvim', opts = {} }, @@ -289,13 +329,13 @@ require('lazy').setup({ }, config = function() require('mason').setup() + -- Added 'html' to the list of LSP servers for HTML intellisense. require('mason-lspconfig').setup { - ensure_installed = { 'ts_ls', 'tailwindcss', 'cssls', 'lua_ls' }, + ensure_installed = { 'ts_ls', 'tailwindcss', 'cssls', 'lua_ls', 'html' }, automatic_installation = true, } local capabilities = vim.lsp.protocol.make_client_capabilities() capabilities = vim.tbl_deep_extend('force', capabilities, require('cmp_nvim_lsp').default_capabilities()) - if vim.g.have_nerd_font then local signs = { ERROR = '', WARN = '', INFO = '', HINT = '' } for type, icon in pairs(signs) do @@ -303,16 +343,13 @@ require('lazy').setup({ vim.fn.sign_define(hl, { text = icon, texthl = hl, numhl = '' }) end end - local servers = { ts_ls = { on_attach = function(client, bufnr) client.server_capabilities.documentFormattingProvider = false - local map = function(keys, func, desc) vim.keymap.set('n', keys, func, { buffer = bufnr, desc = 'LSP: ' .. desc }) end - vim.api.nvim_create_autocmd('BufWritePre', { buffer = bufnr, callback = function() @@ -322,7 +359,6 @@ require('lazy').setup({ } end, }) - map('oi', function() vim.lsp.buf.code_action { context = { only = { 'source.organizeImports' }, diagnostics = {} }, @@ -352,11 +388,10 @@ require('lazy').setup({ }, }, }, + html = {}, -- HTML LSP for intellisense } - local ensure_installed = vim.tbl_keys(servers) require('mason-tool-installer').setup { ensure_installed = ensure_installed } - require('mason-lspconfig').setup { ensure_installed = ensure_installed, automatic_installation = true, @@ -370,40 +405,8 @@ require('lazy').setup({ } end, }, - { - 'stevearc/conform.nvim', - event = { 'BufWritePre' }, - cmd = { 'ConformInfo' }, - keys = { - { - 'f', - function() - require('conform').format { async = true, lsp_format = 'fallback' } - end, - mode = '', - desc = '[F]ormat buffer', - }, - }, - opts = { - notify_on_error = false, - format_on_save = function(bufnr) - local disable_filetypes = { c = true, cpp = true } - return { - timeout_ms = 500, - lsp_format = disable_filetypes[vim.bo[bufnr].filetype] and 'never' or 'fallback', - } - end, - formatters_by_ft = { - lua = { 'stylua' }, - javascript = { 'prettier' }, - typescript = { 'prettier' }, - css = { 'prettier' }, - scss = { 'prettier' }, - html = { 'prettier' }, - }, - }, - }, - { + + { -- nvim-cmp: Autocompletion engine configuration 'hrsh7th/nvim-cmp', event = 'InsertEnter', dependencies = { @@ -426,14 +429,13 @@ require('lazy').setup({ local cmp = require 'cmp' local luasnip = require 'luasnip' luasnip.config.setup {} - cmp.setup { + cmp.setup { snippet = { expand = function(args) luasnip.lsp_expand(args.body) end, }, completion = { completeopt = 'menu,menuone,noinsert' }, - mapping = cmp.mapping.preset.insert { [''] = cmp.mapping.select_next_item(), [''] = cmp.mapping.select_prev_item(), @@ -452,7 +454,6 @@ require('lazy').setup({ end end, { 'i', 's' }), }, - sources = cmp.config.sources { { name = 'lazydev', group_index = 0 }, { name = 'nvim_lsp' }, @@ -463,47 +464,45 @@ require('lazy').setup({ } end, }, - { -- 🎨 Colorscheme + + ------------------------------------------------------------------------------ + -- 5. Look & Feel: Colorscheme, Todo Comments, and Mini Plugins + ------------------------------------------------------------------------------ + { -- Colorscheme: Tokyonight with custom settings 'folke/tokyonight.nvim', priority = 1000, init = function() - -- Load colorscheme with specific style vim.cmd.colorscheme 'tokyonight-night' - -- Customize Comment color (removes italic) vim.cmd.hi 'Comment gui=none' end, }, - -- ✅ Highlight TODOs, FIXMEs, and other comments - { + + { -- Todo-comments: Highlight TODOs and FIXMEs 'folke/todo-comments.nvim', event = 'VimEnter', dependencies = { 'nvim-lua/plenary.nvim' }, opts = { signs = false }, }, - { -- 🛠️ mini.nvim utility plugins (better text objects, surround, and statusline) + + { -- mini.nvim: Additional utilities (text objects, surround, statusline) 'echasnovski/mini.nvim', config = function() - -- Setup mini.ai for better text objects - require('mini.ai').setup { - n_lines = 500, - } - -- Setup mini.surround for surrounding text objects + require('mini.ai').setup { n_lines = 500 } require('mini.surround').setup() - - -- Setup mini.statusline for a better status line require('mini.statusline').setup { use_icons = vim.g.have_nerd_font, content = { active = function() - return '%2l:%-2v' -- line:column display + return '%2l:%-2v' end, }, } end, }, - { + + { -- Treesitter: Improved syntax highlighting and more 'nvim-treesitter/nvim-treesitter', - build = ':tsupdate', + build = ':TSUpdate', main = 'nvim-treesitter.configs', opts = { ensure_installed = { @@ -525,13 +524,15 @@ require('lazy').setup({ 'vimdoc', }, auto_install = true, - highlight = { - enable = true, - additional_vim_regex_highlighting = { 'ruby' }, - }, + highlight = { enable = true, additional_vim_regex_highlighting = { 'ruby' } }, indent = { enable = true, disable = { 'ruby' } }, + fold = { enable = true }, -- Enable Treesitter-based folding }, }, + + ------------------------------------------------------------------------------ + -- 6. UI Extras + ------------------------------------------------------------------------------ ui = { icons = vim.g.have_nerd_font and {} or { cmd = '⌘', @@ -549,4 +550,4 @@ require('lazy').setup({ lazy = '💤 ', }, }, -}) +} diff --git a/lazy-lock.json b/lazy-lock.json index ce97998d..d9f2624c 100644 --- a/lazy-lock.json +++ b/lazy-lock.json @@ -8,23 +8,23 @@ "cmp_luasnip": { "branch": "master", "commit": "98d9cb5c2c38532bd9bdb481067b20fea8f32e90" }, "conform.nvim": { "branch": "master", "commit": "363243c03102a531a8203311d4f2ae704c620d9b" }, "copilot.vim": { "branch": "release", "commit": "87038123804796ca7af20d1b71c3428d858a9124" }, - "fidget.nvim": { "branch": "main", "commit": "3fa10de61546fd0a98faac3084a6c0db612adaf8" }, - "gitsigns.nvim": { "branch": "main", "commit": "9772ce68a9a6d156f3f2166bfd0a17a09ab37eba" }, - "lazy.nvim": { "branch": "main", "commit": "7527af40ddd4a93a02911be570b32609b9d4ea53" }, + "fidget.nvim": { "branch": "main", "commit": "d9ba6b7bfe29b3119a610892af67602641da778e" }, + "gitsigns.nvim": { "branch": "main", "commit": "c23bbd3ed2c7a3fdc3399e97e24f9e158f57612f" }, + "lazy.nvim": { "branch": "main", "commit": "f15a93907ddad3d9139aea465ae18336d87f5ce6" }, "lazydev.nvim": { "branch": "main", "commit": "a1b78b2ac6f978c72e76ea90ae92a94edf380cfc" }, "lualine.nvim": { "branch": "master", "commit": "2a5bae925481f999263d6f5ed8361baef8df4f83" }, "mason-lspconfig.nvim": { "branch": "main", "commit": "f75e877f5266e87523eb5a18fcde2081820d087b" }, "mason-tool-installer.nvim": { "branch": "main", "commit": "374c78d3ebb5c53f43ea6bd906b6587b5e899b9e" }, "mason.nvim": { "branch": "main", "commit": "e2f7f9044ec30067bc11800a9e266664b88cda22" }, - "mini.nvim": { "branch": "main", "commit": "87fc38a8a2b8d498cecb021d057a38ea2e9f5a79" }, + "mini.nvim": { "branch": "main", "commit": "d479cf109eeff8a7e0bf978079ea1dd2171648a0" }, "null-ls.nvim": { "branch": "main", "commit": "0010ea927ab7c09ef0ce9bf28c2b573fc302f5a7" }, "nvim-autopairs": { "branch": "master", "commit": "3d02855468f94bf435db41b661b58ec4f48a06b7" }, "nvim-cmp": { "branch": "main", "commit": "12509903a5723a876abd65953109f926f4634c30" }, - "nvim-dap": { "branch": "master", "commit": "12b846bedbc7221e833b5e6611de21917d7d9184" }, - "nvim-lspconfig": { "branch": "master", "commit": "66bc018936c6ff76beb75f89d986af6442db4001" }, + "nvim-dap": { "branch": "master", "commit": "52302f02fea3a490e55475de52fa4deb8af2eb11" }, + "nvim-lspconfig": { "branch": "master", "commit": "75edb91a3d2deabe76a9911cde2c13d411b3b097" }, "nvim-spectre": { "branch": "master", "commit": "ddd7383e856a7c939cb4f5143278fe041bbb8cb9" }, "nvim-tree.lua": { "branch": "master", "commit": "70825f23db61ecd900c4cfea169bffe931926a9d" }, - "nvim-treesitter": { "branch": "master", "commit": "9e0b5e7f0d148963d6ec71c48cec1a3f8607d619" }, + "nvim-treesitter": { "branch": "master", "commit": "62911c78a868bac24c8a86f2c1c412d0b799f885" }, "nvim-web-devicons": { "branch": "master", "commit": "402377242b04be3f4f0f3720bd952df86e946c30" }, "plenary.nvim": { "branch": "master", "commit": "3707cdb1e43f5cea73afb6037e6494e7ce847a66" }, "telescope-fzf-native.nvim": { "branch": "main", "commit": "dae2eac9d91464448b584c7949a31df8faefec56" }, diff --git a/lua/keymaps.lua b/lua/keymaps.lua index 3ebdf2e5..82724bd0 100644 --- a/lua/keymaps.lua +++ b/lua/keymaps.lua @@ -21,3 +21,10 @@ vim.api.nvim_create_autocmd('TextYankPost', { vim.highlight.on_yank() end, }) + +-- Keybindings for folding +vim.keymap.set('n', 'zc', 'zc', { desc = 'Close fold' }) -- Collapse current fold +vim.keymap.set('n', 'zo', 'zo', { desc = 'Open fold' }) -- Open current fold +vim.keymap.set('n', 'za', 'za', { desc = 'Toggle fold' }) -- Toggle fold open/close +vim.keymap.set('n', 'zR', 'zR', { desc = 'Open all folds' }) -- Open all folds +vim.keymap.set('n', 'zM', 'zM', { desc = 'Close all folds' }) -- Close all folds diff --git a/lua/plugins.lua b/lua/plugins.lua deleted file mode 100644 index 50530e0a..00000000 --- a/lua/plugins.lua +++ /dev/null @@ -1,540 +0,0 @@ --- local M = {} --- --- M.spec = { --- { --- 'tpope/vim-sleuth', -- Automatically set the 'shiftwidth' and 'expandtab' options based on the current file --- }, --- { --- 'lewis6991/gitsigns.nvim', -- Git signs in the sign column --- opts = { --- signs = { --- add = { text = '+' }, --- change = { text = '' }, --- delete = { text = '_' }, --- topdelete = { text = '‾' }, --- changedelete = { text = '' }, --- }, --- }, --- }, --- { --- 'folke/which-key.nvim', --- event = 'VimEnter', --- opts = { --- delay = 0, --- icons = { --- mappings = vim.g.have_nerd_font, --- keys = vim.g.have_nerd_font and {} or { --- Up = ' ', --- Down = ' ', --- Left = ' ', --- Right = ' ', --- C = ' ', --- M = ' ', --- D = ' ', --- S = ' ', --- CR = ' ', --- Esc = ' ', --- ScrollWheelDown = ' ', --- ScrollWheelUp = ' ', --- NL = ' ', --- BS = ' ', --- Space = ' ', --- Tab = ' ', --- F1 = '', --- F2 = '', --- F3 = '', --- F4 = '', --- F5 = '', --- F6 = '', --- F7 = '', --- F8 = '', --- F9 = '', --- F10 = '', --- F11 = '', --- F12 = '', --- }, --- }, --- spec = { --- { 'c', group = '[C]ode', mode = { 'n', 'x' } }, --- { 'd', group = '[D]ocument' }, --- { 'r', group = '[R]ename' }, --- { 's', group = '[S]earch' }, --- { 'w', group = '[W]orkspace' }, --- { 't', group = '[T]oggle' }, --- { 'h', group = 'Git [H]unk', mode = { 'n', 'v' } }, --- }, --- }, --- }, --- { --- 'nvim-tree/nvim-tree.lua', --- event = 'VimEnter', --- config = function() --- require('nvim-tree').setup { --- renderer = { --- icons = { --- glyphs = { --- default = '', --- symlink = '', --- folder = { --- arrow_open = '', --- arrow_closed = '', --- default = '', --- open = '', --- empty = '', --- empty_open = '', --- symlink = '', --- }, --- git = { --- unstaged = '✗', --- staged = '✓', --- unmerged = '', --- renamed = '➜', --- untracked = '★', --- deleted = '', --- ignored = '◌', --- }, --- }, --- }, --- }, --- } --- vim.keymap.set('n', 'e', 'NvimTreeToggle', { desc = 'Toggle File Explorer' }) --- end, --- }, --- { --- 'wakatime/vim-wakatime', --- }, --- { --- 'github/copilot.vim', --- }, --- { --- 'jose-elias-alvarez/null-ls.nvim', --- dependencies = { 'nvim-lua/plenary.nvim' }, --- config = function() --- local null_ls = require 'null-ls' --- null_ls.setup { --- sources = { --- null_ls.builtins.formatting.prettier, --- null_ls.builtins.diagnostics.eslint, --- null_ls.builtins.code_actions.eslint, --- }, --- } --- end, --- }, --- { --- 'nvim-lualine/lualine.nvim', --- dependencies = { 'nvim-tree/nvim-web-devicons' }, --- config = function() --- require('lualine').setup { --- options = { --- theme = 'auto', --- section_separators = '', --- component_separators = '', --- }, --- sections = { --- lualine_a = { 'mode' }, --- lualine_b = { 'branch', 'diff', 'diagnostics' }, --- lualine_c = { 'filename' }, --- lualine_x = { 'encoding', 'fileformat', 'filetype' }, --- lualine_y = { 'progress' }, --- lualine_z = { 'location' }, --- }, --- } --- end, --- }, --- { --- 'lewis6991/gitsigns.nvim', --- config = function() --- require('gitsigns').setup { --- current_line_blame = true, --- } --- end, --- }, --- { --- 'mfussenegger/nvim-dap', --- config = function() --- local dap = require 'dap' --- dap.adapters.node2 = { --- type = 'executable', --- command = 'node', --- args = { os.getenv 'HOME' .. '/.local/share/nvim/mason/packages/node-debug2-adapter/out/src/nodeDebug.js' }, --- } --- --- dap.configurations.javascript = { --- { --- name = 'Launch Node.js', --- type = 'node2', --- request = 'launch', --- program = '${file}', --- cwd = vim.fn.getcwd(), --- sourceMaps = true, --- protocol = 'inspector', --- console = 'integratedTerminal', --- }, --- } --- end, --- }, --- --- { --- 'numToStr/Comment.nvim', --- config = function() --- require('Comment').setup() --- end, --- }, --- --- { --- 'windwp/nvim-autopairs', --- event = 'InsertEnter', --- config = function() --- require('nvim-autopairs').setup {} --- end, --- }, --- --- { --- 'nvim-pack/nvim-spectre', --- dependencies = { 'nvim-lua/plenary.nvim' }, --- config = function() --- require('spectre').setup() --- end, --- }, --- { --- 'nvim-telescope/telescope.nvim', --- event = 'VimEnter', --- branch = '0.1.x', --- dependencies = { --- 'nvim-lua/plenary.nvim', --- { -- If encountering errors, see telescope-fzf-native README for installation instructions --- 'nvim-telescope/telescope-fzf-native.nvim', --- build = 'make', --- cond = function() --- return vim.fn.executable 'make' == 1 --- end, --- }, --- { 'nvim-telescope/telescope-ui-select.nvim' }, --- { 'nvim-tree/nvim-web-devicons', enabled = vim.g.have_nerd_font }, --- }, --- config = function() --- require('telescope').setup { --- extensions = { --- ['ui-select'] = { --- require('telescope.themes').get_dropdown(), --- }, --- }, --- } --- pcall(require('telescope').load_extension, 'fzf') --- pcall(require('telescope').load_extension, 'ui-select') --- --- local builtin = require 'telescope.builtin' --- vim.keymap.set('n', 'sh', builtin.help_tags, { desc = '[S]earch [H]elp' }) --- vim.keymap.set('n', 'sk', builtin.keymaps, { desc = '[S]earch [K]eymaps' }) --- vim.keymap.set('n', 'sf', builtin.find_files, { desc = '[S]earch [F]iles' }) --- vim.keymap.set('n', 'ss', builtin.builtin, { desc = '[S]earch [S]elect Telescope' }) --- vim.keymap.set('n', 'sw', builtin.grep_string, { desc = '[S]earch current [W]ord' }) --- vim.keymap.set('n', 'sg', builtin.live_grep, { desc = '[S]earch by [G]rep' }) --- vim.keymap.set('n', 'sd', builtin.diagnostics, { desc = '[S]earch [D]iagnostics' }) --- vim.keymap.set('n', 'sr', builtin.resume, { desc = '[S]earch [R]esume' }) --- vim.keymap.set('n', 's.', builtin.oldfiles, { desc = '[S]earch Recent Files ("." for repeat)' }) --- vim.keymap.set('n', '', builtin.buffers, { desc = '[ ] Find existing buffers' }) --- --- vim.keymap.set('n', '/', function() --- builtin.current_buffer_fuzzy_find(require('telescope.themes').get_dropdown { --- winblend = 10, --- previewer = false, --- }) --- end, { desc = '[/] Fuzzily search in current buffer' }) --- --- vim.keymap.set('n', 's/', function() --- builtin.live_grep { --- grep_open_files = true, --- prompt_title = 'Live Grep in Open Files', --- } --- end, { desc = '[S]earch [/] in Open Files' }) --- --- vim.keymap.set('n', 'sn', function() --- builtin.find_files { cwd = vim.fn.stdpath 'config' } --- end, { desc = '[S]earch [N]eovim files' }) --- end, --- }, --- --- { --- 'folke/lazydev.nvim', --- ft = 'lua', --- opts = { --- library = { --- { path = '${3rd}/luv/library', words = { 'vim%.uv' } }, --- }, --- }, --- }, --- { --- 'neovim/nvim-lspconfig', --- dependencies = { --- { 'williamboman/mason.nvim', opts = {} }, --- 'williamboman/mason-lspconfig.nvim', --- 'WhoIsSethDaniel/mason-tool-installer.nvim', --- { 'j-hui/fidget.nvim', opts = {} }, --- 'hrsh7th/cmp-nvim-lsp', --- }, --- config = function() --- require('mason').setup() --- require('mason-lspconfig').setup { --- ensure_installed = { 'ts_ls', 'tailwindcss', 'cssls', 'lua_ls' }, --- automatic_installation = true, --- } --- local capabilities = vim.lsp.protocol.make_client_capabilities() --- capabilities = vim.tbl_deep_extend('force', capabilities, require('cmp_nvim_lsp').default_capabilities()) --- --- if vim.g.have_nerd_font then --- local signs = { ERROR = '', WARN = '', INFO = '', HINT = '' } --- for type, icon in pairs(signs) do --- local hl = 'DiagnosticSign' .. type --- vim.fn.sign_define(hl, { text = icon, texthl = hl, numhl = '' }) --- end --- end --- --- local servers = { --- ts_ls = { --- on_attach = function(client, bufnr) --- client.server_capabilities.documentFormattingProvider = false --- --- local map = function(keys, func, desc) --- vim.keymap.set('n', keys, func, { buffer = bufnr, desc = 'LSP: ' .. desc }) --- end --- --- vim.api.nvim_create_autocmd('BufWritePre', { --- buffer = bufnr, --- callback = function() --- vim.lsp.buf.code_action { --- context = { only = { 'source.fixAll' }, diagnostics = {} }, --- apply = true, --- } --- end, --- }) --- --- map('oi', function() --- vim.lsp.buf.code_action { --- context = { only = { 'source.organizeImports' }, diagnostics = {} }, --- apply = true, --- } --- end, '[O]rganize [I]mports') --- end, --- capabilities = capabilities, --- settings = { --- typescript = { --- inlayHints = { includeInlayParameterNameHints = 'all' }, --- preferences = { importModuleSpecifierPreference = 'non-relative', quotePreference = 'single' }, --- }, --- javascript = { --- preferences = { importModuleSpecifierPreference = 'non-relative', quotePreference = 'single' }, --- }, --- }, --- }, --- tailwindcss = { --- filetypes = { 'html', 'css', 'scss', 'javascript', 'typescript', 'javascriptreact', 'typescriptreact' }, --- }, --- cssls = {}, --- lua_ls = { --- settings = { --- Lua = { --- completion = { callSnippet = 'Replace' }, --- }, --- }, --- }, --- } --- --- local ensure_installed = vim.tbl_keys(servers) --- require('mason-tool-installer').setup { ensure_installed = ensure_installed } --- --- require('mason-lspconfig').setup { --- ensure_installed = ensure_installed, --- automatic_installation = true, --- handlers = { --- function(server_name) --- local server = servers[server_name] or {} --- server.capabilities = vim.tbl_deep_extend('force', {}, capabilities, server.capabilities or {}) --- require('lspconfig')[server_name].setup(server) --- end, --- }, --- } --- end, --- }, --- { --- 'stevearc/conform.nvim', --- event = { 'BufWritePre' }, --- cmd = { 'ConformInfo' }, --- keys = { --- { --- 'f', --- function() --- require('conform').format { async = true, lsp_format = 'fallback' } --- end, --- mode = '', --- desc = '[F]ormat buffer', --- }, --- }, --- opts = { --- notify_on_error = false, --- format_on_save = function(bufnr) --- local disable_filetypes = { c = true, cpp = true } --- return { --- timeout_ms = 500, --- lsp_format = disable_filetypes[vim.bo[bufnr].filetype] and 'never' or 'fallback', --- } --- end, --- formatters_by_ft = { --- lua = { 'stylua' }, --- javascript = { 'prettier' }, --- typescript = { 'prettier' }, --- css = { 'prettier' }, --- scss = { 'prettier' }, --- html = { 'prettier' }, --- }, --- }, --- }, --- { --- 'hrsh7th/nvim-cmp', --- event = 'InsertEnter', --- dependencies = { --- { --- 'L3MON4D3/LuaSnip', --- build = (function() --- if vim.fn.has 'win32' == 1 or vim.fn.executable 'make' == 0 then --- return --- end --- return 'make install_jsregexp' --- end)(), --- }, --- 'saadparwaiz1/cmp_luasnip', --- 'hrsh7th/cmp-nvim-lsp', --- 'hrsh7th/cmp-path', --- 'hrsh7th/cmp-buffer', --- 'hrsh7th/cmp-cmdline', --- }, --- config = function() --- local cmp = require 'cmp' --- local luasnip = require 'luasnip' --- luasnip.config.setup {} --- cmp.setup { --- snippet = { --- expand = function(args) --- luasnip.lsp_expand(args.body) --- end, --- }, --- completion = { completeopt = 'menu,menuone,noinsert' }, --- --- mapping = cmp.mapping.preset.insert { --- [''] = cmp.mapping.select_next_item(), --- [''] = cmp.mapping.select_prev_item(), --- [''] = cmp.mapping.scroll_docs(-4), --- [''] = cmp.mapping.scroll_docs(4), --- [''] = cmp.mapping.confirm { select = true }, --- [''] = cmp.mapping.complete {}, --- [''] = cmp.mapping(function() --- if luasnip.expand_or_locally_jumpable() then --- luasnip.expand_or_jump() --- end --- end, { 'i', 's' }), --- [''] = cmp.mapping(function() --- if luasnip.locally_jumpable(-1) then --- luasnip.jump(-1) --- end --- end, { 'i', 's' }), --- }, --- --- sources = cmp.config.sources { --- { name = 'lazydev', group_index = 0 }, --- { name = 'nvim_lsp' }, --- { name = 'luasnip' }, --- { name = 'path' }, --- { name = 'buffer' }, --- }, --- } --- end, --- }, --- { -- 🎨 Colorscheme --- 'folke/tokyonight.nvim', --- priority = 1000, --- init = function() --- -- Load colorscheme with specific style --- vim.cmd.colorscheme 'tokyonight-night' --- -- Customize Comment color (removes italic) --- vim.cmd.hi 'Comment gui=none' --- end, --- }, --- -- ✅ Highlight TODOs, FIXMEs, and other comments --- { --- 'folke/todo-comments.nvim', --- event = 'VimEnter', --- dependencies = { 'nvim-lua/plenary.nvim' }, --- opts = { signs = false }, --- }, --- { -- 🛠️ mini.nvim utility plugins (better text objects, surround, and statusline) --- 'echasnovski/mini.nvim', --- config = function() --- -- Setup mini.ai for better text objects --- require('mini.ai').setup { --- n_lines = 500, --- } --- -- Setup mini.surround for surrounding text objects --- require('mini.surround').setup() --- --- -- Setup mini.statusline for a better status line --- require('mini.statusline').setup { --- use_icons = vim.g.have_nerd_font, --- content = { --- active = function() --- return '%2l:%-2v' -- line:column display --- end, --- }, --- } --- end, --- }, --- { --- 'nvim-treesitter/nvim-treesitter', --- build = ':tsupdate', --- main = 'nvim-treesitter.configs', --- opts = { --- ensure_installed = { --- 'bash', --- 'c', --- 'diff', --- 'html', --- 'css', --- 'javascript', --- 'typescript', --- 'tsx', --- 'json', --- 'lua', --- 'luadoc', --- 'markdown', --- 'markdown_inline', --- 'query', --- 'vim', --- 'vimdoc', --- }, --- auto_install = true, --- highlight = { --- enable = true, --- additional_vim_regex_highlighting = { 'ruby' }, --- }, --- indent = { enable = true, disable = { 'ruby' } }, --- }, --- }, --- ui = { --- icons = vim.g.have_nerd_font and {} or { --- cmd = '⌘', --- config = '🛠', --- event = '📅', --- ft = '📂', --- init = '⚙', --- keys = '🗝', --- plugin = '🔌', --- runtime = '💻', --- require = '🌙', --- source = '📄', --- start = '🚀', --- task = '📌', --- lazy = '💤 ', --- }, --- }, --- } --- --- return M diff --git a/lua/settings.lua b/lua/settings.lua index fca7d0ce..62dd31b9 100644 --- a/lua/settings.lua +++ b/lua/settings.lua @@ -1,14 +1,11 @@ vim.g.have_nerd_font = true -vim.scriptencoding = 'utf-8' vim.opt.number = true vim.opt.relativenumber = true vim.opt.mouse = 'a' vim.opt.showmode = false -vim.opt.fileencoding = 'utf-8' vim.opt.title = true vim.opt.clipboard = 'unnamedplus' - vim.opt.breakindent = true vim.opt.undofile = true vim.opt.ignorecase = true @@ -19,7 +16,7 @@ vim.opt.shiftwidth = 2 vim.opt.autoindent = true vim.opt.smartindent = true vim.opt.signcolumn = 'yes' -vim.opt.updatetime = 250 +vim.opt.updatetime = 200 vim.opt.timeoutlen = 300 vim.opt.splitright = true vim.opt.splitbelow = true @@ -28,3 +25,31 @@ vim.opt.listchars = { tab = '» ', trail = '·', nbsp = '␣' } vim.opt.inccommand = 'split' vim.opt.cursorline = true vim.opt.scrolloff = 10 +vim.opt.backspace = { 'indent', 'eol', 'start' } +vim.opt.path:append { '**' } +vim.opt.wildignore:append { '*/node_modules/*' } +vim.opt.formatoptions:append { 'r' } + +-- Enable folding in Neovim +vim.opt.foldmethod = 'expr' +vim.opt.foldexpr = 'nvim_treesitter#foldexpr()' +vim.opt.foldlevel = 99 -- Keep folds open by default +vim.opt.foldcolumn = '1' -- Show fold column left of line numbers + +vim.opt.foldtext = 'v:lua.custom_foldtext()' -- Custom fold text function + +-- Function to change fold symbols +function _G.custom_foldtext() + local line = vim.fn.getline(vim.v.foldstart) -- Get the first line of the fold + local fold_size = vim.v.foldend - vim.v.foldstart + 1 + return line .. ' (' .. fold_size .. ' lines) ' -- Display fold size +end + +-- Customize fold markers in fold column +vim.opt.statuscolumn = '%C' -- Customize fold column symbols +vim.opt.fillchars:append { + foldopen = '▾', -- Down arrow for open folds + foldclose = '▸', -- Right arrow for closed folds + foldsep = ' ', -- Space between folds + fold = ' ', -- Empty space for better visuals +}