From 8d219f59a1fa70fc36efc621564391329ad3e7a9 Mon Sep 17 00:00:00 2001 From: Code Lich Date: Thu, 13 Mar 2025 14:50:23 +0700 Subject: [PATCH] updated some plugins --- init.lua | 2 ++ lua/custom/init.lua | 12 ++++++++++++ lua/custom/plugins/alpha.lua | 12 ++++++++++++ lua/custom/plugins/bufferline.lua | 17 +++++++++++++++++ lua/custom/plugins/luasnip.lua | 10 ++++++++++ lua/custom/plugins/minipairs.lua | 9 +++++++++ lua/custom/plugins/minisurround.lua | 1 + lua/custom/snippets/edhliicpp.lua | 28 ++++++++++++++++++++++++++++ 8 files changed, 91 insertions(+) create mode 100644 lua/custom/init.lua create mode 100644 lua/custom/plugins/alpha.lua create mode 100644 lua/custom/plugins/bufferline.lua create mode 100644 lua/custom/plugins/luasnip.lua create mode 100644 lua/custom/plugins/minipairs.lua create mode 100644 lua/custom/plugins/minisurround.lua create mode 100644 lua/custom/snippets/edhliicpp.lua diff --git a/init.lua b/init.lua index 00b45e39..06945d7b 100644 --- a/init.lua +++ b/init.lua @@ -1020,5 +1020,7 @@ require('lazy').setup({ }, }) +require 'custom.init' + -- The line beneath this is called `modeline`. See `:help modeline` -- vim: ts=2 sts=2 sw=2 et diff --git a/lua/custom/init.lua b/lua/custom/init.lua new file mode 100644 index 00000000..9bd2dd03 --- /dev/null +++ b/lua/custom/init.lua @@ -0,0 +1,12 @@ +-- Load additional custom configurations +-- require("custom.keymaps") -- Custom keybindings +-- require("custom.plugins") -- Custom plugins +require 'custom.snippets.edhliicpp' -- Custom snippets + +-- Set some editor options +vim.opt.number = true +vim.opt.relativenumber = true +vim.opt.tabstop = 4 +vim.opt.shiftwidth = 4 + +-- print 'Custom Neovim setup loaded!' diff --git a/lua/custom/plugins/alpha.lua b/lua/custom/plugins/alpha.lua new file mode 100644 index 00000000..0a0b02ba --- /dev/null +++ b/lua/custom/plugins/alpha.lua @@ -0,0 +1,12 @@ +return { + 'goolord/alpha-nvim', + -- dependencies = { 'echasnovski/mini.icons' }, + dependencies = { 'nvim-tree/nvim-web-devicons' }, + config = function() + local startify = require 'alpha.themes.startify' + -- available: devicons, mini, default is mini + -- if provider not loaded and enabled is true, it will try to use another provider + startify.file_icons.provider = 'devicons' + require('alpha').setup(startify.config) + end, +} diff --git a/lua/custom/plugins/bufferline.lua b/lua/custom/plugins/bufferline.lua new file mode 100644 index 00000000..969762b8 --- /dev/null +++ b/lua/custom/plugins/bufferline.lua @@ -0,0 +1,17 @@ +return { + 'akinsho/bufferline.nvim', + dependencies = { 'nvim-tree/nvim-web-devicons' }, + config = function() + require('bufferline').setup { + options = { + diagnostics = 'nvim_lsp', + show_buffer_close_icons = true, + show_close_icon = true, + separator_style = 'slant', + }, + } + vim.keymap.set('n', '', ':BufferLineCycleNext', { silent = true }) + vim.keymap.set('n', '', ':BufferLineCyclePrev', { silent = true }) + vim.keymap.set('n', 'bd', ':bdelete', { silent = true }) + end, +} diff --git a/lua/custom/plugins/luasnip.lua b/lua/custom/plugins/luasnip.lua new file mode 100644 index 00000000..3cce2054 --- /dev/null +++ b/lua/custom/plugins/luasnip.lua @@ -0,0 +1,10 @@ +return { + { + 'L3MON4D3/LuaSnip', + version = 'v2.*', -- Latest version + dependencies = { 'rafamadriz/friendly-snippets' }, + config = function() + require('luasnip.loaders.from_vscode').lazy_load() + end, + }, +} diff --git a/lua/custom/plugins/minipairs.lua b/lua/custom/plugins/minipairs.lua new file mode 100644 index 00000000..4d28f043 --- /dev/null +++ b/lua/custom/plugins/minipairs.lua @@ -0,0 +1,9 @@ +return { + { + 'echasnovski/mini.pairs', + version = false, -- Use the latest version + config = function() + require('mini.pairs').setup() + end, + }, +} diff --git a/lua/custom/plugins/minisurround.lua b/lua/custom/plugins/minisurround.lua new file mode 100644 index 00000000..aa5e3be2 --- /dev/null +++ b/lua/custom/plugins/minisurround.lua @@ -0,0 +1 @@ +return { 'echasnovski/mini.surround', version = false } diff --git a/lua/custom/snippets/edhliicpp.lua b/lua/custom/snippets/edhliicpp.lua new file mode 100644 index 00000000..d423be38 --- /dev/null +++ b/lua/custom/snippets/edhliicpp.lua @@ -0,0 +1,28 @@ +-- print 'Custom C++ snippets loaded!' + +local ls = require 'luasnip' +local s = ls.snippet +local t = ls.text_node + +ls.add_snippets('cpp', { + s('cpptemplate', { + t { + '#include ', + '#define fi first', + '#define se second', + 'using namespace std;', + 'typedef long long ll;', + 'typedef unsigned long long ull;', + 'const int N = 1E6 + 3;', + 'const ll MOD = 1E9 + 7;', + '', + 'int main() {', + ' ios_base::sync_with_stdio(false);', + ' cin.tie(0);', + ' cout.tie(0);', + '', + ' cout << "edhlii\\n";', + '}', + }, + }), +})