From f21db92115bca6ebbc579d7d24e4451bd75a3982 Mon Sep 17 00:00:00 2001 From: yongseokj Date: Tue, 27 Aug 2024 15:53:11 -0700 Subject: [PATCH 1/8] add work nvim setting --- init.lua | 221 ++++++++++++++++++++++++++++++++----------------------- 1 file changed, 127 insertions(+), 94 deletions(-) diff --git a/init.lua b/init.lua index 3593ca2e194..81812a89f6b 100644 --- a/init.lua +++ b/init.lua @@ -1,89 +1,3 @@ ---[[ - -===================================================================== -==================== READ THIS BEFORE CONTINUING ==================== -===================================================================== -======== .-----. ======== -======== .----------------------. | === | ======== -======== |.-""""""""""""""""""-.| |-----| ======== -======== || || | === | ======== -======== || KICKSTART.NVIM || |-----| ======== -======== || || | === | ======== -======== || || |-----| ======== -======== ||:Tutor || |:::::| ======== -======== |'-..................-'| |____o| ======== -======== `"")----------------(""` ___________ ======== -======== /::::::::::| |::::::::::\ \ no mouse \ ======== -======== /:::========| |==hjkl==:::\ \ required \ ======== -======== '""""""""""""' '""""""""""""' '""""""""""' ======== -======== ======== -===================================================================== -===================================================================== - -What is Kickstart? - - Kickstart.nvim is *not* a distribution. - - Kickstart.nvim is a starting point for your own configuration. - The goal is that you can read every line of code, top-to-bottom, understand - what your configuration is doing, and modify it to suit your needs. - - Once you've done that, you can start exploring, configuring and tinkering to - make Neovim your own! That might mean leaving Kickstart just the way it is for a while - or immediately breaking it into modular pieces. It's up to you! - - If you don't know anything about Lua, I recommend taking some time to read through - a guide. One possible example which will only take 10-15 minutes: - - https://learnxinyminutes.com/docs/lua/ - - After understanding a bit more about Lua, you can use `:help lua-guide` as a - reference for how Neovim integrates Lua. - - :help lua-guide - - (or HTML version): https://neovim.io/doc/user/lua-guide.html - -Kickstart Guide: - - TODO: The very first thing you should do is to run the command `:Tutor` in Neovim. - - If you don't know what this means, type the following: - - - - : - - Tutor - - - - (If you already know the Neovim basics, you can skip this step.) - - Once you've completed that, you can continue working through **AND READING** the rest - of the kickstart init.lua. - - Next, run AND READ `:help`. - This will open up a help window with some basic information - about reading, navigating and searching the builtin help documentation. - - This should be the first place you go to look when you're stuck or confused - with something. It's one of my favorite Neovim features. - - MOST IMPORTANTLY, we provide a keymap "sh" to [s]earch the [h]elp documentation, - which is very useful when you're not exactly sure of what you're looking for. - - I have left several `:help X` comments throughout the init.lua - These are hints about where to find more information about the relevant settings, - plugins or Neovim features used in Kickstart. - - NOTE: Look for lines like this - - Throughout the file. These are for you, the reader, to help you understand what is happening. - Feel free to delete them once you know what you're doing, but they should serve as a guide - for when you are first encountering a few different constructs in your Neovim config. - -If you experience any errors while trying to install kickstart, run `:checkhealth` for more info. - -I hope you enjoy your Neovim journey, -- TJ - -P.S. You can delete this when you're done too. It's your config now! :) ---]] - -- Set as the leader key -- See `:help mapleader` -- NOTE: Must happen before plugins are loaded (otherwise wrong leader will be used) @@ -91,7 +5,7 @@ vim.g.mapleader = ' ' vim.g.maplocalleader = ' ' -- Set to true if you have a Nerd Font installed and selected in the terminal -vim.g.have_nerd_font = false +vim.g.have_nerd_font = true -- [[ Setting options ]] -- See `:help vim.o` @@ -110,6 +24,22 @@ vim.o.mouse = 'a' -- Don't show the mode, since it's already in the status line vim.o.showmode = false +vim.opt.tags = "./tags,../tags,../../tags,../../../tags,../../../../tags,../../../../../tags,../../../../../../tags,../../../../../../../tags" + +vim.opt.backup = true +local home_backup_path = os.getenv('HOME') .. '/.backup' +vim.opt.backupdir = home_backup_path + +vim.opt.errorbells = false +vim.opt.tabstop = 4 +vim.opt.shiftwidth = 4 +vim.opt.softtabstop = 4 +vim.opt.smartindent = true +vim.opt.expandtab = true + +vim.g.autoformat = false +vim.g.setrnu = false + -- Sync clipboard between OS and Neovim. -- Schedule the setting after `UiEnter` because it can increase startup-time. -- Remove this option if you want your OS clipboard to remain independent. @@ -164,11 +94,16 @@ vim.o.scrolloff = 10 -- See `:help 'confirm'` vim.o.confirm = true +vim.opt.foldlevel = 5 +vim.opt.foldmethod = "expr" +vim.opt.foldexpr = "nvim_treesitter#foldexpr()" + -- [[ Basic Keymaps ]] -- See `:help vim.keymap.set()` -- Clear highlights on search when pressing in normal mode -- See `:help hlsearch` +vim.opt.hlsearch = true vim.keymap.set('n', '', 'nohlsearch') -- Diagnostic Config & Keymaps @@ -230,6 +165,8 @@ vim.api.nvim_create_autocmd('TextYankPost', { callback = function() vim.hl.on_yank() end, }) +--vim.api.nvim_set_hl(0, '@lsp.type.comment.cpp', {}) + -- [[ Install `lazy.nvim` plugin manager ]] -- See `:help lazy.nvim.txt` or https://github.com/folke/lazy.nvim for more info local lazypath = vim.fn.stdpath 'data' .. '/lazy/lazy.nvim' @@ -289,6 +226,24 @@ require('lazy').setup({ }, }, + { + 'sindrets/diffview.nvim', + }, + + { + "folke/flash.nvim", + event = "VeryLazy", + -- @type Flash.Config + opts = {}, + -- stylua: ignore + keys = { + { "s", mode = { "n", "x", "o" }, function() require("flash").jump() end, desc = "Flash" }, + { "S", mode = { "n", "x", "o" }, function() require("flash").treesitter() end, desc = "Flash Treesitter" }, + { "r", mode = "o", function() require("flash").remote() end, desc = "Remote Flash" }, + { "R", mode = { "o", "x" }, function() require("flash").treesitter_search() end, desc = "Treesitter Search" }, + { "", mode = { "c" }, function() require("flash").toggle() end, desc = "Toggle Flash Search" }, + }, + }, -- NOTE: Plugins can also be configured to run Lua code when they are loaded. -- -- This is often very useful to both group configuration, as well as handle @@ -393,7 +348,25 @@ require('lazy').setup({ -- i = { [''] = 'to_fuzzy_refine' }, -- }, -- }, - -- pickers = {} + defaults = { + layout_config = { + preview_width = 0.7, + }, + }, + pickers = { + find_files = { + find_command = { "rg", "--files", "-g", "!**/**Linux_x86_64/**", "-g", "!compile_commands.json"}, + }, + live_grep = { + additional_args = {"-w", "-g", "!**/**Linux_x86_64/**"}, + }, + grep_string = { + additional_args = {"-w", "-g", "!**/**Linux_x86_64/**"}, + }, + }, + cond = function (lang, bufnr) + return lang == "cpp" and vim.api.nvim_buf_line_count(bufnr) < 10000 + end, extensions = { ['ui-select'] = { require('telescope.themes').get_dropdown() }, }, @@ -411,11 +384,13 @@ require('lazy').setup({ vim.keymap.set('n', 'ss', builtin.builtin, { desc = '[S]earch [S]elect Telescope' }) vim.keymap.set({ 'n', 'v' }, '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', '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', 'sc', builtin.commands, { desc = '[S]earch [C]ommands' }) vim.keymap.set('n', '', builtin.buffers, { desc = '[ ] Find existing buffers' }) + vim.keymap.set("n", "", " Telescope grep_string", {desc="Telescope Grep String"}) + vim.keymap.set("n", "", " Telescope find_files", {desc="Telescope Files"}) -- This runs on LSP attach per buffer (see main LSP attach function in 'neovim/nvim-lspconfig' config for more info, -- it is better explained there). This allows easily switching between pickers if you prefer using something else! @@ -483,6 +458,7 @@ require('lazy').setup({ { -- Main LSP Configuration 'neovim/nvim-lspconfig', + ft = {"lua", "cpp", "python"}, dependencies = { -- Automatically install LSPs and related tools to stdpath for Neovim -- Mason must be loaded before its dependents so we need to set it up here. @@ -603,9 +579,25 @@ require('lazy').setup({ -- See `:help lsp-config` for information about keys and how to configure ---@type table local servers = { - -- clangd = {}, + clangd = { + mason = true, + cmd = {'/home/utils/llvm-17.0.6/bin/clangd', + "--background-index", + "--clang-tidy", + "--j=2"}, + filetypes = {"cpp"}, + single_file_support = true, + capabilities = capabilities, + --on_attach = on_attach, + --root_dir = function() + -- return vim.fn.getcwd() + --end + root_dir = function(fname) + return require('lspconfig/util').root_pattern( unpack({'compile_commands.json', 'tree.make'}))(fname) + end + }, -- gopls = {}, - -- pyright = {}, + pyright = {}, -- rust_analyzer = {}, -- -- Some languages (like typescript) have entire language plugins that can be useful: @@ -806,7 +798,8 @@ require('lazy').setup({ -- change the command in the config to whatever the name of that colorscheme is. -- -- If you want to see what colorschemes are already installed, you can use `:Telescope colorscheme`. - 'folke/tokyonight.nvim', + --'folke/tokyonight.nvim', + 'catppuccin/nvim', priority = 1000, -- Make sure to load this before all the other start plugins. config = function() ---@diagnostic disable-next-line: missing-fields @@ -819,7 +812,10 @@ require('lazy').setup({ -- Load the colorscheme here. -- Like many other themes, this one has different styles, and you could load -- any other, such as 'tokyonight-storm', 'tokyonight-moon', or 'tokyonight-day'. - vim.cmd.colorscheme 'tokyonight-night' + vim.cmd.colorscheme 'catppuccin-mocha' + + -- You can configure highlights by doing something like: + vim.cmd.hi 'Comment gui=none' end, }, @@ -877,7 +873,9 @@ require('lazy').setup({ branch = 'main', -- [[ Configure Treesitter ]] See `:help nvim-treesitter-intro` config = function() - local parsers = { 'bash', 'c', 'diff', 'html', 'lua', 'luadoc', 'markdown', 'markdown_inline', 'query', 'vim', 'vimdoc' } + -- If on a system with a non-default compiler, set it here: + -- require('nvim-treesitter.install').compilers = {"/home/utils/gcc-12.2.0/bin/gcc" } + local parsers = { 'bash', 'c', 'cpp', 'diff', 'html', 'lua', 'luadoc', 'markdown', 'markdown_inline', 'python', 'query', 'vim', 'vimdoc' } require('nvim-treesitter').install(parsers) vim.api.nvim_create_autocmd('FileType', { callback = function(args) @@ -902,6 +900,41 @@ require('lazy').setup({ }) end, }, + { 'ngemily/vim-vp4', + lazy = true, + event = "BufModifiedSet", + cmd = {"Vp4Diff", "Vp4Annotate"}, + }, + { 'AndrewRadev/linediff.vim', + lazy = true, + cmd = "Linediff", + }, + { 'junegunn/vim-easy-align', + lazy = true, + cmd="EasyAlign" + }, + { + 'pteroctopus/faster.nvim', + opts = { + behaviors = { + bigfile = { + features_disabled = { + "illuminate", "matchparen", "lsp", "treesitter", "indent_blankline", + "vimopts", "syntax", "filetype", "linediff", "vim-vp4", "vim-easy-align", "telescope" + }, + filesize = 3, + } + }, + }, + }, + { + "m4xshen/hardtime.nvim", + dependencies = { "MunifTanjim/nui.nvim", "nvim-lua/plenary.nvim" }, + opts = { + max_count = 10, + restriction_mode = "hint", + } + }, -- The following comments only work if you have downloaded the kickstart repo, not just copy pasted the -- init.lua. If you want these files, they are in the repository, so you can just download them and From 8aaadac855377c1b6aeba199482b78c0b2b4e441 Mon Sep 17 00:00:00 2001 From: yongseokj Date: Mon, 9 Sep 2024 12:43:50 -0700 Subject: [PATCH 2/8] update on 9/9/2024 --- cpp.nvim | 1 + init.lua | 32 ++++++++++++++++++-------------- 2 files changed, 19 insertions(+), 14 deletions(-) create mode 100644 cpp.nvim diff --git a/cpp.nvim b/cpp.nvim new file mode 100644 index 00000000000..1694e503dad --- /dev/null +++ b/cpp.nvim @@ -0,0 +1 @@ +vim.o.expandtab=true diff --git a/init.lua b/init.lua index 81812a89f6b..d81f1017d98 100644 --- a/init.lua +++ b/init.lua @@ -230,14 +230,14 @@ require('lazy').setup({ 'sindrets/diffview.nvim', }, - { + { "folke/flash.nvim", event = "VeryLazy", -- @type Flash.Config opts = {}, -- stylua: ignore keys = { - { "s", mode = { "n", "x", "o" }, function() require("flash").jump() end, desc = "Flash" }, + { "f", mode = { "n", "x", "o" }, function() require("flash").jump() end, desc = "Flash" }, { "S", mode = { "n", "x", "o" }, function() require("flash").treesitter() end, desc = "Flash Treesitter" }, { "r", mode = "o", function() require("flash").remote() end, desc = "Remote Flash" }, { "R", mode = { "o", "x" }, function() require("flash").treesitter_search() end, desc = "Treesitter Search" }, @@ -348,11 +348,11 @@ require('lazy').setup({ -- i = { [''] = 'to_fuzzy_refine' }, -- }, -- }, - defaults = { - layout_config = { - preview_width = 0.7, - }, - }, + --defaults = { + -- layout_config = { + -- preview_width = 0.7, + -- }, + --}, pickers = { find_files = { find_command = { "rg", "--files", "-g", "!**/**Linux_x86_64/**", "-g", "!compile_commands.json"}, @@ -593,7 +593,7 @@ require('lazy').setup({ -- return vim.fn.getcwd() --end root_dir = function(fname) - return require('lspconfig/util').root_pattern( unpack({'compile_commands.json', 'tree.make'}))(fname) + return require('lspconfig/util').root_pattern( unpack({'compile_commands.json'}))(fname) end }, -- gopls = {}, @@ -927,13 +927,17 @@ require('lazy').setup({ }, }, }, + --{ + -- "m4xshen/hardtime.nvim", + -- dependencies = { "MunifTanjim/nui.nvim", "nvim-lua/plenary.nvim" }, + -- opts = { + -- max_count = 10, + -- restriction_mode = "hint", + -- } + --}, { - "m4xshen/hardtime.nvim", - dependencies = { "MunifTanjim/nui.nvim", "nvim-lua/plenary.nvim" }, - opts = { - max_count = 10, - restriction_mode = "hint", - } + 'ckipp01/nvim-jenkinsfile-linter', + requires = { "nvim-lua/plenary.nvim" } }, -- The following comments only work if you have downloaded the kickstart repo, not just copy pasted the From dfa4d030426aa37b62f6333f8b604476fe2e8c37 Mon Sep 17 00:00:00 2001 From: yongseokj Date: Wed, 11 Sep 2024 09:55:43 -0700 Subject: [PATCH 3/8] add custom snippets --- init.lua | 15 +++++++++------ package.json | 13 +++++++++++++ snippets/cpp.json | 11 +++++++++++ 3 files changed, 33 insertions(+), 6 deletions(-) create mode 100644 package.json create mode 100644 snippets/cpp.json diff --git a/init.lua b/init.lua index d81f1017d98..ea83d11cf9d 100644 --- a/init.lua +++ b/init.lua @@ -584,6 +584,7 @@ require('lazy').setup({ cmd = {'/home/utils/llvm-17.0.6/bin/clangd', "--background-index", "--clang-tidy", + "--header-insertion=iwyu", "--j=2"}, filetypes = {"cpp"}, single_file_support = true, @@ -720,12 +721,14 @@ require('lazy').setup({ -- `friendly-snippets` contains a variety of premade snippets. -- See the README about individual language/framework/plugin snippets: -- https://github.com/rafamadriz/friendly-snippets - -- { - -- 'rafamadriz/friendly-snippets', - -- config = function() - -- require('luasnip.loaders.from_vscode').lazy_load() - -- end, - -- }, + { + 'rafamadriz/friendly-snippets', + config = function() + require('luasnip.loaders.from_vscode').lazy_load({ include={"cpp", "python", "lua"} }) + local snip_loader = require('luasnip.loaders.from_vscode') + snip_loader.lazy_load({ paths = vim.fn.stdpath("config").."/snippets/" }) + end, + }, }, opts = {}, }, diff --git a/package.json b/package.json new file mode 100644 index 00000000000..5503f672963 --- /dev/null +++ b/package.json @@ -0,0 +1,13 @@ +{ + "name": "custom snippets", + "contributes": { + "snippets": [ + { + "language": [ + "cpp" + ], + "path": "snippets/cpp.json" + } + ] + } +} diff --git a/snippets/cpp.json b/snippets/cpp.json new file mode 100644 index 00000000000..0b4fae74818 --- /dev/null +++ b/snippets/cpp.json @@ -0,0 +1,11 @@ +{ + "iterator": { + "prefix": "iterator", + "body": [ + "class Iterator {", + "}", + "" + ], + "description": "iterator class" + } +} From 70e5b4c1cca61e7c601fe3d449edd13ea6b36cb3 Mon Sep 17 00:00:00 2001 From: yongseokj Date: Mon, 30 Sep 2024 11:45:07 -0700 Subject: [PATCH 4/8] add snippets --- init.lua | 89 +++--- lua/custom/plugins/init.lua | 48 +++- package.json | 50 +++- snippets/basicAlgo.json | 282 +++++++++++++++++++ snippets/bst.json | 253 ++++++++++++++++++ snippets/commonLang.json | 42 +++ snippets/cpp.json | 39 ++- snippets/fmod.json | 16 ++ snippets/graph.json | 520 ++++++++++++++++++++++++++++++++++++ snippets/input.json | 50 ++++ snippets/kickstart.json | 45 ++++ snippets/searching.json | 42 +++ snippets/sorting.json | 310 +++++++++++++++++++++ snippets/starters.json | 84 ++++++ snippets/strings.json | 228 ++++++++++++++++ snippets/test.cpp | 1 + snippets/tree.json | 377 ++++++++++++++++++++++++++ 17 files changed, 2412 insertions(+), 64 deletions(-) create mode 100644 snippets/basicAlgo.json create mode 100644 snippets/bst.json create mode 100644 snippets/commonLang.json create mode 100644 snippets/fmod.json create mode 100644 snippets/graph.json create mode 100644 snippets/input.json create mode 100644 snippets/kickstart.json create mode 100644 snippets/searching.json create mode 100644 snippets/sorting.json create mode 100644 snippets/starters.json create mode 100644 snippets/strings.json create mode 100644 snippets/test.cpp create mode 100644 snippets/tree.json diff --git a/init.lua b/init.lua index ea83d11cf9d..a441552c8ec 100644 --- a/init.lua +++ b/init.lua @@ -98,6 +98,8 @@ vim.opt.foldlevel = 5 vim.opt.foldmethod = "expr" vim.opt.foldexpr = "nvim_treesitter#foldexpr()" +vim.opt.diffopt="internal,filler,closeoff,iwhite,linematch:60" + -- [[ Basic Keymaps ]] -- See `:help vim.keymap.set()` @@ -165,6 +167,22 @@ vim.api.nvim_create_autocmd('TextYankPost', { callback = function() vim.hl.on_yank() end, }) +vim.api.nvim_create_autocmd('BufReadPost', { + pattern = { '*' }, + desc = 'When editing a file, always jump to the last known cursor position', + callback = function() + local line = vim.fn.line '\'"' + if + line >= 1 + and line <= vim.fn.line '$' + and vim.bo.filetype ~= 'commit' + and vim.fn.index({ 'xxd', 'gitrebase' }, vim.bo.filetype) == -1 + then + vim.cmd 'normal! g`"' + end + end, +}) + --vim.api.nvim_set_hl(0, '@lsp.type.comment.cpp', {}) -- [[ Install `lazy.nvim` plugin manager ]] @@ -584,8 +602,21 @@ require('lazy').setup({ cmd = {'/home/utils/llvm-17.0.6/bin/clangd', "--background-index", "--clang-tidy", - "--header-insertion=iwyu", + "--header-insertion=never", "--j=2"}, + init_options = { + clangdFileStatus = true, + inlayHints= { + enabled = true, + parameterNames = true, + autoDeducedTypes = true, -- Enable auto type hints + typeHints = true, + typeNameLimit = 24, + lambdaReturnType = true, + blockEnd = true, + designators = true, + }, + }, filetypes = {"cpp"}, single_file_support = true, capabilities = capabilities, @@ -711,6 +742,7 @@ require('lazy').setup({ 'L3MON4D3/LuaSnip', version = '2.*', build = (function() + CC={"/home/utils/gcc-14.1.0/bin/gcc"} -- Build Step is needed for regex support in snippets. -- This step is not supported in many windows environments. -- Remove the below condition to re-enable on windows. @@ -725,8 +757,7 @@ require('lazy').setup({ 'rafamadriz/friendly-snippets', config = function() require('luasnip.loaders.from_vscode').lazy_load({ include={"cpp", "python", "lua"} }) - local snip_loader = require('luasnip.loaders.from_vscode') - snip_loader.lazy_load({ paths = vim.fn.stdpath("config").."/snippets/" }) + require('luasnip.loaders.from_vscode').lazy_load({ paths = vim.fn.stdpath("config").."/snippets/" }) end, }, }, @@ -801,8 +832,8 @@ require('lazy').setup({ -- change the command in the config to whatever the name of that colorscheme is. -- -- If you want to see what colorschemes are already installed, you can use `:Telescope colorscheme`. - --'folke/tokyonight.nvim', - 'catppuccin/nvim', + 'folke/tokyonight.nvim', + --'catppuccin/nvim', priority = 1000, -- Make sure to load this before all the other start plugins. config = function() ---@diagnostic disable-next-line: missing-fields @@ -819,6 +850,7 @@ require('lazy').setup({ -- You can configure highlights by doing something like: vim.cmd.hi 'Comment gui=none' + vim.api.nvim_set_hl(0, "LspInlayHint", {fg = "#9DA9A0", bg="#000000" }) end, }, @@ -903,45 +935,6 @@ require('lazy').setup({ }) end, }, - { 'ngemily/vim-vp4', - lazy = true, - event = "BufModifiedSet", - cmd = {"Vp4Diff", "Vp4Annotate"}, - }, - { 'AndrewRadev/linediff.vim', - lazy = true, - cmd = "Linediff", - }, - { 'junegunn/vim-easy-align', - lazy = true, - cmd="EasyAlign" - }, - { - 'pteroctopus/faster.nvim', - opts = { - behaviors = { - bigfile = { - features_disabled = { - "illuminate", "matchparen", "lsp", "treesitter", "indent_blankline", - "vimopts", "syntax", "filetype", "linediff", "vim-vp4", "vim-easy-align", "telescope" - }, - filesize = 3, - } - }, - }, - }, - --{ - -- "m4xshen/hardtime.nvim", - -- dependencies = { "MunifTanjim/nui.nvim", "nvim-lua/plenary.nvim" }, - -- opts = { - -- max_count = 10, - -- restriction_mode = "hint", - -- } - --}, - { - 'ckipp01/nvim-jenkinsfile-linter', - requires = { "nvim-lua/plenary.nvim" } - }, -- The following comments only work if you have downloaded the kickstart repo, not just copy pasted the -- init.lua. If you want these files, they are in the repository, so you can just download them and @@ -963,12 +956,8 @@ require('lazy').setup({ -- This is the easiest way to modularize your config. -- -- Uncomment the following line and add your plugins to `lua/custom/plugins/*.lua` to get going. - -- { import = 'custom.plugins' }, - -- - -- For additional information with loading, sourcing and examples see `:help lazy.nvim-🔌-plugin-spec` - -- Or use telescope! - -- In normal mode type `sh` then write `lazy.nvim-plugin` - -- you can continue same window with `sr` which resumes last telescope search + -- For additional information, see `:help lazy.nvim-lazy.nvim-structuring-your-plugins` + { import = 'custom.plugins' }, }, { ---@diagnostic disable-line: missing-fields ui = { -- If you are using a Nerd Font: set icons to an empty table which will use the diff --git a/lua/custom/plugins/init.lua b/lua/custom/plugins/init.lua index b3ddcfdd3aa..edfacf04ab1 100644 --- a/lua/custom/plugins/init.lua +++ b/lua/custom/plugins/init.lua @@ -5,4 +5,50 @@ ---@module 'lazy' ---@type LazySpec -return {} +return { + { 'ngemily/vim-vp4', + lazy = true, + event = "BufModifiedSet", + cmd = {"Vp4Diff", "Vp4Annotate"}, + }, + { 'AndrewRadev/linediff.vim', + lazy = true, + cmd = "Linediff", + }, + { 'junegunn/vim-easy-align', + lazy = true, + cmd="EasyAlign" + }, + { + 'pteroctopus/faster.nvim', + opts = { + behaviors = { + bigfile = { + features_disabled = { + "illuminate", "matchparen", "lsp", "treesitter", "indent_blankline", + "vimopts", "syntax", "filetype", "linediff", "vim-vp4", "vim-easy-align", "telescope" + }, + filesize = 3, + } + }, + }, + }, + --{ + -- "m4xshen/hardtime.nvim", + -- dependencies = { "MunifTanjim/nui.nvim", "nvim-lua/plenary.nvim" }, + -- opts = { + -- max_count = 10, + -- restriction_mode = "hint", + -- } + --}, + { + "gbprod/substitute.nvim", + config = function() + vim.keymap.set("n", "s", require('substitute').operator, { noremap = true }) + vim.keymap.set("n", "ss", require('substitute').line, { noremap = true }) + vim.keymap.set("n", "S", require('substitute').eol, { noremap = true }) + vim.keymap.set("x", "s", require('substitute').visual, { noremap = true }) + end, + opts = {}, + }, +} diff --git a/package.json b/package.json index 5503f672963..6f2744474b6 100644 --- a/package.json +++ b/package.json @@ -3,10 +3,52 @@ "contributes": { "snippets": [ { - "language": [ - "cpp" - ], - "path": "snippets/cpp.json" + "language": "cpp", + "path": "./snippets/cpp.json" + }, + { + "language": "cpp", + "path": "./snippets/fmod.json" + }, + { + "language": "cpp", + "path": "./snippets/starters.json" + }, + { + "language": "cpp", + "path": "./snippets/basicAlgo.json" + }, + { + "language": "cpp", + "path": "./snippets/sorting.json" + }, + { + "language": "cpp", + "path": "./snippets/searching.json" + }, + { + "language": "cpp", + "path": "./snippets/input.json" + }, + { + "language": "cpp", + "path": "./snippets/commonLang.json" + }, + { + "language": "cpp", + "path": "./snippets/tree.json" + }, + { + "language": "cpp", + "path": "./snippets/bst.json" + }, + { + "language": "cpp", + "path": "./snippets/graph.json" + }, + { + "language": "cpp", + "path": "./snippets/strings.json" } ] } diff --git a/snippets/basicAlgo.json b/snippets/basicAlgo.json new file mode 100644 index 00000000000..13dddcf8aef --- /dev/null +++ b/snippets/basicAlgo.json @@ -0,0 +1,282 @@ +{ + "Greatest Common Divisor": { + "prefix": "gcd", + "body": [ + "int gcd(int a, int b)", + "{", + " if (b == 0)", + " return a;", + " return gcd(b, a % b);", + " ", + "}" + ], + "description": "GCD using Euclidean Algorithm" + }, + "Maximum Function with long long int": { + "prefix": "maxll", + "body": [ + "long long int max(long long int a, long long int b)", + "{", + " if (a >= b)", + " {", + " return a;", + " }", + " else", + " {", + " return b;", + " }", + "}" + ], + "description": "Maximum Function with long long int" + }, + "Minimum Function with long long int": { + "prefix": "minll", + "body": [ + "long long int min(long long int a, long long int b)", + "{", + " if (a >= b)", + " {", + " return b;", + " }", + " else", + " {", + " return a;", + " }", + "}" + ], + "description": "Minimum Function with long long int" + }, + "Check number is power of two": { + "prefix": "isPowerOfTwo", + "body": [ + "bool isPowerOfTwo(int n) {", + " return n && (!(n & (n - 1)));", + "}" + ], + "description": "Check number is power of two" + }, + "Check number is prime": { + "prefix": "isPrime", + "body": [ + "bool isPrime(int n)", + "{", + " for (int i = 2; i * i <= n; i++) {", + " if (n % i == 0)return false;", + " }", + " return true;", + "}" + ], + "description": "Check number is prime" + }, + "Return all prime factors": { + "prefix": "primeFactors", + "body": [ + "vector primeFactors(int n)", + "{", + " vector v;", + " if (n % 2 == 0) {", + " v.push_back(2);", + " while (n % 2 == 0)n /= 2;", + " }", + " for (int i = 3; i * i <= n; i += 2) {", + " if (n % i == 0) {", + " v.push_back(i);", + " while (n % i == 0)n /= i;", + " }", + " }", + " if (n > 2)v.push_back(n);", + " return v;", + "}" + ], + "description": "return all prime factors" + }, + "Sum of all divisors": { + "prefix": "divisorFunction", + "body": [ + "//return sum all divisors", + "int divisorFunction(int n)", + "{", + " int ans = 1;", + " int power = 0;", + " while (n % 2 == 0)power++, n /= 2;", + " //sum of GP", + " ans *= (pow(2, power + 1) - 1);", + " for (int i = 3; i * i <= n; i += 2) {", + " power = 0;", + " while (n % i == 0) {", + " power++;", + " n /= i;", + " }", + " ans *= (pow(i, power + 1) - 1) / (i - 1);", + " }", + " return ans;", + "}" + ], + "description": "sum of all divisors" + }, + "Return n!": { + "prefix": "nFactorial", + "body": [ + "//when n! <1e18 and you need raw", + "long long int nFactorial(int n)", + "{", + " long long int ans = 1;", + " for (int i = 2; i <= n; i++)ans *= i;", + " return ans;", + "}" + ], + "description": "return n!" + }, + "Return n!%mod": { + "prefix": "nFactorialMOD", + "body": [ + "// n!%mod ,for ex mod=1e9+7", + "int nFactorialMOD(int n, int mod)", + "{", + " int ans = 1;", + " for (int i = 2; i <= n; i++)(ans *= i) %= mod;", + " return ans;", + "}" + ], + "description": "return n!%mod" + }, + "Next power of two": { + "prefix": "nextPowerOfTwo", + "body": [ + "int nextPowerOfTwo(int n)", + "{", + " //if n is power of two", + " if (n && (!n & (n - 1)))return n;", + " return 1 << ((int)ceil(log2(n)));", + "}" + ], + "description": "next power of two" + }, + "Prev power of two": { + "prefix": "prevPowerOfTwo", + "body": [ + "int prevPowerOfTwo(int n)", + "{", + " //if n is power of two", + " if (n && (!n & (n - 1)))return n;", + " return 1 << ((int)ceil(log2(n) - 1));", + "}" + ], + "description": "prev power of two" + }, + "x^y": { + "prefix": "xpowery", + "body": [ + "long long int xpowery(long long int x,long long int y) {", + " long long int res = 1;", + " /*", + " it depends sometimes on questions too,", + " whether pow(0,0) is 1 or 0", + " So change accordingly", + " */", + " if (x == 0)return 0LL;", + " while (y)", + " {", + " if (y & 1)res *= x;", + " y >>= 1;", + " x *= x;", + " }", + " return res;", + "}" + ], + "description": "x^y" + }, + "(x^y)%mod": { + "prefix": "xpoweryMOD", + "body": [ + "long long int xpoweryMOD(long long int x,long long int y, int mod)", + "{", + " long long int res = 1;", + " /*", + " it depends sometimes on questions too,", + " whether pow(0,0) is 1 or 0", + " So change accordingly", + " */", + " if (x == 0)return 0;", + " while (y)", + " {", + " if (y & 1)(res *= x) %= mod;", + " y >>= 1;", + " (x *= x) %= mod;", + " }", + " return res;", + "}" + ], + "description": "(x^y)%mod" + }, + "Sieve of eratosthenes": { + "prefix": "sieve", + "body": [ + "//return all primes b/w 1 to n", + "vector sieve(int n)", + "{", + " vector is(n + 1, true);", + " vector primes;", + " for (int i = 2; i * i <= n; i++) {", + " if (is[i]) {", + " for (int p = i * i; p <= n; p += i)is[p] = false;", + " }", + " }", + " for (int i = 2; i <= n; i++)", + " if (is[i])primes.push_back(i);", + " return primes;", + "}" + ], + "description": "sieve of eratosthenes" + }, + "LCM between two number": { + "prefix": "lcm", + "body": [ + "long long int gcd(long long int a, long long int b)", + "{", + " if (b == 0)", + " return a;", + " return gcd(b, a % b);", + "}", + "long long int lcm(int a, int b)", + "{", + " return (a / gcd(a, b)) * b;", + "}" + ], + "description": "Least Common Multiple" + }, + "Combinatorics": { + "prefix": "combinatorics", + "body": [ + "int SIZE = 2000005;", + "vector fact(SIZE, 1);", + "vector inv(SIZE, 1);", + "int inverse(int x, int y)", + "{", + " int res = 1;", + " while (y) {", + " if (y & 1)res = (1LL * res * x) % MOD;", + " y >>= 1;", + " x = (1LL * x * x) % MOD;", + " }", + " return res;", + "}", + "void initCombinatorics()", + "{", + " for (int i = 2; i < SIZE; i++) {", + " fact[i] = (1LL * fact[i - 1] * i) % MOD;", + " inv[i] = inverse(fact[i], MOD - 2);", + " }", + "}", + "int nCr(int n, int r)", + "{", + " int res = 1;", + " if (r > n)return 0;", + " res = (1LL * fact[n] * inv[r]) % MOD;", + " res = (1LL * res * inv[n - r]) % MOD;", + " return res;", + "}" + ], + "description": "Combinatorics" + } +} diff --git a/snippets/bst.json b/snippets/bst.json new file mode 100644 index 00000000000..28355913f0a --- /dev/null +++ b/snippets/bst.json @@ -0,0 +1,253 @@ +{ + "Insert in BST": { + "prefix": "insBst", + "body": [ + "Node *insertBST(Node *root, int val)", + "{", + " if (root == NULL)", + " {", + " return new Node(val);", + " }", + " if (val < root->data)", + " {", + " root->left = insertBST(root->left, val);", + " }", + " else", + " {", + " root->right = insertBST(root->right, val);", + " }", + " return root;", + "}" + ], + "description": "Insert in BST" + }, + "Delete in BST": { + "prefix": "delBst", + "body": [ + "Node *inorderSucc(Node *root)", + "{", + " Node *curr = root;", + " while (curr && curr->left != NULL)", + " {", + " curr = curr->left;", + " }", + " return curr;", + "}", + "Node *deleteInBST(Node *root, int key)", + "{", + " if (key < root->data)", + " {", + " root->left = deleteInBST(root->left, key);", + " }", + " else if (key > root->data)", + " {", + " root->right = deleteInBST(root->right, key);", + " }", + " else", + " {", + " if (root->left == NULL)", + " {", + " Node *temp = root->right;", + " free(root);", + " return temp;", + " }", + " else if (root->right == NULL)", + " {", + " Node *temp = root->left;", + " free(root);", + " return temp;", + " }", + " Node *temp = inorderSucc(root->right);", + " root->data = temp->data;", + " root->right = deleteInBST(root->right, temp->data);", + " }", + " return root;", + "}" + ], + "description": "Delete in BST" + }, + "Search in BST": { + "prefix": "searchBst", + "body": [ + "Node *searchInBST(Node *root, int key)", + "{", + " if (root == NULL)", + " {", + " return NULL;", + " }", + " if (root->data == key)", + " {", + " return root;", + " }", + " if (root->data > key)", + " {", + " return searchInBST(root->left, key);", + " }", + " return searchInBST(root->right, key);", + "}" + ], + "description": "Search in BST" + }, + "Construct BST": { + "prefix": "constructBst", + "body": [ + "Node *constructBST(int preorder[], int *preorderIdx, int key, int min, int max, int n)", + "{", + " if (*preorderIdx >= n)", + " {", + " return NULL;", + " }", + " Node *root = NULL;", + " if (key > min && key < max)", + " {", + " root = new Node(key);", + " *preorderIdx = *preorderIdx + 1;", + " if (*preorderIdx < n)", + " {", + " root->left = constructBST(preorder, preorderIdx, preorder[*preorderIdx], min, key, n);", + " }", + " if (*preorderIdx < n)", + " {", + " root->right = constructBST(preorder, preorderIdx, preorder[*preorderIdx], key, max, n);", + " }", + " }", + " return root;", + "}" + ], + "description": "Construct BST" + }, + "Check the given tree is BST or not": { + "prefix": "isBst", + "body": [ + "bool isBST(Node *root, Node *min = NULL, Node *max = NULL)", + "{", + " if (root == NULL)", + " {", + " return true;", + " }", + " if (min != NULL && root->data <= min->data)", + " {", + " return false;", + " }", + " if (max != NULL && root->data >= max->data)", + " {", + " return false;", + " }", + " bool leftValid = isBST(root->left, min, root);", + " bool rightValid = isBST(root->right, root, max);", + "", + " return leftValid and rightValid;", + "}" + ], + "description": "Check the given tree is BST or not" + }, + "Sorted array to Bst": { + "prefix": "sortArrToBst", + "body": [ + "Node *sortedArrToBST(int a[], int start, int end)", + "{", + " if (start > end)", + " {", + " return NULL;", + " }", + "", + " int mid = (start + end) / 2;", + " Node *root = new Node(a[mid]);", + "", + " root->left = sortedArrToBST(a, start, mid - 1);", + " root->right = sortedArrToBST(a, mid + 1, end);", + "", + " return root;", + "}" + ], + "description": "Sorted array to Bst" + }, + "Is Bst identical or nor": { + "prefix": "isIdentical", + "body": [ + "bool isIdentical(Node *root1, Node *root2)", + "{", + " if (root1 == NULL && root2 == NULL)", + " {", + " return true;", + " }", + " else if (root1 == NULL || root2 == NULL)", + " {", + " return false;", + " }", + " else", + " {", + " bool c1 = root1->data == root2->data;", + " bool c2 = isIdentical(root1->left, root2->left);", + " bool c3 = isIdentical(root1->right, root2->right);", + "", + " if (c1 && c2 && c3)", + " {", + " return true;", + " }", + " else", + " {", + " return false;", + " }", + " }", + "}" + ], + "description": "Is Bst identical or nor" + }, + "zigzagTraversal Bst": { + "prefix": "zigzagTraversal", + "body": [ + "void zigzagTraversal(Node *root)", + "{", + " if (root == NULL)", + " {", + " return;", + " }", + " stack currLevel;", + " stack nextLevel;", + "", + " bool leftToRight = true;", + "", + " currLevel.push(root);", + " while (!currLevel.empty())", + " {", + " Node *temp = currLevel.top();", + " currLevel.pop();", + "", + " if (temp)", + " {", + " cout << temp->data << \" \";", + " if (leftToRight)", + " {", + " if (temp->left)", + " {", + " nextLevel.push(temp->left);", + " }", + " if (temp->right)", + " {", + " nextLevel.push(temp->right);", + " }", + " }", + " else", + " {", + " if (temp->right)", + " {", + " nextLevel.push(temp->right);", + " }", + " if (temp->left)", + " {", + " nextLevel.push(temp->left);", + " }", + " }", + " }", + " if (currLevel.empty())", + " {", + " leftToRight = !leftToRight;", + " swap(currLevel, nextLevel);", + " }", + " }", + "}" + ], + "description": "zigzagTraversal Bst" + } +} diff --git a/snippets/commonLang.json b/snippets/commonLang.json new file mode 100644 index 00000000000..5fb1d095aa8 --- /dev/null +++ b/snippets/commonLang.json @@ -0,0 +1,42 @@ +{ + "For loop with n": { + "prefix": "forn", + "body": ["for(int i=0;i(std::cout, \" \"));", + " " + ], + "description": "cout << vec" + }, + "Greatest Common Divisor": { + "prefix": "gcd", + "body": [ + "int gcd(int a, int b)", + "{", + " if (b == 0)", + " return a;", + " return gcd(b, a % b);", + " ", + "}" + ], + "description": "GCD using Euclidean Algorithm" + } } diff --git a/snippets/fmod.json b/snippets/fmod.json new file mode 100644 index 00000000000..8d59f445a67 --- /dev/null +++ b/snippets/fmod.json @@ -0,0 +1,16 @@ +{ + "cslDebugGroup": { + "prefix": "csld", + "body": [ + "cslDebugGroup((\"MPC\", 50, \"MPC%d:%d: \\n\", GPCid, TPCid));" + ], + "description": "iterator class" + }, + "cslAssertMsg": { + "prefix": "csla", + "body": [ + "cslAssertMsg( (), (\"\\n\", sm_mask));" + ], + "description": "iterator class" + } +} diff --git a/snippets/graph.json b/snippets/graph.json new file mode 100644 index 00000000000..69704764a2a --- /dev/null +++ b/snippets/graph.json @@ -0,0 +1,520 @@ +{ + "Adjacency Matrix in Graph": { + "prefix": "adjMatrix", + "body": [ + "void adjMatrix()", + "{", + " int n, m;", + " cin >> n >> m;", + " int adj[n + 1][n + 1];", + " for (int i = 0; i <= n; i++)", + " {", + " for (int j = 0; j <= n; j++)", + " {", + " adj[i][j] = 0;", + " }", + " }", + " for (int i = 0; i < m; i++)", + " {", + " int u, v;", + " cin >> u >> v;", + " adj[u][v] = 1;", + " adj[v][u] = 1;", + " }", + " for (int i = 0; i <= n; i++)", + " {", + " for (int j = 0; j <= n; j++)", + " {", + " cout << adj[i][j] << \" \";", + " }", + " cout << endl;", + " }", + "}" + ], + "description": "Adjacency Matrix in Graph" + }, + "Adjacency List in Graph": { + "prefix": "adjList", + "body": [ + "void adjList()", + "{", + " int n, m;", + " cin >> n >> m;", + " vector> adj(n);", + " for (int i = 0; i < m; i++)", + " {", + " int u, v;", + " cin >> u >> v;", + " adj[u].pb(v);", + " adj[v].pb(u);", + " }", + " for (int i = 0; i < adj.size(); i++)", + " {", + " cout << i << \"->\";", + " for (auto x : adj[i])", + " {", + " cout << x << \" \";", + " }", + " cout << endl;", + " }", + "}" + ], + "description": "Adjacency List in Graph" + }, + "BFS in Graph": { + "prefix": "bfs", + "body": [ + "void BFS()", + "{", + " int n, m;", + " cin >> n >> m;", + " vector vis(n + 1, false);", + " vector> adj(n + 1);", + " for (int i = 0; i < m; i++)", + " {", + " int u, v;", + " cin >> u >> v;", + " adj[u].pb(v);", + " adj[v].pb(u);", + " }", + " queue q;", + " for (int i = 0; i < n; i++)", + " {", + " if (!vis[i])", + " {", + "", + " q.push(i);", + " vis[i] = true;", + " while (!q.empty())", + " {", + " int node = q.front();", + "", + " q.pop();", + " cout << node << \" \";", + " for (auto x : adj[node])", + " {", + " if (!vis[x])", + " {", + " vis[x] = true;", + " q.push(x);", + " }", + " }", + " }", + " }", + " }", + "}" + ], + "description": "BFS in Graph" + }, + "DFS in Graph": { + "prefix": "dfs", + "body": [ + "void dfs(int node, vector> adj, vector &vis)", + "{", + " vis[node] = true;", + " cout << node << \" \";", + " for (auto x : adj[node])", + " {", + " if (vis[x])", + " {", + " ;", + " }", + " else", + " {", + " dfs(x, adj, vis);", + " }", + " }", + "}", + "void DFS()", + "{", + " int n, m;", + " cin >> n >> m;", + " vector vis(n + 1, false);", + " vector> adj(n + 1);", + " for (int i = 0; i < m; i++)", + " {", + " int u, v;", + " cin >> u >> v;", + " adj[u].pb(v);", + " adj[v].pb(u);", + " }", + "", + " for (int i = 0; i < n; i++)", + " {", + " if (!vis[i])", + " {", + "", + " dfs(i, adj, vis);", + " }", + " }", + "}" + ], + "description": "DFS in Graph" + }, + "Topological BFS in Graph": { + "prefix": "topoBfs", + "body": [ + "void TopoBFS()", + "{", + " int n, m;", + " cin >> n >> m;", + " vector> adj(n);", + " vector indeg(n, 0);", + " for (int i = 0; i < m; i++)", + " {", + " int u, v;", + " cin >> u >> v;", + " adj[u].pb(v);", + " indeg[v]++;", + " }", + " queue q;", + " for (int i = 0; i < indeg.size(); i++)", + " {", + " if (indeg[i] == 0)", + " {", + " q.push(i);", + " }", + " }", + "", + " while (!q.empty())", + " {", + " int node = q.front();", + "", + " q.pop();", + " cout << node << \" \";", + " for (auto x : adj[node])", + " {", + " indeg[x]--;", + " if (indeg[x] == 0)", + " {", + " q.push(x);", + " }", + " }", + " }", + "}" + ], + "description": "Topological BFS in Graph" + }, + "Topological DFS in Graph": { + "prefix": "topoDfs", + "body": [ + "void Topodfs(int node, vector> adj, vector &vis, stack &st)", + "{", + " vis[node] = true;", + " for (auto x : adj[node])", + " {", + " if (vis[x])", + " {", + " ;", + " }", + " else", + " {", + " Topodfs(x, adj, vis, st);", + " }", + " }", + " st.push(node);", + "}", + "void TopoDFS()", + "{", + " int n, m;", + " cin >> n >> m;", + " vector vis(n + 1, false);", + " vector> adj(n + 1);", + " for (int i = 0; i < m; i++)", + " {", + " int u, v;", + " cin >> u >> v;", + " adj[u].pb(v);", + " }", + " stack st;", + " for (int i = 0; i < n; i++)", + " {", + " if (!vis[i])", + " {", + "", + " Topodfs(i, adj, vis, st);", + " }", + " }", + " while (!st.empty())", + " {", + " int ans = st.top();", + " cout << ans << \" \";", + " st.pop();", + " }", + "}" + ], + "description": "Topological DFS in Graph" + }, + "Is Cycle is Present in Graph using DFS": { + "prefix": "isCycleDfs", + "body": [ + "bool isCycle(int s, vector> &adj, vector &vis, int parent)", + "{", + " vis[s] = true;", + " for (auto x : adj[s])", + " {", + " if (x != parent)", + " {", + " if (vis[x])", + " {", + " return true;", + " }", + " if (!vis[x] && isCycle(x, adj, vis, s))", + " {", + " return true;", + " }", + " }", + " }", + " return false;", + "}", + "void CycleDFS()", + "{", + " int n, m;", + " cin >> n >> m;", + " vector vis(n, false);", + " vector> adj(n);", + " for (int i = 0; i < m; i++)", + " {", + " int u, v;", + " cin >> u >> v;", + " adj[u].pb(v);", + " }", + "", + " for (int i = 0; i < n; i++)", + " {", + " if (!vis[i] && isCycle(i, adj, vis, -1))", + " {", + "", + " cout << true << endl;", + " return;", + " }", + " }", + " cout << false << endl;", + "}" + ], + "description": "Is Cycle is Present in Graph using DFS" + }, + "Is Cycle is Present in Graph using BFS": { + "prefix": "isCycleBfs", + "body": [ + "void CycleBFS()", + "{", + " int n, m;", + " cin >> n >> m;", + " vector> adj(n);", + " vector indeg(n, 0);", + " for (int i = 0; i < m; i++)", + " {", + " int u, v;", + " cin >> u >> v;", + " adj[u].pb(v);", + " indeg[v]++;", + " }", + " queue q;", + " for (int i = 0; i < indeg.size(); i++)", + " {", + " if (indeg[i] == 0)", + " {", + " q.push(i);", + " }", + " }", + " int count = 0;", + " while (!q.empty())", + " {", + " int node = q.front();", + "", + " q.pop();", + " for (auto x : adj[node])", + " {", + " indeg[x]--;", + " if (indeg[x] == 0)", + " {", + " q.push(x);", + " }", + " }", + " }", + " if (count != n)", + " {", + " cout << true << endl;", + " }", + " else", + " {", + " cout << false << endl;", + " }", + "}" + ], + "description": "Is Cycle is Present in Graph using BFS" + }, + "Shortest Path Direct Acyclic Graph": { + "prefix": "shortesPathDAG", + "body": [ + "void TopodfsDAG(int node, vector> adj[], vector &vis, stack &st)", + "{", + " vis[node] = true;", + " for (auto x : adj[node])", + " {", + " if (!vis[x.first])", + " {", + " TopodfsDAG(x.first, adj, vis, st);", + " }", + " }", + " st.push(node);", + "}", + "void shortesPathDAG()", + "{", + " int n, m;", + " cin >> n >> m;", + " vector vis(n + 1, false);", + " vector> adj[n];", + " for (int i = 0; i < m; i++)", + " {", + " int u, v, w;", + " cin >> u >> v >> w;", + " adj[u].pb({v, w});", + " }", + " int src;", + " cin >> src;", + " stack st;", + " for (int i = 0; i < n; i++)", + " {", + " if (!vis[i])", + " {", + "", + " TopodfsDAG(i, adj, vis, st);", + " }", + " }", + " int dist[n];", + " for (int i = 0; i < n; i++)", + " {", + " dist[i] = INT_MAX;", + " }", + " dist[src] = 0;", + " while (!st.empty())", + " {", + " int node = st.top();", + " st.pop();", + " if (dist[node] != INT_MAX)", + " {", + " for (auto x : adj[node])", + " {", + " if (dist[x.first] > dist[node] + x.second)", + " {", + " dist[x.first] = dist[node] + x.second;", + " }", + " }", + " }", + " }", + " for (int i = 0; i < n; i++)", + " (dist[i] == INT_MAX) ? cout << \"INFINITY \" : cout << dist[i] << \" \";", + "}" + ], + "description": "Shortest Path Direct Acyclic Graph" + }, + "Dijsktra Algorithm": { + "prefix": "dijsktra", + "body": [ + "void dijsktra()", + "{", + " int n, m, source;", + " cin >> n >> m;", + " vector> g[n + 1];", + "", + " int a, b, wt;", + " for (int i = 0; i < m; i++)", + " {", + " cin >> a >> b >> wt;", + " g[a].push_back(make_pair(b, wt));", + " g[b].push_back(make_pair(a, wt));", + " }", + " cin >> source;", + "", + " priority_queue, vector>, greater>> pq;", + " vector disTo(n + 1, INT_MAX);", + "", + " disTo[source] = 0;", + "", + " pq.push(make_pair(0, source));", + "", + " while (!pq.empty())", + " {", + " int dist = pq.top().first;", + " int prev = pq.top().second;", + " pq.pop();", + "", + " vector>::iterator it;", + "", + " for (it = g[prev].begin(); it != g[prev].end(); it++)", + " {", + " int next = it->first;", + " int nextDist = it->second;", + "", + " if (disTo[next] > disTo[prev] + nextDist)", + " {", + " disTo[next] = disTo[prev] + nextDist;", + " pq.push(make_pair(disTo[next], next));", + " }", + " }", + " }", + " cout << \"The distances from source, \" << source << \", are : \" << endl;", + " for (int i = 1; i <= n; i++)", + " {", + " cout << disTo[i] << \" \";", + " }", + " cout << endl;", + "}" + ], + "description": "Dijsktra Algorithm" + }, + "BellmanFord Algorithm": { + "prefix": "bellmanFord", + "body": [ + "void bellmanFord()", + "{", + " int N, m;", + " cin >> N >> m;", + " vector edges;", + " for (int i = 0; i < m; i++)", + " {", + " int u, v, wt;", + " cin >> u >> v >> wt;", + " edges.push_back(node(u, v, wt));", + " }", + " int src;", + " cin >> src;", + "", + " int inf = 1e9;", + " vector dist(N, inf);", + " dist[src] = 0;", + "", + " for (int i = 0; i <= N - 1; i++)", + " {", + " for (auto it : edges)", + " {", + " if (dist[it.u] + it.wt < dist[it.v])", + " {", + " dist[it.v] = dist[it.u] + it.wt;", + " }", + " }", + " }", + " int fl = 0;", + " for (auto it : edges)", + " {", + " if (dist[it.u] + it.wt < dist[it.v])", + " {", + " cout << \"NegativeCycle\" << endl;", + " fl = 1;", + " break;", + " }", + " }", + " if (!fl)", + " {", + " for (int i = 0; i < N; i++)", + " {", + " cout << i << \" \" << dist[i] << endl;", + " }", + " }", + "}" + ], + "description": "BellmanFord Algorithm" + } +} diff --git a/snippets/input.json b/snippets/input.json new file mode 100644 index 00000000000..907f991272a --- /dev/null +++ b/snippets/input.json @@ -0,0 +1,50 @@ +{ + "Taking input in n size int array": { + "prefix": "inai", + "body": [ + "int n;", + " cin>>n;", + " int a[n];", + " for(int i=0;i>a[i];", + " }" + ], + "description": "Taking input in n size int array" + }, + "Taking input in n size long long int array": { + "prefix": "inal", + "body": [ + "long long int n;", + " cin>>n;", + " long long int a[n];", + " for(long long int i=0;i>a[i];", + " }" + ], + "description": "Taking input in n size long long int array" + }, + "Taking input in n size int vector": { + "prefix": "invi", + "body": [ + "int n;", + " cin>>n;", + " vector v(n)", + " for(int i=0;i>v[i];", + " }" + ], + "description": "Taking input in n size int array" + }, + "Taking input in n size long long int vector": { + "prefix": "invl", + "body": [ + "long long int n;", + " cin>>n;", + " vector v(n);", + " for(long long int i=0;i>v[i];", + " }" + ], + "description": "Taking input in n size long long int vector" + } +} diff --git a/snippets/kickstart.json b/snippets/kickstart.json new file mode 100644 index 00000000000..16c4e0f05ca --- /dev/null +++ b/snippets/kickstart.json @@ -0,0 +1,45 @@ +{ + "Google KickStart C++ Template": { + "prefix": "kickstart", + "body": [ + "#include ", + "using namespace std;", + "#define int long long int", + "#define ll long long", + "#define endl \"\\n\"", + "#define tc \\", + " int t; \\", + " cin >> t; \\", + " while (t--)", + "#define pb push_back", + "#define mp make_pair", + "#define pii pair", + "", + "void fastio()", + "{", + " ios_base::sync_with_stdio(0);", + " cin.tie(0);", + " cout.tie(0);", + "}", + "void solve()", + "{", + "}", + "signed main()", + "{", + "", + " fastio();", + " int t;", + " cin >> t;", + " for (int case_i = 1; case_i <= t; case_i++)", + " {", + "", + " cout << \"Case #\" << case_i << \": \";", + " solve();", + " }", + "", + " return 0;", + "}" + ], + "description": "Google KickStart C++ Template" + } +} diff --git a/snippets/searching.json b/snippets/searching.json new file mode 100644 index 00000000000..69b027503f1 --- /dev/null +++ b/snippets/searching.json @@ -0,0 +1,42 @@ +{ + "Binary Search ": { + "prefix": "bsearch", + "body": [ + "int binarySearch(int a[], int l, int r, int x)", + "{", + " if (r >= l)", + " {", + " int mid = l + (r - l) / 2;", + "", + " if (a[mid] == x)", + " {", + " return mid;", + " }", + "", + " if (a[mid] > x)", + " {", + " return binarySearch(a, l, mid - 1, x);", + " }", + " return binarySearch(a, mid + 1, r, x);", + " }", + " return -1;", + "}", + "int main()", + "{", + " int n;", + " cin >> n;", + " int a[n];", + " for (int i = 0; i < n; i++)", + " {", + " cin >> a[i];", + " }", + " int x;", + " cin >> x;", + " cout << binarySearch(a, 0, n - 1, x);", + "", + " return 0;", + "}" + ], + "description": "Binary Search" + } +} diff --git a/snippets/sorting.json b/snippets/sorting.json new file mode 100644 index 00000000000..77abc34f026 --- /dev/null +++ b/snippets/sorting.json @@ -0,0 +1,310 @@ +{ + "Insertion Sort ": { + "prefix": "insort", + "body": [ + "void swap(int *xp, int *yp)", + "{", + " int temp = *xp;", + " *xp = *yp;", + " *yp = temp;", + "}", + "", + "void insertionSort(int a[], int n)", + "{", + " int key;", + " for (int i = 1; i < n; i++)", + " {", + " key = a[i];", + " int j = i - 1;", + " while (j >= 0 && a[j] > key)", + " {", + " a[j + 1] = a[j];", + " j--;", + " }", + " a[j + 1] = key;", + " }", + "}", + "//int main()", + "//{", + " int n;", + " cin >> n;", + " int a[n];", + " for (int i = 0; i < n; i++)", + " {", + " cin >> a[i];", + " }", + " insertionSort(a, n);", + " for (int i = 0; i < n; i++)", + " {", + " cout << a[i] << \" \";", + " }", + "//return 0;", + "//}" + ], + "description": "Insertion Sort " + }, + "Bubble Sort ": { + "prefix": "bubsort", + "body": [ + "void swap(int *xp, int *yp)", + "{", + " int temp = *xp;", + " *xp = *yp;", + " *yp = temp;", + "}", + "", + "void recurBubbleSort(int arr[], int n)", + "{", + " // Base case", + " if (n == 1)", + " return;", + "", + " // One pass of bubble sort. After", + " // this pass, the largest element", + " // is moved (or bubbled) to end.", + " for (int i = 0; i < n - 1; i++)", + " if (arr[i] > arr[i + 1])", + " swap(arr[i], arr[i + 1]);", + "", + " // Largest element is fixed,", + " // recur for remaining array", + " bubbleSort(arr, n - 1);", + "}", + "", + "void bubbleSort(int a[], int n)", + "{", + " for (int i = 0; i < n - 1; i++)", + " {", + " bool flag = false;", + " for (int j = 0; j < n - i - 1; j++)", + " {", + " if (a[j] > a[j + 1])", + " {", + " swap(&a[j], &a[j + 1]);", + " flag = true;", + " }", + " }", + " if (flag == false)", + " {", + " break;", + " }", + " }", + "}", + "int main()", + "{", + " int n;", + " cin >> n;", + " int a[n];", + " for (int i = 0; i < n; i++)", + " {", + " cin >> a[i];", + " }", + " bubbleSort(a, n);", + " for (int i = 0; i < n; i++)", + " {", + " cout << a[i] << \" \";", + " }", + " return 0;", + "}" + ], + "description": "Bubble Sort " + }, + "Selection Sort ": { + "prefix": "selsort", + "body": [ + "void swap(int *xp, int *yp)", + "{", + " int temp = *xp;", + " *xp = *yp;", + " *yp = temp;", + "}", + "", + "void selectionSort(int a[], int n)", + "{", + " int min_idx;", + " for (int i = 0; i < n - 1; i++)", + " {", + " min_idx = i;", + " for (int j = i + 1; j < n; j++)", + " {", + " if (a[min_idx] > a[j])", + " {", + " min_idx = j;", + " }", + " }", + " swap(&a[min_idx], &a[i]);", + " }", + "}", + "int main()", + "{", + " int n;", + " cin >> n;", + " int a[n];", + " for (int i = 0; i < n; i++)", + " {", + " cin >> a[i];", + " }", + " selectionSort(a, n);", + " for (int i = 0; i < n; i++)", + " {", + " cout << a[i] << \" \";", + " }", + " return 0;", + "}" + ], + "description": "Selection Sort " + }, + "Merge Sort ": { + "prefix": "mersort", + "body": [ + "void swap(int *xp, int *yp)", + "{", + " int temp = *xp;", + " *xp = *yp;", + " *yp = temp;", + "}", + "void merge(int array[], int const left, int const mid, int const right)", + "{", + " auto const subArrayOne = mid - left + 1;", + " auto const subArrayTwo = right - mid;", + "", + " // Create temp arrays", + " auto *leftArray = new int[subArrayOne],", + " *rightArray = new int[subArrayTwo];", + "", + " // Copy data to temp arrays leftArray[] and rightArray[]", + " for (auto i = 0; i < subArrayOne; i++)", + " leftArray[i] = array[left + i];", + " for (auto j = 0; j < subArrayTwo; j++)", + " rightArray[j] = array[mid + 1 + j];", + "", + " auto indexOfSubArrayOne = 0, // Initial index of first sub-array", + " indexOfSubArrayTwo = 0; // Initial index of second sub-array", + " int indexOfMergedArray = left; // Initial index of merged array", + "", + " // Merge the temp arrays back into array[left..right]", + " while (indexOfSubArrayOne < subArrayOne && indexOfSubArrayTwo < subArrayTwo)", + " {", + " if (leftArray[indexOfSubArrayOne] <= rightArray[indexOfSubArrayTwo])", + " {", + " array[indexOfMergedArray] = leftArray[indexOfSubArrayOne];", + " indexOfSubArrayOne++;", + " }", + " else", + " {", + " array[indexOfMergedArray] = rightArray[indexOfSubArrayTwo];", + " indexOfSubArrayTwo++;", + " }", + " indexOfMergedArray++;", + " }", + " // Copy the remaining elements of", + " // left[], if there are any", + " while (indexOfSubArrayOne < subArrayOne)", + " {", + " array[indexOfMergedArray] = leftArray[indexOfSubArrayOne];", + " indexOfSubArrayOne++;", + " indexOfMergedArray++;", + " }", + " // Copy the remaining elements of", + " // right[], if there are any", + " while (indexOfSubArrayTwo < subArrayTwo)", + " {", + " array[indexOfMergedArray] = rightArray[indexOfSubArrayTwo];", + " indexOfSubArrayTwo++;", + " indexOfMergedArray++;", + " }", + "}", + "", + "// begin is for left index and end is", + "// right index of the sub-array", + "// of arr to be sorted */", + "void mergeSort(int array[], int const begin, int const end)", + "{", + " if (begin >= end)", + " return; // Returns recursively", + "", + " auto mid = begin + (end - begin) / 2;", + " mergeSort(array, begin, mid);", + " mergeSort(array, mid + 1, end);", + " merge(array, begin, mid, end);", + "}", + "int main()", + "{", + " int n;", + " cin >> n;", + " int a[n];", + " for (int i = 0; i < n; i++)", + " {", + " cin >> a[i];", + " }", + " mergeSort(a, 0, n - 1);", + " for (int i = 0; i < n; i++)", + " {", + " cout << a[i] << \" \";", + " }", + " return 0;", + "}" + ], + "description": "Merge Sort " + }, + "Quick Sort ": { + "prefix": "qsort", + "body": [ + "void swap(int *xp, int *yp)", + "{", + " int temp = *xp;", + " *xp = *yp;", + " *yp = temp;", + "}", + "int partition(int a[], int l, int h)", + "{", + " int i = l;", + " int j = h;", + " int pivot = a[l];", + " while (i < j)", + " {", + " do", + " {", + " i++;", + " } while (a[i] <= pivot);", + " do", + " {", + " j--;", + " } while (a[j] > pivot);", + " if (i < j)", + " {", + " swap(&a[i], &a[j]);", + " }", + " }", + " swap(&a[l], &a[j]);", + " return j;", + "}", + "void quickSort(int a[], int l, int h)", + "{", + " if (l < h)", + " {", + " int pi = partition(a, l, h);", + " quickSort(a, l, pi);", + " quickSort(a, pi + 1, h);", + " }", + "}", + "int main()", + "{", + " int n;", + " cin >> n;", + " int a[n];", + " for (int i = 0; i < n; i++)", + " {", + " cin >> a[i];", + " }", + " quickSort(a, 0, n - 1);", + " for (int i = 0; i < n; i++)", + " {", + " cout << a[i] << \" \";", + " }", + " return 0;", + "}" + ], + "description": "Quick Sort " + } +} diff --git a/snippets/starters.json b/snippets/starters.json new file mode 100644 index 00000000000..80f739e89bb --- /dev/null +++ b/snippets/starters.json @@ -0,0 +1,84 @@ +{ + "CP Starter Template": { + "prefix": "cpp", + "body": [ + "#include ", + "using namespace std;", + "#define ll long long", + "#define endl '\\n'", + "#define tc \\", + " ll tc; \\", + " cin >> tc; \\", + " while (tc--)", + "#define pb push_back", + "#define mp make_pair", + "const ll MOD = 1e9 + 7;", + "", + "void fastio()", + "{", + " ios_base::sync_with_stdio(0);", + " cin.tie(0);", + " cout.tie(0);", + "}", + "", + "void solve()", + "{${1:cursor}", + "}", + "", + "int main()", + "{", + " fastio();", + " ll t;", + " cin >> t;", + " for (ll i = 1; i <= t; i++)", + " {", + " solve();", + " }", + "", + " return 0;", + "}" + ], + "description": "Creates Basic CPP Starter Template" + }, + "C++ Starter Template": { + "prefix": "c++", + "body": [ + "#include ", + "using namespace std;", + "", + "int main()", + "{ ", + " return 0;", + "}" + ], + "description": "Creates Simple C++ Starter Template" + }, + "DSA Specific Starter Template": { + "prefix": "dsa", + "body": [ + "#include ", + "using namespace std;", + "class Solution", + "{", + " public:", + " void solve(){", + " }", + " ", + "};", + "int main()", + "{ ", + " return 0;", + "}" + ], + "description": "Create Basic DSA Starter Template" + }, + "Fast Input Output": { + "prefix": "fastio", + "body": [ + "ios_base::sync_with_stdio(0);", + " cin.tie(0);", + " cout.tie(0);" + ], + "description": "Fast Input Output" + } +} diff --git a/snippets/strings.json b/snippets/strings.json new file mode 100644 index 00000000000..2e7a5f4f8cc --- /dev/null +++ b/snippets/strings.json @@ -0,0 +1,228 @@ +{ + "palindrome-String ": { + "prefix": "palindrome", + "body": [ + "bool ispalindrome(string s)", + "{", + " int n=s.size();", + " for(int i=0;i='a' && s[i]<='z') ", + " f[s[i]-97]++;", + " else", + " if(s[i]>='A' && s[i]<='Z') ", + " f[s[i]-65]++;", + " }", + " for(int i=0;i<26;i++)", + " if(f[i]==0) return 0;", + " return 1;", + "}" + ], + "description": "pangram-string" + }, + "anagram-strings": { + "prefix": "anagram", + "body": [ + "bool isanagram(string a, string b)", + "{", + " if(a.size()!=b.size()) return 0;", + " int f[26]={0}; ", + " for(int i=0;i='a' && a[i]<='z') ", + " f[a[i]-97]++;", + " else", + " if(a[i]>='A' && a[i]<='Z') ", + " f[a[i]-65]++;", + " }", + " for(int i=0;i='a' && b[i]<='z') ", + " f[b[i]-97]--;", + " else", + " if(b[i]>='A' && b[i]<='Z') ", + " f[b[i]-65]--;", + " }", + " for(int i=0;i<26;i++)", + " if(f[i]!=0) return 0;", + " return 1;", + "}" + ], + "description": "anagram-strings" + }, + "string->decimal": { + "prefix": "strtodec", + "body": [ + "long long int string_to_decimal(string s)", + " {", + " long long int ans = 0, p = 1;", + " for (int i = s.size() - 1; i >= 0; i--)", + " {", + " ans += p * (s[i] - '0');", + " p = p * 10;", + " }", + " return ans;", + " }" + ], + "description": "string->decimal" + }, + "decimal->string": { + "prefix": "dectostr", + "body": [ + "string decimal_to_string(long long int n)", + " {", + " if (n == 0)", + " return 0;", + " string ans = \"\";", + " while (n > 0)", + " {", + " ans = ans + (char)((n % 10) + 48);", + " n = n / 10;", + " }", + " reverse(ans.begin(), ans.end());", + " return ans;", + " }" + ], + "description": "decimal->string" + }, + "occurences of pattern in a string ": { + "prefix": "kmp", + "body": [ + "vector kmp(string s,string t) //returns the indices of occurences of pattern t in string s", + "{", + " if(s.size()ans;", + " i=0;j=0;", + " while (i=0 && j>=0)", + " {", + " if (a[i] == b[j])", + " {", + " ans+=a[i]; ", + " i--; j--;", + " }", + " else if (dp[i-1][j] > dp[i][j-1]) i--;", + " else j--;", + " }", + " reverse(ans.begin(),ans.end());", + " return ans;", + "}" + ], + "description": "longest common subsequence of two strings" + }, + "longest common substring of two strings": { + "prefix": "lc_substring", + "body": [ + "string lc_substring(string a,string b)", + "{", + " string ans=\"\";", + " int n=a.size(),m=b.size(),i,j;", + " if(n==0 || m==0) return \"\" ;", + " int dp[n][m];", + " dp[0][0]= a[0]==b[0]?1:0;", + " for(i=1;ileft);", + " cout << temp->data << ' ';", + " inOrder(temp->right);", + " }", + "}" + ], + "description": "Tree Inorder" + }, + "Tree Preorder": { + "prefix": "preorder", + "body": [ + "void preOrder(Node *temp)", + "{", + " if (temp != NULL)", + " {", + " cout << temp->data << ' ';", + " preOrder(temp->left);", + " preOrder(temp->right);", + " }", + "}" + ], + "description": "Tree Preorder" + }, + "Tree Postorder": { + "prefix": "postorder", + "body": [ + "int c = 0;", + "void postOrder(Node *temp)", + "{", + " if (temp != NULL)", + " {", + " postOrder(temp->left);", + " postOrder(temp->right);", + " cout << temp->data << ' ';", + " if (temp->right == NULL && temp->left == NULL)", + " {", + " c++;", + " }", + " }", + "}" + ], + "description": "Tree Postorder" + }, + "Level Order Traversal Tree": { + "prefix": "levelOrder", + "body": [ + "void levelOrder(Node *root)", + "{", + " if (root == NULL)", + " {", + " return;", + " }", + " queue q;", + "", + " q.push(root);", + " q.push(NULL);", + "", + " while (!q.empty())", + " {", + " Node *node = q.front();", + " q.pop();", + "", + " if (node != NULL)", + " {", + " cout << node->data << \" \";", + " if (node->left)", + " {", + " q.push(node->left);", + " }", + " if (node->right)", + " {", + " q.push(node->right);", + " }", + " }", + " else if (!q.empty())", + " {", + " q.push(NULL);", + " }", + " }", + "}" + ], + "description": "Level Order Traversal Tree" + }, + "Tree Size": { + "prefix": "treeSize", + "body": [ + "int getSize(Node *root)", + "{", + " if (root == NULL)", + " {", + " return 0;", + " }", + " return 1 + getSize(root->left) + getSize(root->right);", + "}" + ], + "description": "Tree Size" + }, + "Tree Height": { + "prefix": "treeHeight", + "body": [ + "int height(Node *root)", + "{", + " if (root == NULL)", + " {", + " return 0;", + " }", + " return max(height(root->left), height(root->right)) + 1;", + "}" + ], + "description": "Tree Height" + }, + "Tree Simple Diameter": { + "prefix": "treeDiaSimple", + "body": [ + "int diameter(Node *root)", + "{", + " if (root == NULL)", + " {", + " return 0;", + " }", + "", + " int currDiameter = height(root->left) + height(root->right) + 1;", + "", + " int lD = diameter(root->left);", + " int rD = diameter(root->right);", + "", + " return max(currDiameter, max(lD, rD));", + "}" + ], + "description": "Tree Simple Diameter" + }, + "Tree Optimized Diameter": { + "prefix": "treeDiaOpt", + "body": [ + "int optDiameter(Node *root, int *ht)", + "{", + " if (root == NULL)", + " {", + " *ht = 0;", + " return 0;", + " }", + "", + " int lh = 0, rh = 0;", + "", + " int lD = optDiameter(root->left, &lh);", + " int rD = optDiameter(root->right, &rh);", + " int currDiameter = lh + rh + 1;", + " *ht = max(lh, rh) + 1;", + "", + " return max(currDiameter, max(lD, rD));", + "}" + ], + "description": "Tree Optimized Diameter" + }, + "Tree Node Sum": { + "prefix": "treeSum", + "body": [ + "int getSum(Node *root)", + "{", + " if (root == NULL)", + " {", + " return 0;", + " }", + " return getSum(root->left) + getSum(root->right) + root->data;", + "}" + ], + "description": "Tree Node Sum" + }, + "Tree Node Maximum": { + "prefix": "treeMax", + "body": [ + "int MAX(Node *root)", + "{", + " if (root == NULL)", + " {", + " return INT_MIN;", + " }", + "", + " return max(root->data, max(MAX(root->left), MAX(root->right)));", + "}" + ], + "description": "Tree Node Maximum" + }, + "Tree Right View": { + "prefix": "treeRightView", + "body": [ + "void rightView(Node *root)", + "{", + " if (root == NULL)", + " {", + " return;", + " }", + " queue q;", + " q.push(root);", + "", + " while (!q.empty())", + " {", + " int n = q.size();", + " for (int i = 0; i < n; i++)", + " {", + " Node *curr = q.front();", + " q.pop();", + "", + " if (i == n - 1)", + " {", + " cout << curr->data << \" \";", + " }", + " if (curr->left != NULL)", + " {", + " q.push(curr->left);", + " }", + " if (curr->right != NULL)", + " {", + " q.push(curr->right);", + " }", + " }", + " }", + "}" + ], + "description": "Tree Right View" + }, + "Tree Left View": { + "prefix": "treeLeftView", + "body": [ + "void leftView(Node *root)", + "{", + " if (root == NULL)", + " {", + " return;", + " }", + " queue q;", + " q.push(root);", + "", + " while (!q.empty())", + " {", + " int n = q.size();", + " for (int i = 1; i <= n; i++)", + " {", + " Node *curr = q.front();", + " q.pop();", + "", + " if (i == 1)", + " {", + " cout << curr->data << \" \";", + " }", + " if (curr->left != NULL)", + " {", + " q.push(curr->left);", + " }", + " if (curr->right != NULL)", + " {", + " q.push(curr->right);", + " }", + " }", + " }", + "}" + ], + "description": "Tree Left View" + }, + "Tree Balanced or Not Simple": { + "prefix": "isBalancedSimple", + "body": [ + "bool isBalanced(Node *root)", + "{", + " if (root == NULL)", + " {", + " return true;", + " }", + " if (isBalanced(root->left) == false)", + " {", + " return false;", + " }", + " if (isBalanced(root->right) == false)", + " {", + " return false;", + " }", + " if (abs(height(root->left) - height(root->right)) <= 1)", + " {", + " return true;", + " }", + " else", + " {", + " return false;", + " }", + "}" + ], + "description": "Tree Balanced or Not Simple" + }, + "Tree Balanced or Not Optimized": { + "prefix": "isBalancedOpt", + "body": [ + "bool isOptBalanced(Node *root, int *ht)", + "{", + " if (root == NULL)", + " {", + " return true;", + " }", + " int lh = 0, rh = 0;", + " if (isOptBalanced(root->left, &lh) == false)", + " {", + " return false;", + " }", + " if (isOptBalanced(root->right, &rh) == false)", + " {", + " return false;", + " }", + " *ht = max(lh, rh) + 1;", + " if (abs(lh - rh) <= 1)", + " {", + " return true;", + " }", + " else", + " {", + " return false;", + " }", + "}" + ], + "description": "Tree Balanced or Not Optimized" + }, + "Flatten Binary Tree": { + "prefix": "flatten", + "body": [ + "void flatten(Node *root)", + "{", + " if (root == NULL || (root->left == NULL || root->right == NULL))", + " {", + " return;", + " }", + "", + " if (root->left != NULL)", + " {", + " flatten(root->left);", + "", + " Node *temp = root->right;", + " root->right = root->left;", + " root->left = NULL;", + "", + " Node *t = root->right;", + "", + " while (t->right != NULL)", + " {", + " t = t->right;", + " }", + " t->right = temp;", + " }", + " flatten(root->right);", + "}" + ], + "description": "Flatten Binary Tree" + } +} From 55bafed43d704439f763e2ad74c777fb0aad0d8d Mon Sep 17 00:00:00 2001 From: ysjin Date: Mon, 30 Sep 2024 11:49:48 -0700 Subject: [PATCH 5/8] Update README.md --- README.md | 324 +----------------------------------------------------- 1 file changed, 1 insertion(+), 323 deletions(-) diff --git a/README.md b/README.md index 7440ef54712..a85df66aeaa 100644 --- a/README.md +++ b/README.md @@ -1,323 +1 @@ -# kickstart.nvim - -## Introduction - -A starting point for Neovim that is: - -* Small -* Single-file -* Completely Documented - -**NOT** a Neovim distribution, but instead a starting point for your configuration. - -## Installation - -### Install Neovim - -Kickstart.nvim targets *only* the latest -['stable'](https://github.com/neovim/neovim/releases/tag/stable) and latest -['nightly'](https://github.com/neovim/neovim/releases/tag/nightly) of Neovim. -If you are experiencing issues, please make sure you have at least the latest -stable version. Most likely, you want to install neovim via a [package -manager](https://github.com/neovim/neovim/blob/master/INSTALL.md#install-from-package). -To check your neovim version, run `nvim --version` and make sure it is not -below the latest -['stable'](https://github.com/neovim/neovim/releases/tag/stable) version. If -your chosen install method only gives you an outdated version of neovim, find -alternative [installation methods below](#alternative-neovim-installation-methods). - -### Install External Dependencies - -External Requirements: -- Basic utils: `git`, `make`, `unzip`, C Compiler (`gcc`) -- [ripgrep](https://github.com/BurntSushi/ripgrep#installation), - [fd-find](https://github.com/sharkdp/fd#installation) -- [tree-sitter CLI](https://github.com/tree-sitter/tree-sitter/blob/master/crates/cli/README.md#installation) -- Clipboard tool (xclip/xsel/win32yank or other depending on the platform) -- A [Nerd Font](https://www.nerdfonts.com/): optional, provides various icons - - if you have it set `vim.g.have_nerd_font` in `init.lua` to true -- Emoji fonts (Ubuntu only, and only if you want emoji!) `sudo apt install fonts-noto-color-emoji` -- Language Setup: - - If you want to write Typescript, you need `npm` - - If you want to write Golang, you will need `go` - - etc. - -> [!NOTE] -> See [Install Recipes](#Install-Recipes) for additional Windows and Linux specific notes -> and quick install snippets - -### Install Kickstart - -> [!NOTE] -> [Backup](#FAQ) your previous configuration (if any exists) - -Neovim's configurations are located under the following paths, depending on your OS: - -| OS | PATH | -| :- | :--- | -| Linux, MacOS | `$XDG_CONFIG_HOME/nvim`, `~/.config/nvim` | -| Windows (cmd)| `%localappdata%\nvim\` | -| Windows (powershell)| `$env:LOCALAPPDATA\nvim\` | - -#### Recommended Step - -[Fork](https://docs.github.com/en/get-started/quickstart/fork-a-repo) this repo -so that you have your own copy that you can modify, then install by cloning the -fork to your machine using one of the commands below, depending on your OS. - -> [!NOTE] -> Your fork's URL will be something like this: -> `https://github.com//kickstart.nvim.git` - -You likely want to remove `lazy-lock.json` from your fork's `.gitignore` file -too - it's ignored in the kickstart repo to make maintenance easier, but it's -[recommended to track it in version control](https://lazy.folke.io/usage/lockfile). - -#### Clone kickstart.nvim - -> [!NOTE] -> If following the recommended step above (i.e., forking the repo), replace -> `nvim-lua` with `` in the commands below - -
Linux and Mac - -```sh -git clone https://github.com/nvim-lua/kickstart.nvim.git "${XDG_CONFIG_HOME:-$HOME/.config}"/nvim -``` - -
- -
Windows - -If you're using `cmd.exe`: - -``` -git clone https://github.com/nvim-lua/kickstart.nvim.git "%localappdata%\nvim" -``` - -If you're using `powershell.exe` - -``` -git clone https://github.com/nvim-lua/kickstart.nvim.git "${env:LOCALAPPDATA}\nvim" -``` - -
- -### Post Installation - -Start Neovim - -```sh -nvim -``` - -That's it! Lazy will install all the plugins you have. Use `:Lazy` to view -the current plugin status. Hit `q` to close the window. - -#### Read The Friendly Documentation - -Read through the `init.lua` file in your configuration folder for more -information about extending and exploring Neovim. That also includes -examples of adding popularly requested plugins. - -> [!NOTE] -> For more information about a particular plugin check its repository's documentation. - - -### Getting Started - -[The Only Video You Need to Get Started with Neovim](https://youtu.be/m8C0Cq9Uv9o) - -### FAQ - -* What should I do if I already have a pre-existing Neovim configuration? - * You should back it up and then delete all associated files. - * This includes your existing init.lua and the Neovim files in `~/.local` - which can be deleted with `rm -rf ~/.local/share/nvim/` -* Can I keep my existing configuration in parallel to kickstart? - * Yes! You can use [NVIM_APPNAME](https://neovim.io/doc/user/starting.html#%24NVIM_APPNAME)`=nvim-NAME` - to maintain multiple configurations. For example, you can install the kickstart - configuration in `~/.config/nvim-kickstart` and create an alias: - ``` - alias nvim-kickstart='NVIM_APPNAME="nvim-kickstart" nvim' - ``` - When you run Neovim using `nvim-kickstart` alias it will use the alternative - config directory and the matching local directory - `~/.local/share/nvim-kickstart`. You can apply this approach to any Neovim - distribution that you would like to try out. -* What if I want to "uninstall" this configuration: - * See [lazy.nvim uninstall](https://lazy.folke.io/usage#-uninstalling) information -* Why is the kickstart `init.lua` a single file? Wouldn't it make sense to split it into multiple files? - * The main purpose of kickstart is to serve as a teaching tool and a reference - configuration that someone can easily use to `git clone` as a basis for their own. - As you progress in learning Neovim and Lua, you might consider splitting `init.lua` - into smaller parts. A fork of kickstart that does this while maintaining the - same functionality is available here: - * [kickstart-modular.nvim](https://github.com/dam9000/kickstart-modular.nvim) - * Discussions on this topic can be found here: - * [Restructure the configuration](https://github.com/nvim-lua/kickstart.nvim/issues/218) - * [Reorganize init.lua into a multi-file setup](https://github.com/nvim-lua/kickstart.nvim/pull/473) - -### Install Recipes - -Below you can find OS specific install instructions for Neovim and dependencies. - -After installing all the dependencies continue with the [Install Kickstart](#install-kickstart) step. - -#### Windows Installation - -
Windows with Microsoft C++ Build Tools and CMake -Installation may require installing build tools and updating the run command for `telescope-fzf-native` - -See `telescope-fzf-native` documentation for [more details](https://github.com/nvim-telescope/telescope-fzf-native.nvim#installation) - -This requires: - -- Install CMake and the Microsoft C++ Build Tools on Windows - -```lua -{'nvim-telescope/telescope-fzf-native.nvim', build = 'cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=Release && cmake --build build --config Release && cmake --install build --prefix build' } -``` -
-
Windows with gcc/make using chocolatey -Alternatively, one can install gcc and make which don't require changing the config, -the easiest way is to use choco: - -1. install [chocolatey](https://chocolatey.org/install) -either follow the instructions on the page or use winget, -run in cmd as **admin**: -``` -winget install --accept-source-agreements chocolatey.chocolatey -``` - -2. install all requirements using choco, exit the previous cmd and -open a new one so that choco path is set, and run in cmd as **admin**: -``` -choco install -y neovim git ripgrep wget fd unzip gzip mingw make tree-sitter -``` -
-
WSL (Windows Subsystem for Linux) - -``` -wsl --install -wsl -sudo add-apt-repository ppa:neovim-ppa/unstable -y -sudo apt update -sudo apt install make gcc ripgrep fd-find tree-sitter-cli unzip git xclip neovim -``` -
- -#### Linux Install -
Ubuntu Install Steps - -``` -sudo add-apt-repository ppa:neovim-ppa/unstable -y -sudo apt update -sudo apt install make gcc ripgrep fd-find tree-sitter-cli unzip git xclip neovim -``` -
-
Debian Install Steps - -``` -sudo apt update -sudo apt install make gcc ripgrep fd-find tree-sitter-cli unzip git xclip curl - -# Now we install nvim -curl -LO https://github.com/neovim/neovim/releases/latest/download/nvim-linux-x86_64.tar.gz -sudo rm -rf /opt/nvim-linux-x86_64 -sudo mkdir -p /opt/nvim-linux-x86_64 -sudo chmod a+rX /opt/nvim-linux-x86_64 -sudo tar -C /opt -xzf nvim-linux-x86_64.tar.gz - -# make it available in /usr/local/bin, distro installs to /usr/bin -sudo ln -sf /opt/nvim-linux-x86_64/bin/nvim /usr/local/bin/ -``` -
-
Fedora Install Steps - -``` -sudo dnf install -y gcc make git ripgrep fd-find tree-sitter-cli unzip neovim -``` -
- -
Arch Install Steps - -``` -sudo pacman -S --noconfirm --needed gcc make git ripgrep fd tree-sitter-cli unzip neovim -``` -
- -### Alternative neovim installation methods - -For some systems it is not unexpected that the [package manager installation -method](https://github.com/neovim/neovim/blob/master/INSTALL.md#install-from-package) -recommended by neovim is significantly behind. If that is the case for you, -pick one of the following methods that are known to deliver fresh neovim versions very quickly. -They have been picked for their popularity and because they make installing and updating -neovim to the latest versions easy. You can also find more detail about the -available methods being discussed -[here](https://github.com/nvim-lua/kickstart.nvim/issues/1583). - - -
Bob - -[Bob](https://github.com/MordechaiHadad/bob) is a Neovim version manager for -all plattforms. Simply install -[rustup](https://rust-lang.github.io/rustup/installation/other.html), -and run the following commands: - -```bash -rustup default stable -rustup update stable -cargo install bob-nvim -bob use stable -``` - -
- -
Homebrew - -[Homebrew](https://brew.sh) is a package manager popular on Mac and Linux. -Simply install using [`brew install`](https://formulae.brew.sh/formula/neovim). - -
- -
Flatpak - -Flatpak is a package manager for applications that allows developers to package their applications -just once to make it available on all Linux systems. Simply [install flatpak](https://flatpak.org/setup/) -and setup [flathub](https://flathub.org/setup) to [install neovim](https://flathub.org/apps/io.neovim.nvim). - -
- -
asdf and mise-en-place - -[asdf](https://asdf-vm.com/) and [mise](https://mise.jdx.dev/) are tool version managers, -mostly aimed towards project-specific tool versioning. However both support managing tools -globally in the user-space as well: - -
mise - -[Install mise](https://mise.jdx.dev/getting-started.html), then run: - -```bash -mise plugins install neovim -mise use neovim@stable -``` - -
- -
asdf - -[Install asdf](https://asdf-vm.com/guide/getting-started.html), then run: - -```bash -asdf plugin add neovim -asdf install neovim stable -asdf set neovim stable --home -asdf reshim neovim -``` - -
- -
+# personal kickstart.nvim fork From f894a5d7f4dffb38c60a8cb632b65474dc3c5c31 Mon Sep 17 00:00:00 2001 From: Yongseok Jin Date: Fri, 11 Jul 2025 15:57:02 -0700 Subject: [PATCH 6/8] macos nvim config update --- init.lua | 2 ++ lua/custom/plugins/init.lua | 37 +++++++++++++++++++++++++++---------- 2 files changed, 29 insertions(+), 10 deletions(-) diff --git a/init.lua b/init.lua index a441552c8ec..021c24906d5 100644 --- a/init.lua +++ b/init.lua @@ -69,6 +69,8 @@ vim.o.timeoutlen = 300 vim.o.splitright = true vim.o.splitbelow = true +vim.opt.conceallevel = 1 + -- Sets how neovim will display certain whitespace characters in the editor. -- See `:help 'list'` -- and `:help 'listchars'` diff --git a/lua/custom/plugins/init.lua b/lua/custom/plugins/init.lua index edfacf04ab1..22bedb60127 100644 --- a/lua/custom/plugins/init.lua +++ b/lua/custom/plugins/init.lua @@ -41,14 +41,31 @@ return { -- restriction_mode = "hint", -- } --}, - { - "gbprod/substitute.nvim", - config = function() - vim.keymap.set("n", "s", require('substitute').operator, { noremap = true }) - vim.keymap.set("n", "ss", require('substitute').line, { noremap = true }) - vim.keymap.set("n", "S", require('substitute').eol, { noremap = true }) - vim.keymap.set("x", "s", require('substitute').visual, { noremap = true }) - end, - opts = {}, - }, + --{ + -- "gbprod/substitute.nvim", + -- config = function() + -- vim.keymap.set("n", "s", require('substitute').operator, { noremap = true }) + -- vim.keymap.set("n", "ss", require('substitute').line, { noremap = true }) + -- vim.keymap.set("n", "S", require('substitute').eol, { noremap = true }) + -- vim.keymap.set("x", "s", require('substitute').visual, { noremap = true }) + -- end, + -- opts = {} + -- }, + { + "epwalsh/obsidian.nvim", + version = "*", -- recommended, use latest release instead of latest commit + lazy = true, + ft = "markdown", + dependencies = { + "nvim-lua/plenary.nvim", + }, + opts = { + workspaces = { + { + name = "personal", + path = "~/wiki", + }, + }, + }, + }, } From 092e32f01ce0077cc845ba8dfa5744e28c294a2c Mon Sep 17 00:00:00 2001 From: Yongseok Jin Date: Mon, 9 Mar 2026 19:48:07 -0700 Subject: [PATCH 7/8] update init.lua --- init.lua | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/init.lua b/init.lua index 021c24906d5..f87c2b4d1eb 100644 --- a/init.lua +++ b/init.lua @@ -319,6 +319,7 @@ require('lazy').setup({ -- instead of just disabling it here, to keep your config clean. enabled = true, event = 'VimEnter', + cond = not vim.g.vscode, dependencies = { 'nvim-lua/plenary.nvim', { -- If encountering errors, see telescope-fzf-native README for installation instructions @@ -856,6 +857,11 @@ require('lazy').setup({ end, }, + { + 'MeanderingProgrammer/render-markdown.nvim', + ft = { 'markdown', 'quarto' }, + }, + -- Highlight todo, notes, etc in comments { 'folke/todo-comments.nvim', From 8d331389d0c8a7bd195871d531313cdaa3363fac Mon Sep 17 00:00:00 2001 From: Yongseok Jin Date: Tue, 31 Mar 2026 08:53:47 -0700 Subject: [PATCH 8/8] update init.lua --- init.lua | 104 ++++++++++++++++++------------------------------------- 1 file changed, 33 insertions(+), 71 deletions(-) diff --git a/init.lua b/init.lua index f87c2b4d1eb..3204b897ffe 100644 --- a/init.lua +++ b/init.lua @@ -24,10 +24,10 @@ vim.o.mouse = 'a' -- Don't show the mode, since it's already in the status line vim.o.showmode = false -vim.opt.tags = "./tags,../tags,../../tags,../../../tags,../../../../tags,../../../../../tags,../../../../../../tags,../../../../../../../tags" +vim.opt.tags = './tags,../tags,../../tags,../../../tags,../../../../tags,../../../../../tags,../../../../../../tags,../../../../../../../tags' vim.opt.backup = true -local home_backup_path = os.getenv('HOME') .. '/.backup' +local home_backup_path = os.getenv 'HOME' .. '/.backup' vim.opt.backupdir = home_backup_path vim.opt.errorbells = false @@ -97,10 +97,10 @@ vim.o.scrolloff = 10 vim.o.confirm = true vim.opt.foldlevel = 5 -vim.opt.foldmethod = "expr" -vim.opt.foldexpr = "nvim_treesitter#foldexpr()" +vim.opt.foldmethod = 'expr' +vim.opt.foldexpr = 'nvim_treesitter#foldexpr()' -vim.opt.diffopt="internal,filler,closeoff,iwhite,linematch:60" +vim.opt.diffopt = 'internal,filler,closeoff,iwhite,linematch:60' -- [[ Basic Keymaps ]] -- See `:help vim.keymap.set()` @@ -170,19 +170,14 @@ vim.api.nvim_create_autocmd('TextYankPost', { }) vim.api.nvim_create_autocmd('BufReadPost', { - pattern = { '*' }, - desc = 'When editing a file, always jump to the last known cursor position', - callback = function() - local line = vim.fn.line '\'"' - if - line >= 1 - and line <= vim.fn.line '$' - and vim.bo.filetype ~= 'commit' - and vim.fn.index({ 'xxd', 'gitrebase' }, vim.bo.filetype) == -1 - then - vim.cmd 'normal! g`"' - end - end, + pattern = { '*' }, + desc = 'When editing a file, always jump to the last known cursor position', + callback = function() + local line = vim.fn.line '\'"' + if line >= 1 and line <= vim.fn.line '$' and vim.bo.filetype ~= 'commit' and vim.fn.index({ 'xxd', 'gitrebase' }, vim.bo.filetype) == -1 then + vim.cmd 'normal! g`"' + end + end, }) --vim.api.nvim_set_hl(0, '@lsp.type.comment.cpp', {}) @@ -251,8 +246,8 @@ require('lazy').setup({ }, { - "folke/flash.nvim", - event = "VeryLazy", + 'folke/flash.nvim', + event = 'VeryLazy', -- @type Flash.Config opts = {}, -- stylua: ignore @@ -375,19 +370,17 @@ require('lazy').setup({ -- }, --}, pickers = { - find_files = { - find_command = { "rg", "--files", "-g", "!**/**Linux_x86_64/**", "-g", "!compile_commands.json"}, - }, - live_grep = { - additional_args = {"-w", "-g", "!**/**Linux_x86_64/**"}, - }, - grep_string = { - additional_args = {"-w", "-g", "!**/**Linux_x86_64/**"}, - }, + find_files = { + find_command = { 'rg', '--files', '-g', '!**/**Linux_x86_64/**', '-g', '!compile_commands.json' }, + }, + live_grep = { + additional_args = { '-w', '-g', '!**/**Linux_x86_64/**' }, + }, + grep_string = { + additional_args = { '-w', '-g', '!**/**Linux_x86_64/**' }, + }, }, - cond = function (lang, bufnr) - return lang == "cpp" and vim.api.nvim_buf_line_count(bufnr) < 10000 - end, + cond = function(lang, bufnr) return lang == 'cpp' and vim.api.nvim_buf_line_count(bufnr) < 10000 end, extensions = { ['ui-select'] = { require('telescope.themes').get_dropdown() }, }, @@ -410,8 +403,8 @@ require('lazy').setup({ vim.keymap.set('n', 's.', builtin.oldfiles, { desc = '[S]earch Recent Files ("." for repeat)' }) vim.keymap.set('n', 'sc', builtin.commands, { desc = '[S]earch [C]ommands' }) vim.keymap.set('n', '', builtin.buffers, { desc = '[ ] Find existing buffers' }) - vim.keymap.set("n", "", " Telescope grep_string", {desc="Telescope Grep String"}) - vim.keymap.set("n", "", " Telescope find_files", {desc="Telescope Files"}) + vim.keymap.set('n', '', ' Telescope grep_string', { desc = 'Telescope Grep String' }) + vim.keymap.set('n', '', ' Telescope find_files', { desc = 'Telescope Files' }) -- This runs on LSP attach per buffer (see main LSP attach function in 'neovim/nvim-lspconfig' config for more info, -- it is better explained there). This allows easily switching between pickers if you prefer using something else! @@ -479,7 +472,7 @@ require('lazy').setup({ { -- Main LSP Configuration 'neovim/nvim-lspconfig', - ft = {"lua", "cpp", "python"}, + ft = { 'lua', 'python' }, dependencies = { -- Automatically install LSPs and related tools to stdpath for Neovim -- Mason must be loaded before its dependents so we need to set it up here. @@ -600,37 +593,6 @@ require('lazy').setup({ -- See `:help lsp-config` for information about keys and how to configure ---@type table local servers = { - clangd = { - mason = true, - cmd = {'/home/utils/llvm-17.0.6/bin/clangd', - "--background-index", - "--clang-tidy", - "--header-insertion=never", - "--j=2"}, - init_options = { - clangdFileStatus = true, - inlayHints= { - enabled = true, - parameterNames = true, - autoDeducedTypes = true, -- Enable auto type hints - typeHints = true, - typeNameLimit = 24, - lambdaReturnType = true, - blockEnd = true, - designators = true, - }, - }, - filetypes = {"cpp"}, - single_file_support = true, - capabilities = capabilities, - --on_attach = on_attach, - --root_dir = function() - -- return vim.fn.getcwd() - --end - root_dir = function(fname) - return require('lspconfig/util').root_pattern( unpack({'compile_commands.json'}))(fname) - end - }, -- gopls = {}, pyright = {}, -- rust_analyzer = {}, @@ -745,7 +707,7 @@ require('lazy').setup({ 'L3MON4D3/LuaSnip', version = '2.*', build = (function() - CC={"/home/utils/gcc-14.1.0/bin/gcc"} + CC = { '/home/utils/gcc-14.1.0/bin/gcc' } -- Build Step is needed for regex support in snippets. -- This step is not supported in many windows environments. -- Remove the below condition to re-enable on windows. @@ -759,8 +721,8 @@ require('lazy').setup({ { 'rafamadriz/friendly-snippets', config = function() - require('luasnip.loaders.from_vscode').lazy_load({ include={"cpp", "python", "lua"} }) - require('luasnip.loaders.from_vscode').lazy_load({ paths = vim.fn.stdpath("config").."/snippets/" }) + require('luasnip.loaders.from_vscode').lazy_load { include = { 'cpp', 'python', 'lua' } } + require('luasnip.loaders.from_vscode').lazy_load { paths = vim.fn.stdpath 'config' .. '/snippets/' } end, }, }, @@ -849,11 +811,11 @@ require('lazy').setup({ -- Load the colorscheme here. -- Like many other themes, this one has different styles, and you could load -- any other, such as 'tokyonight-storm', 'tokyonight-moon', or 'tokyonight-day'. - vim.cmd.colorscheme 'catppuccin-mocha' + vim.cmd.colorscheme 'tokyonight-night' -- You can configure highlights by doing something like: vim.cmd.hi 'Comment gui=none' - vim.api.nvim_set_hl(0, "LspInlayHint", {fg = "#9DA9A0", bg="#000000" }) + vim.api.nvim_set_hl(0, 'LspInlayHint', { fg = '#9DA9A0', bg = '#000000' }) end, },