From f8d08aec7a9d0adb15979249607185cee150e8d0 Mon Sep 17 00:00:00 2001 From: Raju Ghorai Date: Tue, 31 Oct 2023 18:35:58 +0530 Subject: [PATCH 01/23] =?UTF-8?q?=EE=9A=89=20Setup:=20mini=20config?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- init.lua | 3 +- lazy-lock.json | 57 +- lua/config/init.lua | 2 + lua/config/lazy.lua | 48 ++ lua/{core/init.lua => config/options.lua} | 7 +- lua/core/default_config.lua | 61 --- lua/plugin/config/autopairs.lua | 20 - lua/plugin/config/bqf.lua | 15 - lua/plugin/config/bufferline.lua | 56 -- lua/plugin/config/bufresize.lua | 23 - lua/plugin/config/colorscheme.lua | 127 ----- lua/plugin/config/dashboard.lua | 29 - lua/plugin/config/diffview.lua | 34 -- lua/plugin/config/gitsigns.lua | 70 --- lua/plugin/config/hop.lua | 56 -- lua/plugin/config/lastplace.lua | 23 - lua/plugin/config/legendary.lua | 150 ----- lua/plugin/config/lsp-signature.lua | 68 --- lua/plugin/config/lsp.lua | 243 -------- lua/plugin/config/manson-tool-installer.lua | 17 - lua/plugin/config/modes.lua | 24 - lua/plugin/config/neogit.lua | 15 - lua/plugin/config/notification.lua | 39 -- lua/plugin/config/nvimtree.lua | 71 --- lua/plugin/config/relativenumber.lua | 27 - lua/plugin/config/rest.lua | 37 -- lua/plugin/config/smartsplit.lua | 21 - lua/plugin/config/smoothcursor.lua | 18 - lua/plugin/config/statusline.lua | 142 ----- lua/plugin/config/treesitter.lua | 116 ---- lua/plugin/config/treesj.lua | 12 - lua/plugin/config/typescript-tools.lua | 195 ------- lua/plugin/config/ufo.lua | 62 --- lua/plugin/init.lua | 518 ------------------ lua/plugins/basic.lua | 37 ++ lua/plugins/cmp.lua | 31 ++ lua/plugins/lsp/lspconfig.lua | 166 ++++++ lua/plugins/lsp/mason.lua | 32 ++ lua/plugins/telescope.lua | 44 ++ lua/plugins/treesitter.lua | 162 ++++++ lua/{plugin/config => utils}/cmp.lua | 4 +- .../config => utils}/indent_blankline.lua | 1 + lua/{plugin/config => utils}/telescope.lua | 24 +- 43 files changed, 541 insertions(+), 2366 deletions(-) create mode 100644 lua/config/init.lua create mode 100644 lua/config/lazy.lua rename lua/{core/init.lua => config/options.lua} (93%) delete mode 100644 lua/core/default_config.lua delete mode 100644 lua/plugin/config/autopairs.lua delete mode 100644 lua/plugin/config/bqf.lua delete mode 100644 lua/plugin/config/bufferline.lua delete mode 100644 lua/plugin/config/bufresize.lua delete mode 100644 lua/plugin/config/colorscheme.lua delete mode 100644 lua/plugin/config/dashboard.lua delete mode 100644 lua/plugin/config/diffview.lua delete mode 100644 lua/plugin/config/gitsigns.lua delete mode 100644 lua/plugin/config/hop.lua delete mode 100644 lua/plugin/config/lastplace.lua delete mode 100644 lua/plugin/config/legendary.lua delete mode 100644 lua/plugin/config/lsp-signature.lua delete mode 100644 lua/plugin/config/lsp.lua delete mode 100644 lua/plugin/config/manson-tool-installer.lua delete mode 100644 lua/plugin/config/modes.lua delete mode 100644 lua/plugin/config/neogit.lua delete mode 100644 lua/plugin/config/notification.lua delete mode 100644 lua/plugin/config/nvimtree.lua delete mode 100644 lua/plugin/config/relativenumber.lua delete mode 100644 lua/plugin/config/rest.lua delete mode 100644 lua/plugin/config/smartsplit.lua delete mode 100644 lua/plugin/config/smoothcursor.lua delete mode 100644 lua/plugin/config/statusline.lua delete mode 100644 lua/plugin/config/treesitter.lua delete mode 100644 lua/plugin/config/treesj.lua delete mode 100644 lua/plugin/config/typescript-tools.lua delete mode 100644 lua/plugin/config/ufo.lua delete mode 100644 lua/plugin/init.lua create mode 100644 lua/plugins/basic.lua create mode 100644 lua/plugins/cmp.lua create mode 100644 lua/plugins/lsp/lspconfig.lua create mode 100644 lua/plugins/lsp/mason.lua create mode 100644 lua/plugins/telescope.lua create mode 100644 lua/plugins/treesitter.lua rename lua/{plugin/config => utils}/cmp.lua (99%) rename lua/{plugin/config => utils}/indent_blankline.lua (99%) rename lua/{plugin/config => utils}/telescope.lua (84%) diff --git a/init.lua b/init.lua index 46c126d..dbc863e 100644 --- a/init.lua +++ b/init.lua @@ -1,2 +1 @@ -require "core" -require "plugin" +require("config") diff --git a/lazy-lock.json b/lazy-lock.json index 160e1ee..71210a8 100644 --- a/lazy-lock.json +++ b/lazy-lock.json @@ -1,14 +1,8 @@ { "Comment.nvim": { "branch": "master", "commit": "0236521ea582747b58869cb72f70ccfa967d2e89" }, - "LuaSnip": { "branch": "master", "commit": "0df29db3543837f8b41597f2640397c5ec792b7b" }, - "SmoothCursor.nvim": { "branch": "main", "commit": "efe978cb59a752adbc5908aefde1de1d0e1fc87b" }, + "LuaSnip": { "branch": "master", "commit": "80a8528f084a97b624ae443a6f50ff8074ba486b" }, "agrolens.nvim": { "branch": "main", "commit": "a2f15094a2b7e7bc79184de8edc13034116d8d47" }, - "alpha-nvim": { "branch": "main", "commit": "234822140b265ec4ba3203e3e0be0e0bb826dff5" }, "auto-pairs": { "branch": "master", "commit": "39f06b873a8449af8ff6a3eee716d3da14d63a76" }, - "better-escape.nvim": { "branch": "master", "commit": "7031dc734add47bb71c010e0551829fa5799375f" }, - "bufferline.nvim": { "branch": "main", "commit": "243893ba9d5d1049dd451a25cab32ec7f8f67bcf" }, - "bufresize.nvim": { "branch": "master", "commit": "3b19527ab936d6910484dcc20fb59bdb12322d8b" }, - "catppuccin": { "branch": "main", "commit": "fc537040147f0374a22b88142a20eb6781141f0b" }, "cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" }, "cmp-nvim-lsp": { "branch": "main", "commit": "44b16d11215dce86f253ce0c30949813c0a90765" }, "cmp-nvim-lua": { "branch": "main", "commit": "f12408bdb54c39c23e67cab726264c10db33ada8" }, @@ -19,63 +13,36 @@ "cmp-treesitter": { "branch": "master", "commit": "b8bc760dfcc624edd5454f0982b63786a822eed9" }, "cmp-under-comparator": { "branch": "master", "commit": "6857f10272c3cfe930cece2afa2406e1385bfef8" }, "cmp_luasnip": { "branch": "master", "commit": "05a9ab28b53f71d1aece421ef32fee2cb857a843" }, - "dial.nvim": { "branch": "master", "commit": "019bbe9daea397c93a99adc747f8f071379fee5c" }, - "diffview.nvim": { "branch": "main", "commit": "d38c1b5266850f77f75e006bcc26213684e1e141" }, - "dressing.nvim": { "branch": "master", "commit": "1f2d1206a03bd3add8aedf6251e4534611de577f" }, "fidget.nvim": { "branch": "legacy", "commit": "90c22e47be057562ee9566bad313ad42d622c1d3" }, - "flash.nvim": { "branch": "main", "commit": "6d76c5dee65181ab55cbdfb0760260e800d643f4" }, + "flash.nvim": { "branch": "main", "commit": "48817af25f51c0590653bbc290866e4890fe1cbe" }, "friendly-snippets": { "branch": "main", "commit": "43727c2ff84240e55d4069ec3e6158d74cb534b6" }, - "gitsigns.nvim": { "branch": "main", "commit": "ff01d34daaed72f271a8ffa088a7e839a60c640f" }, - "guihua.lua": { "branch": "master", "commit": "5ad8dba19ce9b9fd8965598984dfdc9c119f97e4" }, "hlargs.nvim": { "branch": "main", "commit": "6218a401824c5733ac50b264991b62d064e85ab2" }, - "indent-blankline.nvim": { "branch": "master", "commit": "0fe34b4c1b926e106d105d3ae88ef6cbf6743572" }, - "iswap.nvim": { "branch": "master", "commit": "8b038cb10585713b4c3918d44d6c329effad2a5d" }, - "kanagawa.nvim": { "branch": "master", "commit": "c19b9023842697ec92caf72cd3599f7dd7be4456" }, - "lazy.nvim": { "branch": "main", "commit": "33c447b96e1cb1a5a2be87982d5d32bb5054079d" }, - "legendary.nvim": { "branch": "master", "commit": "be1de69822e6329ef5ae87521a70911c434aa9eb" }, - "lsp_lines.nvim": { "branch": "main", "commit": "9e3f99fbbd28aaec80dc0158c43be8cca8dd5017" }, - "lualine.nvim": { "branch": "master", "commit": "45e27ca739c7be6c49e5496d14fcf45a303c3a63" }, + "indent-blankline.nvim": { "branch": "master", "commit": "29be0919b91fb59eca9e90690d76014233392bef" }, + "iswap.nvim": { "branch": "master", "commit": "e05889db694524f68eb69567a70a98470994b890" }, + "lazy.nvim": { "branch": "main", "commit": "16603c6917435d8446f7357cb61095138a417085" }, "mason-lspconfig.nvim": { "branch": "main", "commit": "397273083f988c1a17acf3816947cd198338e700" }, + "mason-tool-installer.nvim": { "branch": "main", "commit": "e4f34741daa9cf95de68a603d3e7a6844a69fdf0" }, "mason.nvim": { "branch": "main", "commit": "cd7835b15f5a4204fc37e0aa739347472121a54c" }, - "modes.nvim": { "branch": "main", "commit": "9ca1d683e9505f6fdc97a884151267cfc380a379" }, "neoconf.nvim": { "branch": "main", "commit": "393d37abd9d82adcac627309a41758ae8e140d9e" }, "neodev.nvim": { "branch": "main", "commit": "a4b6e7ca11ff5be2264d5c169fcedd97d8699ec4" }, - "neogit": { "branch": "master", "commit": "d3fbf8b48f4f8bc406eb23f8b06eb912776f8cb0" }, - "neon": { "branch": "main", "commit": "7765aaa7d1cd3804176140644640766e4411c766" }, - "nightly": { "branch": "main", "commit": "fbab0f60e2d92d119f6e0cf50c503dcd7753659e" }, - "nvim-autopairs": { "branch": "master", "commit": "748e72c05495a3d30e88a6ef04b21697019a9aa9" }, - "nvim-bqf": { "branch": "main", "commit": "8784eebf34371049b641646d00232c2603215297" }, - "nvim-cmp": { "branch": "main", "commit": "5dce1b778b85c717f6614e3f4da45e9f19f54435" }, - "nvim-lastplace": { "branch": "main", "commit": "0bb6103c506315044872e0f84b1f736c4172bb20" }, + "nvim-cmp": { "branch": "main", "commit": "51260c02a8ffded8e16162dcf41a23ec90cfba62" }, "nvim-lsp-file-operations": { "branch": "master", "commit": "0ae13ac58136c6175638b6e1ba04cb487dd22272" }, "nvim-lspconfig": { "branch": "master", "commit": "61f984586fefa9869f07f3027e0dce5752412786" }, - "nvim-notify": { "branch": "master", "commit": "e4a2022f4fec2d5ebc79afa612f96d8b11c627b3" }, "nvim-tmux-navigation": { "branch": "main", "commit": "543f090a45cef28156162883d2412fffecb6b750" }, - "nvim-tree.lua": { "branch": "master", "commit": "53b0bcaadaffb505acff230578b56a86ec1ab38a" }, - "nvim-treesitter": { "branch": "master", "commit": "49f7194e4c4d3c9ed891b0968798c062e8ac5a3d" }, - "nvim-treesitter-textobjects": { "branch": "master", "commit": "76c7a89b41de77a4f83fb77fa072c5ad7605fe3b" }, + "nvim-treesitter": { "branch": "master", "commit": "efec7115d8175bdb6720eeb4e26196032cb52593" }, + "nvim-treesitter-textobjects": { "branch": "master", "commit": "e69a504baf2951d52e1f1fbb05145d43f236cbf1" }, "nvim-ts-autotag": { "branch": "main", "commit": "6be1192965df35f94b8ea6d323354f7dc7a557e4" }, - "nvim-ts-context-commentstring": { "branch": "main", "commit": "7241635869b7a8115893ffa67bab3907756caf4f" }, + "nvim-ts-context-commentstring": { "branch": "main", "commit": "92e688f013c69f90c9bbd596019ec10235bc51de" }, "nvim-ts-rainbow": { "branch": "master", "commit": "ef95c15a935f97c65a80e48e12fe72d49aacf9b9" }, "nvim-ts-rainbow2": { "branch": "master", "commit": "b3120cd5ae9ca524af9cb602f41e12e301fa985f" }, - "nvim-ufo": { "branch": "main", "commit": "f7eea53e88456403212df074b9aa3148a3908435" }, - "nvim-web-devicons": { "branch": "master", "commit": "a1e6268779411048a87f767a27380089362a0ce2" }, + "nvim-web-devicons": { "branch": "master", "commit": "5de460ca7595806044eced31e3c36c159a493857" }, + "oil.nvim": { "branch": "master", "commit": "05a80e24f6c920e29ed741d12ede0840e456a3e4" }, "plenary.nvim": { "branch": "master", "commit": "50012918b2fc8357b87cff2a7f7f0446e47da174" }, - "promise-async": { "branch": "main", "commit": "e94f35161b8c5d4a4ca3b6ff93dd073eb9214c0e" }, - "relative-toggle.nvim": { "branch": "main", "commit": "fabe2f60f5f148f2bf1fb76e8a542f5adf8d996a" }, - "rest.nvim": { "branch": "main", "commit": "5bcaa1012ea8efd6093c69d2a4c67fbde760d043" }, - "sad.nvim": { "branch": "master", "commit": "869c7f3ca3dcd28fd78023db6a7e1bf8af0f4714" }, "smart-pairs": { "branch": "master", "commit": "6e7a5a8e3906f7a8a8c5b8603d5264ff1b5d87c3" }, - "smart-splits.nvim": { "branch": "master", "commit": "dbf2c13bad1b75ab207639ba817a7e8a8a450042" }, - "sqlite.lua": { "branch": "master", "commit": "b7e28c8463254c46a8e61c52d27d6a2040492fc3" }, "telescope-fzf-native.nvim": { "branch": "main", "commit": "6c921ca12321edaa773e324ef64ea301a1d0da62" }, "telescope-symbols.nvim": { "branch": "master", "commit": "f2060117d965df4a626f068a4ebbd8ee051aa076" }, "telescope.nvim": { "branch": "master", "commit": "7011eaae0ac1afe036e30c95cf80200b8dc3f21a" }, - "tokyonight.nvim": { "branch": "main", "commit": "dce0ab49ae751f4f3617ab42d6f20c72369c7cb1" }, - "treesj": { "branch": "main", "commit": "81d0ae51b84143e228d27b6cf79d09012d2021cb" }, - "typescript-tools.nvim": { "branch": "master", "commit": "ebddb35900bbf5fa41fffa0463b676bf08e474e6" }, "vim-repeat": { "branch": "master", "commit": "24afe922e6a05891756ecf331f39a1f6743d3d5a" }, - "vim-sleuth": { "branch": "master", "commit": "1cc4557420f215d02c4d2645a748a816c220e99b" }, "vim-snippets": { "branch": "master", "commit": "ccc2fa1529d372f7ac16d5eb07a385a72b50e05d" }, "vim-surround": { "branch": "master", "commit": "3d188ed2113431cf8dac77be61b842acb64433d9" } } \ No newline at end of file diff --git a/lua/config/init.lua b/lua/config/init.lua new file mode 100644 index 0000000..74740c5 --- /dev/null +++ b/lua/config/init.lua @@ -0,0 +1,2 @@ +require("config.options") +require("config.lazy") diff --git a/lua/config/lazy.lua b/lua/config/lazy.lua new file mode 100644 index 0000000..d2aa059 --- /dev/null +++ b/lua/config/lazy.lua @@ -0,0 +1,48 @@ +local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" +if not vim.loop.fs_stat(lazypath) then + vim.fn.system({ + "git", + "clone", + "--filter=blob:none", + "https://github.com/folke/lazy.nvim.git", + "--branch=stable", + lazypath, + }) +end +vim.opt.rtp:prepend(vim.env.LAZY or lazypath) + +local opts = { + install = { + colorscheme = {}, + }, + checker = { + enabled = true, + notify = false, + }, + change_detection = { + notify = false, + }, +} + +require("lazy").setup({ + spec = { + { import = "plugins" }, + { import = "plugins.lsp" }, + }, + defaults = { + lazy = false, + version = false, + }, + checker = { enabled = true }, + performance = { + rtp = { + disabled_plugins = { + "gzip", + "tarPlugin", + "tohtml", + "tutor", + "zipPlugin", + }, + }, + }, +}, opts) diff --git a/lua/core/init.lua b/lua/config/options.lua similarity index 93% rename from lua/core/init.lua rename to lua/config/options.lua index 72e5026..1b47003 100644 --- a/lua/core/init.lua +++ b/lua/config/options.lua @@ -2,7 +2,9 @@ local opt = vim.opt local g = vim.g local o = vim.o +------------------------------- ------------ options ---------- +------------------------------- if vim.fn.has("nvim-0.9.0") == 1 then opt.splitkeep = 'screen' @@ -71,7 +73,6 @@ opt.updatetime = 200 -- Save swap file and trigger CursorHold opt.wildmode = "longest:full,full" -- Command-line completion mode opt.winminwidth = 5 -- Minimum window width opt.wrap = false -- Disable line wrap -opt.dictionary:append("~/.config/nvim/dictionary.txt") -- Numbers @@ -82,7 +83,3 @@ opt.ruler = false g.mapleader = " " g.maplocalleader = "\\" g.markdown_recommended_style = 0 - ------------- autocommand ---------- - -require('core.default_config').load_extra_options() diff --git a/lua/core/default_config.lua b/lua/core/default_config.lua deleted file mode 100644 index d118ed6..0000000 --- a/lua/core/default_config.lua +++ /dev/null @@ -1,61 +0,0 @@ -local M = {} -local set = vim.keymap.set -local keymap = vim.api.nvim_set_keymap -local opts = { noremap = true, silent = true } -local opts_s = { silent = true } -local opts_e_s = { expr = true, silent = true } - -M.options = { - kicknv_branch = "master", - name = "kickNV", - figlet_name = { - [[ __ .__ __ ___________ ____ ]], - [[ | | _|__| ____ | | __\ \ \ / / ]], - [[ | |/ / |/ ___\| |/ // | \ Y / ]], - [[ | <| \ \___| __|_ \____|__ /\___/ ]], - [[ \/ \/ \/ \/ ]], - } -} - -M.ui = { - theme_toggle = { - "nightly", - "tokyonight", - "kanagawa", - "catppuccin", - "neon" - }, - theme = "catppuccin", - transparency = true, -} - -M.opts = opts - -M.keymap = keymap -M.set = set - -M.keymaps = { - default = function() - set({ 'n', 'v' }, '', '', opts_s) - set('n', 'k', "v:count == 0 ? 'gk' : 'k'", opts_e_s) - set('n', 'j', "v:count == 0 ? 'gj' : 'j'", opts_e_s) - set("v", "<", "", ">gv") - end -} - - -function M.load_extra_options() - local function bind_extra_cmd(options) - for optionCount = 1, #options do vim.cmd(options[optionCount]) end - end - local options = { - "filetype plugin on", "filetype indent on", "cabbr Q q", "cabbr Q! q!", - "cabbr W! w!", "cabbr W w", "cabbr WA wa", "cabbr Wa wa", "cabbr Wq wq", - "cabbr WQ wq", "cabbr Qa qa", "cabbr QA qa" - } - bind_extra_cmd(options) -end - -return M diff --git a/lua/plugin/config/autopairs.lua b/lua/plugin/config/autopairs.lua deleted file mode 100644 index e202401..0000000 --- a/lua/plugin/config/autopairs.lua +++ /dev/null @@ -1,20 +0,0 @@ -local M = {} -local status, autopairs = pcall(require, "windwp/nvim-autopairs") - -function M.setup() - if (not status) then return end - autopairs.setup({ - check_ts = true, - ts_config = { - lua = { 'string' }, - javascript = { 'template_string' }, - java = false, - } - }) - - local cmp_autopairs = require('nvim-autopairs.completion.cmp') - local cmp = require('cmp') - cmp.event:on('confirm_done', cmp_autopairs.on_confirm_done({ map_char = { tex = '' } })) -end - -return M diff --git a/lua/plugin/config/bqf.lua b/lua/plugin/config/bqf.lua deleted file mode 100644 index 0e08058..0000000 --- a/lua/plugin/config/bqf.lua +++ /dev/null @@ -1,15 +0,0 @@ -local M = {} -local status, bqf = pcall(require, "bqf") - -function M.setup() - if (not status) then return end - - bqf.setup { - auto_resize_height = false, - preview = { - auto_preview = false, - }, - } -end - -return M diff --git a/lua/plugin/config/bufferline.lua b/lua/plugin/config/bufferline.lua deleted file mode 100644 index c76afc6..0000000 --- a/lua/plugin/config/bufferline.lua +++ /dev/null @@ -1,56 +0,0 @@ ----@diagnostic disable: missing-fields -local M = {} -local status, bufferline = pcall(require, "bufferline") -local opts = require("core.default_config").opts -local keymap = require("core.default_config").keymap - -function M.setup() - if (not status) then return end - - bufferline.setup { - options = { - offsets = { - { - filetype = "NvimTree", - text = " Explorer", - highlight = "Directory", - text_align = "left", - padding = 1 - }, - }, - left_trunc_marker = "", - right_trunc_marker = "", - number_style = "", - numbers = function(opts) - return string.format("%s", opts.ordinal) - end, - separator_style = { "|", "|" }, - insert_at_end = false, - insert_at_start = true, - close_icon = "", - modified_icon = "", - icon_pinned = "車", - semantic_letters = true, - show_buffer_close_icons = false, - show_tab_indicators = false, - always_show_bufferline = true, - max_name_length = 30, - max_prefix_length = 15, - tab_size = 20, - sort_by = "extension", - custom_filter = function(buf_number) - local name = vim.fn.bufname(buf_number) - if name ~= "" and not name:match("^term://") then - return true - ---@diagnostic disable-next-line: missing-return - end - end, - highlight = require("catppuccin.groups.integrations.bufferline").get(), - } - } - - keymap("n", "", ":BufferLineCycleNext", opts) - keymap("n", "", ":BufferLineCyclePrev", opts) -end - -return M diff --git a/lua/plugin/config/bufresize.lua b/lua/plugin/config/bufresize.lua deleted file mode 100644 index 6c36b18..0000000 --- a/lua/plugin/config/bufresize.lua +++ /dev/null @@ -1,23 +0,0 @@ -local M = {} -local opts = require("core.default_config").opts -local status, bufresize = pcall(require, "bufresize") - -function M.setup() - if (not status) then return end - bufresize.setup({ - register = { - keys = { - { "n", "=", "=", opts }, - { "n", "|", "|", opts }, - }, - trigger_events = { "BufWinEnter", "WinEnter" }, - }, - resize = { - keys = {}, - trigger_events = { "VimResized" }, - increment = false, - }, - }) -end - -return M diff --git a/lua/plugin/config/colorscheme.lua b/lua/plugin/config/colorscheme.lua deleted file mode 100644 index 40e6322..0000000 --- a/lua/plugin/config/colorscheme.lua +++ /dev/null @@ -1,127 +0,0 @@ -local M = {} -local ui = require("core.default_config").ui - - -function M.setup() - require('kanagawa').setup({ - compile = true, - commentStyle = { italic = true }, - functionStyle = { italic = true }, - keywordStyle = { italic = true }, - statementStyle = { bold = true }, - typeStyle = {}, - transparent = ui.transparency, - theme = "dragon", - colors = { - palette = {}, - theme = { - wave = {}, - lotus = {}, - dragon = {}, - all = { - ui = { - bg_gutter = "none" - } - } - }, - }, - overrides = function(colors) - local theme = colors.theme - return { - TelescopeTitle = { bold = true }, - TelescopePromptNormal = { bg = theme.ui.bg_p1, fg = "none" }, - TelescopePromptBorder = { fg = theme.ui.bg_p1, bg = "none" }, - TelescopeResultsNormal = { fg = theme.ui.fg_dim, bg = "none" }, - TelescopeResultsBorder = { fg = theme.ui.bg_m1, bg = "none" }, - TelescopePreviewNormal = { bg = theme.ui.bg_dim }, - -- TelescopePreviewBorder = { bg = theme.ui.bg_dim, fg = theme.ui.bg_dim }, - -- NormalFloat = { bg = "none" }, - LineNr = { bg = "none" }, - CursorLineNr = { bg = "none" }, - GitsignsAdd = { bg = "none" }, - GitSignsChange = { bg = "none" }, - GitsignsDelete = { bg = "none" }, - } - end, - background = { - dark = "dragon", - }, - }) - - require("tokyonight").setup({ - style = "moon", - light_style = "night", - transparent = ui.transparency, - terminal_colors = true, - styles = { - comments = { italic = true }, - keywords = { italic = true }, - functions = { italic = true }, - variables = { italic = true }, - sidebars = "dark", - floats = "dark", - }, - sidebars = { "qf", "help" }, - day_brightness = 0.3, - hide_inactive_statusline = true, - dim_inactive = true, - lualine_bold = true, - }) - - require("catppuccin").setup({ - flavour = "mocha", - background = { - dark = "mocha", - }, - transparent_background = ui.transparency, - show_end_of_buffer = false, - term_colors = true, - dim_inactive = { - enabled = false, - shade = "light", - percentage = 0.10, - }, - styles = { - comments = { "italic" }, - conditionals = { "italic" }, - loops = { "reverse" }, - functions = { "italic" }, - keywords = {}, - strings = {}, - variables = { "italic" }, - numbers = {}, - booleans = { "italic" }, - properties = {}, - types = {}, - operators = {}, - }, - integrations = { - cmp = true, - gitsigns = true, - nvimtree = true, - treesitter = true, - notify = true, - neogit = true, - treesitter_context = true, - ts_rainbow2 = true, - ts_rainbow = true, - telescope = { - enabled = true, - style = "nvchad", - }, - native_lsp = { - enabled = true, - underlines = { - errors = { "undercurl" }, - hints = { "undercurl" }, - warnings = { "undercurl" }, - information = { "undercurl" }, - }, - }, - }, - }) - - vim.cmd("colorscheme " .. ui.theme) -end - -return M diff --git a/lua/plugin/config/dashboard.lua b/lua/plugin/config/dashboard.lua deleted file mode 100644 index 4725c09..0000000 --- a/lua/plugin/config/dashboard.lua +++ /dev/null @@ -1,29 +0,0 @@ -local M = {} -local alpha = require('alpha') -local dashboard = require('alpha.themes.dashboard') - -function M.setup() - dashboard.section.header.val = require('core.default_config').options.figlet_name - - dashboard.section.buttons.val = { - dashboard.button("e", " New File", ":ene startinsert "), - dashboard.button("LDR ?", " Recently Opened Files", ":Telescope oldfiles"), - dashboard.button("LDR n", "📁 File Explorer", ":NvimTreeOpen"), - dashboard.button("LDR sf", "🔍 Search Files", ":Telescope find_files"), - dashboard.button("LDR sg", " Search Grep", ":Telescope live_grep"), - dashboard.button("LDR gb", " Git Branches", ":Telescope git_branches"), - dashboard.button("LDR gc", " Git Commits", ":Telescope git_commits"), - dashboard.button("LDR en", "📝 Neovim Edit", ":lua require('plugin.config.telescope').edit_neovim()"), - dashboard.button("q", " Quit NVIM", ":qa"), - } - - dashboard.section.footer.val = "Total plugins: " .. require("lazy").stats().count - dashboard.section.header.opts.hl = "Include" - dashboard.section.buttons.opts.hl = "Keyword" - dashboard.opts.opts.noautocmd = true - - - alpha.setup(dashboard.opts) -end - -return M diff --git a/lua/plugin/config/diffview.lua b/lua/plugin/config/diffview.lua deleted file mode 100644 index d807c04..0000000 --- a/lua/plugin/config/diffview.lua +++ /dev/null @@ -1,34 +0,0 @@ -local lib = require("diffview.lib") -local diffview = require("diffview") - -local M = {} - -M.toggle_file_history = function() - local view = lib.get_current_view() - if view == nil then ----@diagnostic disable-next-line: missing-parameter - diffview.file_history(); - return - end - - if view then - view:close() - lib.dispose_view(view) - end -end - -M.toggle_status = function() - local view = lib.get_current_view() - if view == nil then ----@diagnostic disable-next-line: missing-parameter - diffview.open(); - return - end - - if view then - view:close() - lib.dispose_view(view) - end -end - -return M diff --git a/lua/plugin/config/gitsigns.lua b/lua/plugin/config/gitsigns.lua deleted file mode 100644 index 35016f7..0000000 --- a/lua/plugin/config/gitsigns.lua +++ /dev/null @@ -1,70 +0,0 @@ -local M = {} -local status, gitsigns = pcall(require, 'gitsigns') -function M.setup() - if (not status) then return end - - gitsigns.setup { - signs = { - add = { - -- text = '+', - text = "▎", - hl = "GitSignsAdd", - numhl = "GitSignsAddNr", - linehl = "GitSignsAddLn", - }, - delete = { - -- text = "-", - text = "_", - hl = "GitSignsDelete", - numhl = "GitSignsDeleteNr", - linehl = "GitSignsDeleteLn", - }, - change = { - -- text = "±", - text = "▎", - hl = "GitSignsChange", - numhl = "GitSignsChangeNr", - linehl = "GitSignsChangeLn", - }, - changedelete = { - -- text = '~', - text = "▎", - hl = "GitSignsDelete", - numhl = "GitSignsChangeNr", - linehl = "GitSignsChangeLn", - }, - topdelete = { - text = '‾', - hl = "GitSignsDelete", - numhl = "GitSignsDeleteNr", - linehl = "GitSignsDeleteLn", - }, - }, - numhl = false, - linehl = false, - watch_gitdir = { - interval = 1000, - follow_files = true, - }, - current_line_blame_opts = { - virt_text = true, - virt_text_pos = "eol", - delay = 1000, - ignore_whitespace = false - }, - current_line_blame_formatter_opts = { relative_time = true }, - sign_priority = 6, - update_debounce = 100, - status_formatter = nil, - max_file_length = 40000, - preview_config = { - border = "shadow", - style = "minimal", - relative = "cursor", - row = 0, - col = 1 - } - } -end - -return M diff --git a/lua/plugin/config/hop.lua b/lua/plugin/config/hop.lua deleted file mode 100644 index 9bde284..0000000 --- a/lua/plugin/config/hop.lua +++ /dev/null @@ -1,56 +0,0 @@ -local M = {} -local keymap = require("core.default_config").keymap - -function M.setup() - local hop = require('hop') - hop.setup { - term_seq_bias = 0.5, - keys = 'etovxqpdygfblzhckisuran', - } - local directions = require('hop.hint').HintDirection - -- keymap({ 'n', 'v' }, 'f', - -- function() - -- hop.hint_char1({ - -- direction = directions.AFTER_CURSOR, - -- current_line_only = true, - -- }) - -- end, - -- { remap = true }) - -- keymap({ 'n', 'v' }, 'F', - -- function() - -- hop.hint_char1( - -- { - -- direction = directions.BEFORE_CURSOR, - -- current_line_only = true, - -- } - -- ) - -- end, - -- { remap = true }) - -- keymap({ 'n', 'v' }, 't', - -- function() - -- hop.hint_char1( - -- { - -- direction = directions.AFTER_CURSOR, - -- current_line_only = true, - -- hint_offset = -1, - -- } - -- ) - -- end, - -- { remap = true }) - -- keymap({ 'n', 'v' }, 'T', - -- function() - -- hop.hint_char1({ - -- direction = directions.BEFORE_CURSOR, - -- current_line_only = true, - -- hint_offset = 1, - -- }) - -- end, - -- { remap = true }) - -- keymap({ 'n', 'v' }, 'w', function() hop.hint_words() end, {}) - -- keymap({ 'n', 'v' }, 'k', function() hop.hint_lines() end, {}) - -- keymap('n', 'c', function() hop.hint_char1() end, {}) - -- keymap('n', 'C', function() hop.hint_char2() end, {}) - -- keymap('n', 'm', function() hop.hint_patterns() end, {}) -end - -return M diff --git a/lua/plugin/config/lastplace.lua b/lua/plugin/config/lastplace.lua deleted file mode 100644 index 238f25e..0000000 --- a/lua/plugin/config/lastplace.lua +++ /dev/null @@ -1,23 +0,0 @@ -local M = {} -local status, lastplace = pcall(require, "nvim-lastplace") - -function M.setup() - if (not status) then return end - - lastplace.setup({ - lastplace_ignore_buftype = { - "quickfix", - "nofile", - "help", - }, - lastplace_ignore_filetype = { - "gitcommit", - "gitrebase", - "svn", - "hgcommit", - }, - lastplace_open_folds = true, - }) -end - -return M diff --git a/lua/plugin/config/legendary.lua b/lua/plugin/config/legendary.lua deleted file mode 100644 index e7320a7..0000000 --- a/lua/plugin/config/legendary.lua +++ /dev/null @@ -1,150 +0,0 @@ -local M = {} -local telescope_builtin = require('telescope.builtin') -local gs = require('gitsigns') - -function M.setup() - require('legendary').setup({ - keymaps = { - { 'n', ':NvimTreeToggle', description = '[N]vimTree Toggle' }, - { '', ':nohlsearch', description = 'No Highlights Search' }, - { ';', ':Legendary', description = '[:] Legendary Commands' }, - -- Telescope - { '?', telescope_builtin.oldfiles, description = '[?] Find recently opened files' }, - { 'sf', telescope_builtin.find_files, description = '[S]earch [F]iles' }, - { 'sw', telescope_builtin.grep_string, description = '[S]earch current [W]ord' }, - { 'sg', telescope_builtin.live_grep, description = '[S]earch by [G]rep' }, - { '', telescope_builtin.buffers, description = '[S]earch [B]uffers' }, - { 'sc', function () require('plugin.config.telescope').colorscheme_picker() end, description = '[S]earch [C]olorscheme' }, - { 'so', function () require('plugin.config.telescope').treesitter() end, description = '[S]earch Treesitter Symb[o]ls' }, - { 'ss', telescope_builtin.symbols, description = '[S]earch [S]ymbols' }, - { 'sx', telescope_builtin.resume, description = '[S]earch [X]resume' }, - { 'sd', telescope_builtin.diagnostics, description = '[S]earch [D]iagnostics' }, - { 'sm', telescope_builtin.marks, description = '[S]earch [M]arks' }, - { 'sj', telescope_builtin.jumplist, description = '[S]earch [J]umplists' }, - { 'st', telescope_builtin.tags, description = '[S]earch [T]ags' }, - { '/', require('plugin.config.telescope').current_buffer_fuzzy_find, description = '[/] Fuzzily search in current buffer' }, - { 'en', require('plugin.config.telescope').edit_neovim, description = '[E]dit [N]eovim' }, - { 'gb', telescope_builtin.git_branches, description = '[G]it [B]ranches' }, - { 'gc', telescope_builtin.git_commits, description = '[G]it [B]ranches' }, - { 'gs', telescope_builtin.git_status, description = '[G]it [S]tatus' }, - { 'gt', telescope_builtin.git_stash, description = '[G]it s[T]atus' }, - -- Git signs - { 'hs', gs.stage_hunk, description = 'Stage Hunk', mode = { 'n' } }, - { 'hr', gs.reset_hunk, description = 'Reset Hunk', mode = { 'n' } }, - { 'hs', function() gs.stage_hunk { vim.fn.line("."), vim.fn.line("v") } end, description = 'Stage Hunk (Visual)', mode = { 'v' } }, - { 'hr', function() gs.reset_hunk { vim.fn.line("."), vim.fn.line("v") } end, description = 'Reset Hunk (Visual)', mode = { 'v' } }, - { 'hs', gs.stage_buffer, description = 'Stage Buffer', mode = { 'n' } }, - { 'hu', gs.undo_stage_hunk, description = 'Undo Stage Hunk', mode = { 'n' } }, - { 'hr', gs.reset_buffer, description = 'Reset Buffer', mode = { 'n' } }, - { 'hp', gs.preview_hunk, description = 'Preview Hunk', mode = { 'n' } }, - { 'hb', function() gs.blame_line { full = true } end, description = 'Blame Line', mode = { 'n' } }, - { 'tb', gs.toggle_current_line_blame, description = 'Toggle Current Line Blame', mode = { 'n' } }, - { 'hd', gs.diffthis, description = 'Diff This', mode = { 'v', 'n' } }, - { 'hd', function() gs.diffthis('~') end, description = 'Diff This (Visual)', mode = { 'n' } }, - { 'td', gs.toggle_deleted, description = 'Toggle Deleted', mode = { 'n' } }, - -- Command Pallet - { 'cp', require('legendary').find, description = '[C]ommand [P]allet', mode = {'n', 'v'} }, - -- LSP - { - 'K', - function() - local winid = require('ufo').peekFoldedLinesUnderCursor() - if not winid then - vim.lsp.buf.hover() - end - end, description = 'Hover Documentation', mode = { 'n' } }, - -- UFO - { 'zR', require('ufo').openAllFolds, description = 'Open All Folds', mode = { 'n' } }, - { 'zM', require('ufo').closeAllFolds, description = 'Close All Folds', mode = { 'n' } }, - { 'zr', require('ufo').openFoldsExceptKinds, description = 'Open Folds Except Kinds', mode = { 'n' } }, - { 'zm', require('ufo').closeFoldsWith, description = 'Open Folds With', mode = { 'n' } }, - { 'gD', vim.lsp.buf.declaration, description = '[G]oto [D]eclaration', mode = { 'n' } }, - { 'gI', vim.lsp.buf.implementation, description = '[G]oto [I]mplementation', mode = { 'n' } }, - { 'gd', telescope_builtin.lsp_definitions, description = '[G]oto [D]efinition', mode = { 'n' } }, - { 'gr', telescope_builtin.lsp_references, description = '[G]oto [R]eferences', mode = { 'n' } }, - { 'gs', vim.lsp.buf.signature_help, description = '[G]oto [S]ignature', mode = { 'n' } }, - { 'rn', vim.lsp.buf.rename, description = '[R]e[n]ame', mode = { 'n' } }, - { 'ca', vim.lsp.buf.code_action, description = '[C]ode [A]ction', mode = { 'n' } }, - { 'l', ':Neogit', description = 'NeoGit', mode = { 'n' } }, - { 'L', ':Neogit commit', description = 'NeoGit', mode = { 'n' } }, - -- Split - { 'j', require('treesj.').toggle, description = 'Toggle Split or Join', mode = { 'n' } }, - { 'k', ':ISwap', description = 'Swap', mode = { 'n', 'v' } }, - }, - commands = { - { ':Format', function() vim.lsp.buf.format({async = true}) end, description = 'Format current buffer with LSP', mode = { 'n', 'v', 'x' } }, - { ':ToggleLspLine', function() require('lsp_lines').toggle() end, description = 'Toggle lsp_lines', mode = { 'n' } }, - { - ':ToggleBlameLine', - function() - gs.toggle_current_line_blame() - end, - description = 'Toggle Current Line Blame', - mode = { 'n' } - }, - { ':DiffThis', function() gs.diffthis() end, description = 'Diff this', mode = { 'n' } }, - { ':DiffView', function() gs.diffthis('~') end, description = 'Diff View', mode = { 'n' } }, - { - ':TSJSplit', - function() - require('treesj').split() - end, - description = 'Split Lines', - mode = { 'n' }, - }, - { - ':TSJJoin', - function() - require('treesj').join() - end, - description = 'Join Lines', - mode = { 'n' }, - }, - { - ':LuaSnipEdit', - function() - require('luasnip.loaders.from_lua').edit_snippet_files() - end, - description = 'Edit Snippets Files', - mode = { 'n' }, - }, - { - ':Notifi', - ':Telescope notify', - description = 'Notify', - mode = { 'n' } - }, - { - ':HlangsToggle', - function () - require('hlargs').toggle() - end, - description = 'Hlangs Toggle' - }, - { - ':Sad', - ':Sad', - description = 'Space Age seD' - } - }, - extensions = { - lazy_nvim = { - auto_register = true - }, - nvim_tree = false, - smart_splits = { - directions = { 'h', 'j', 'k', 'l' }, - mods = { - move = '', - resize = '', - swap = { - mod = '', - prefix = '', - }, - }, - }, - }, - }) -end - -return M diff --git a/lua/plugin/config/lsp-signature.lua b/lua/plugin/config/lsp-signature.lua deleted file mode 100644 index d58211d..0000000 --- a/lua/plugin/config/lsp-signature.lua +++ /dev/null @@ -1,68 +0,0 @@ -local cfg = { - debug = false, -- set to true to enable debug logging - log_path = vim.fn.stdpath("cache") .. "/lsp_signature.log", -- log dir when debug is on - -- default is ~/.cache/nvim/lsp_signature.log - verbose = false, -- show debug line number - - bind = true, -- This is mandatory, otherwise border config won't get registered. - -- If you want to hook lspsaga or other signature handler, pls set to false - doc_lines = 10, -- will show two lines of comment/doc(if there are more than two lines in doc, will be truncated); - -- set to 0 if you DO NOT want any API comments be shown - -- This setting only take effect in insert mode, it does not affect signature help in normal - -- mode, 10 by default - - max_height = 12, -- max height of signature floating_window - max_width = 80, -- max_width of signature floating_window - noice = false, -- set to true if you using noice to render markdown - wrap = true, -- allow doc/signature text wrap inside floating_window, useful if your lsp return doc/sig is too long - - floating_window = true, -- show hint in a floating window, set to false for virtual text only mode - - floating_window_above_cur_line = true, -- try to place the floating above the current line when possible Note: - -- will set to true when fully tested, set to false will use whichever side has more space - -- this setting will be helpful if you do not want the PUM and floating win overlap - - floating_window_off_x = 1, -- adjust float windows x position. - -- can be either a number or function - floating_window_off_y = -5, -- adjust float windows y position. e.g -2 move window up 2 lines; 2 move down 2 lines - -- can be either number or function, see examples - - close_timeout = 4000, -- close floating window after ms when laster parameter is entered - fix_pos = true, -- set to true, the floating window will not auto-close until finish all parameters - hint_enable = true, -- virtual hint enable - hint_prefix = " ", -- Symbol for parameter - hint_scheme = "String", - hint_inline = function() - return false - end, -- should the hint be inline(nvim 0.10 only)? default false - hi_parameter = "LspSignatureActiveParameter", -- how your parameter will be highlight - handler_opts = { - border = "rounded", -- double, rounded, single, shadow, none, or a table of borders - }, - - always_trigger = false, -- sometime show signature on new line or in middle of parameter can be confusing, set it to false for #58 - - auto_close_after = nil, -- autoclose signature float win after x sec, disabled if nil. - extra_trigger_chars = {}, -- Array of extra characters that will trigger signature completion, e.g., {"(", ","} - zindex = 200, -- by default it will be on top of all floating windows, set to <= 50 send it to bottom - - padding = "", -- character to pad on left and right of signature can be ' ', or '|' etc - - transparency = nil, -- disabled by default, allow floating win transparent value 1~100 - shadow_blend = 36, -- if you using shadow as border use this set the opacity - shadow_guibg = "Black", -- if you using shadow as border use this set the color e.g. 'Green' or '#121315' - timer_interval = 200, -- default timer check interval set to lower value if you want to reduce latency - toggle_key = nil, -- toggle signature on and off in insert mode, e.g. toggle_key = '' - toggle_key_flip_floatwin_setting = false, -- true: toggle float setting after toggle key pressed - - select_signature_key = nil, -- cycle to next signature, e.g. '' function overloading - move_cursor_key = nil, -- imap, use nvim_set_current_win to move cursor between current win and floating -} - --- recommended: -require("lsp_signature").setup(cfg) - --- Colour changes for popup window in LspSignature -vim.api.nvim_set_hl(0, "LspSignatureActiveParameter", { bg = "#45403d", fg = "NONE" }) -vim.api.nvim_set_hl(0, "NormalFloat", { bg = "#282828", fg = "NONE" }) -vim.api.nvim_set_hl(0, "FloatBorder", { bg = "#282828", fg = "NONE" }) diff --git a/lua/plugin/config/lsp.lua b/lua/plugin/config/lsp.lua deleted file mode 100644 index 2a6fb0e..0000000 --- a/lua/plugin/config/lsp.lua +++ /dev/null @@ -1,243 +0,0 @@ -local M = {} - -local servers = { - -- gopls = {}, - -- pylsp = {}, - ruff_lsp = {}, - tsserver = {}, - rust_analyzer = {}, - jsonls = { - settings = { - json = { - schemas = { - - { - fileMatch = { "package.json" }, - url = "https://json.schemastore.org/package.json", - }, - { - fileMatch = { "tsconfig*.json" }, - url = "https://json.schemastore.org/tsconfig.json", - }, - { - fileMatch = { - ".prettierrc", - ".prettierrc.json", - "prettier.config.json", - }, - url = "https://json.schemastore.org/prettierrc.json", - }, - { - fileMatch = { ".eslintrc", ".eslintrc.json" }, - url = "https://json.schemastore.org/eslintrc.json", - }, - { - fileMatch = { - ".babelrc", - ".babelrc.json", - "babel.config.json", - }, - url = "https://json.schemastore.org/babelrc.json", - }, - { - fileMatch = { "lerna.json" }, - url = "https://json.schemastore.org/lerna.json", - }, - { - fileMatch = { "now.json", "vercel.json" }, - url = "https://json.schemastore.org/now.json", - }, - { - fileMatch = { - ".stylelintrc", - ".stylelintrc.json", - "stylelint.config.json", - }, - url = "http://json.schemastore.org/stylelintrc.json", - }, - }, - }, - }, - }, - lua_ls = { - Lua = { - diagnostics = { - globals = { "vim" }, - }, - workspace = { checkThirdParty = false }, - telemetry = { enable = false }, - library = { - [vim.fn.expand("$VIMRUNTIME/lua")] = true, - [vim.fn.stdpath("config") .. "/lua"] = true, - }, - }, - }, - ltex = { - filetypes = { - "bib", - "gitcommit", - "markdown", - "org", - "plaintex", - "rst", - "rnoweb", - "tex", - "pandoc", - "rust", - "javascript", - "typescript", - "javascriptreact", - "typescriptreact", - "lua", - "python", - "html", - }, - settings = { - ltex = { - enabled = { - "bib", - "gitcommit", - "markdown", - "org", - "plaintex", - "rst", - "rnoweb", - "tex", - "pandoc", - "rust", - "javascript", - "typescript", - "javascriptreact", - "typescriptreact", - "lua", - "python", - "html", - }, - additionalRules = { - languageModel = "~/ngrams/", - checkFrequency = "save", - } - } - } - }, -} - -local on_attach = function(_, bufnr) - vim.fn.sign_define("DiagnosticSignError", { text = " ", texthl = "DiagnosticSignError", numhl = "" }) - vim.fn.sign_define("DiagnosticSignWarn", { text = "", texthl = "DiagnosticSignWarn", numhl = "" }) - vim.fn.sign_define("DiagnosticSignInfo", { text = "", texthl = "DiagnosticSignInfo", numhl = "" }) - - if vim.lsp.setup then - vim.lsp.setup { - floating_preview = { border = { "╭", "─", "╮", "│", "╯", "─", "╰", "│" } }, - diagnostics = { - signs = { error = " ", warning = " ", hint = " ", information = " " }, - display = { - underline = true, - update_in_insert = false, - -- virtual_text = { spacing = 4, prefix = "●" }, - virtual_text = false, - severity_sort = true, - }, - }, - completion = { - kind = { - Class = " ", - Color = " ", - Constant = " ", - Constructor = " ", - Enum = "了 ", - EnumMember = " ", - Field = " ", - File = " ", - Folder = " ", - Function = " ", - Interface = "ﰮ ", - Keyword = " ", - Method = "ƒ ", - Module = " ", - Property = " ", - Snippet = "﬌ ", - Struct = " ", - Text = " ", - Unit = " ", - Value = " ", - Variable = " ", - }, - }, - } - else - end - - local nmap = function(keys, func, desc) - if desc then - desc = 'LSP: ' .. desc - end - - vim.keymap.set('n', keys, func, { buffer = bufnr, desc = desc }) - end - - nmap('rn', vim.lsp.buf.rename, '[R]e[n]ame') - nmap('ca', vim.lsp.buf.code_action, '[C]ode [A]ction') - - nmap('gd', require('telescope.builtin').lsp_definitions, '[G]oto [D]efinition') - nmap('gr', require('telescope.builtin').lsp_references, '[G]oto [R]eferences') - nmap('gI', vim.lsp.buf.implementation, '[G]oto [I]mplementation') - -- nmap('D', vim.lsp.buf.type_definition, '[T]ype [D]efinition') - -- nmap('ds', require('telescope.builtin').lsp_document_symbols, '[D]ocument [S]ymbols') - -- nmap('ws', require('telescope.builtin').lsp_dynamic_workspace_symbols, '[W]orkspace [S]ymbols') - - -- nmap('K', vim.lsp.buf.hover, 'Hover Documentation') - -- nmap('', vim.lsp.buf.signature_help, 'Signature Documentation') - nmap('gD', vim.lsp.buf.declaration, '[G]oto [D]eclaration') - - -- nmap('wa', vim.lsp.buf.add_workspace_folder, '[W]orkspace [A]dd Folder') - -- nmap('wr', vim.lsp.buf.remove_workspace_folder, '[W]orkspace [R]emove Folder') - -- nmap('wl', function() - -- print(vim.inspect(vim.lsp.buf.list_workspace_folders())) - -- end, '[W]orkspace [L]ist Folders') -end - -function M.setup() - -- nvim-cmp supports additional completion capabilities, so broadcast that to servers - local capabilities = vim.lsp.protocol.make_client_capabilities() - capabilities = require('cmp_nvim_lsp').default_capabilities(capabilities) - capabilities.textDocument.completion.completionItem.preselectSupport = true - capabilities.textDocument.completion.completionItem.insertReplaceSupport = true - capabilities.textDocument.completion.completionItem.labelDetailsSupport = true - capabilities.textDocument.completion.completionItem.deprecatedSupport = true - capabilities.textDocument.completion.completionItem.commitCharactersSupport = true - capabilities.textDocument.completion.completionItem.tagSupport = { valueSet = { 1 } } - capabilities.textDocument.completion.completionItem.snippetSupport = true - capabilities.textDocument.completion.completionItem.resolveSupport = { - properties = { "documentation", "detail", "additionalTextEdits" }, - } - capabilities.textDocument.foldingRange = { - dynamicRegistration = false, - lineFoldingOnly = true - } - - -- Setup mason so it can manage external tooling - require('mason').setup() - - -- Ensure the servers above are installed - local mason_lspconfig = require 'mason-lspconfig' - - mason_lspconfig.setup { - ensure_installed = vim.tbl_keys(servers), - } - - mason_lspconfig.setup_handlers { - function(server_name) - require('lspconfig')[server_name].setup { - capabilities = capabilities, - on_attach = on_attach, - settings = servers[server_name], - } - end, - } - -- Turn on lsp status information - require('fidget').setup() -end - -return M diff --git a/lua/plugin/config/manson-tool-installer.lua b/lua/plugin/config/manson-tool-installer.lua deleted file mode 100644 index 777eb18..0000000 --- a/lua/plugin/config/manson-tool-installer.lua +++ /dev/null @@ -1,17 +0,0 @@ -local M = {} - -function M.setup() - require("mason-tool-installer").setup({ - ensure_installed = { - "lua-language-server", - "typescript-language-server", - }, - auto_update = true, - run_on_start = true, - start_delay = 0, -- 3 second delay - debounce_hours = 24, -- at least 24 hours between attempts to install/update - }) - vim.cmd("MasonToolsUpdate") -end - -return M diff --git a/lua/plugin/config/modes.lua b/lua/plugin/config/modes.lua deleted file mode 100644 index 1c03216..0000000 --- a/lua/plugin/config/modes.lua +++ /dev/null @@ -1,24 +0,0 @@ -local M = {} - -function M.setup() - require("modes").setup({ - colors = { - normal = "#ffcb6b", - insert = "#c3e88d", - delete = "#f07178", - copy = "#f78c6c", - visual = "#82aaff", - }, - line_opacity = 0.25, - set_cursor = true, - ignore_filetypes = { - "alpha", - "NvimTree", - "TelescopePrompt", - "NeogitStatus", - "NeogitPopup", - } - }) -end - -return M diff --git a/lua/plugin/config/neogit.lua b/lua/plugin/config/neogit.lua deleted file mode 100644 index 1112f1b..0000000 --- a/lua/plugin/config/neogit.lua +++ /dev/null @@ -1,15 +0,0 @@ -local M = {} -local neogit = require('neogit') - -function M.setup() - neogit.setup { - kind = "vsplit", - integrations = { - telescope = true, - diffview = true, - - } - } -end - -return M diff --git a/lua/plugin/config/notification.lua b/lua/plugin/config/notification.lua deleted file mode 100644 index a356cc1..0000000 --- a/lua/plugin/config/notification.lua +++ /dev/null @@ -1,39 +0,0 @@ -local M = {} -local status, notify = pcall(require, "notify") - -function M.setup() - if (not status) then return end - notify.setup({ - stages = "fade_in_slide_out", - render = "compact", - timeout = 1500, - fps = 20, - max_height = function() - return math.floor(vim.o.lines * 0.75) - end, - max_width = function() - return math.floor(vim.o.columns * 0.75) - end, - background_colour = "#000000", - minimum_width = 26, - icons = { - ERROR = "", - WARN = "", - INFO = "", - DEBUG = "", - TRACE = "✎", - } - }) - vim.notify = notify -end - -function M.info(msg) - vim.notify(" => INFO: " .. msg, vim.log.levels.INFO) -end - -function M.error(title, msg) - vim.api.nvim_echo({ { " => ERROR: " .. title, "ErrorMsg" } }, true, {}) - vim.notify(msg, vim.log.levels.ERROR) -end - -return M diff --git a/lua/plugin/config/nvimtree.lua b/lua/plugin/config/nvimtree.lua deleted file mode 100644 index 267e246..0000000 --- a/lua/plugin/config/nvimtree.lua +++ /dev/null @@ -1,71 +0,0 @@ -local M = {} -local opts = require("core.default_config").opts -local keymap = require("core.default_config").keymap -local status, nvimtree = pcall(require, 'nvim-tree') - -function M.setup() - -- Load nvim-tree plugin - if (not status) then return end - nvimtree.setup { - -- Set options for nvim-tree - disable_netrw = false, -- Disable netrw - hijack_netrw = false, -- Hijack netrw window on startup - update_focused_file = { - enable = true, -- Update the focused file in the tree when you change files - update_cwd = true, -- Update the current working directory of the tree - }, - view = { - cursorline = true, - width = 30, -- Set the width of the tree view - side = 'right', -- Put the tree view on the left side of the editor - }, - actions = { - open_file = { - resize_window = true, - } - }, - filters = { - dotfiles = true, - exclude = { - 'node_modules', - '.venv', - 'env', - '.env', - }, - }, - renderer = { - add_trailing = true, - group_empty = true, - highlight_git = true, - indent_width = 1, - indent_markers = { - enable = true, - }, - icons = { - git_placement = "after", - show = { - file = true, - }, - glyphs = { - default = " ", - }, - }, - }, - log = { - enable = true, - truncate = true, - types = { - all = true, - config = true, - copy_paste = true, - dev = true, - diagnostics = true, - git = true, - profile = true, - watcher = true, - }, - }, - } -end - -return M diff --git a/lua/plugin/config/relativenumber.lua b/lua/plugin/config/relativenumber.lua deleted file mode 100644 index cb4b78d..0000000 --- a/lua/plugin/config/relativenumber.lua +++ /dev/null @@ -1,27 +0,0 @@ -local M = {} -local status, relativetoggle = pcall(require, "relative-toggle") - -function M.setup() - if (not status) then return end - relativetoggle.setup({ - pattern = "*", - events = { - on = { - "BufEnter", - "FocusGained", - "InsertLeave", - "WinEnter", - "CmdlineLeave", - }, - off = { - "BufLeave", - "FocusLost", - "InsertEnter", - "WinLeave", - "CmdlineEnter", - }, - }, - }) -end - -return M diff --git a/lua/plugin/config/rest.lua b/lua/plugin/config/rest.lua deleted file mode 100644 index 3ca77c9..0000000 --- a/lua/plugin/config/rest.lua +++ /dev/null @@ -1,37 +0,0 @@ -local M = {} - -local status, restnv = pcall(require, "rest-nvim") - -function M.setup() - restnv.setup({ - result_split_horizontal = false, - highlight = { enabled = true, timeout = 150 }, - result = { - show_url = true, - show_http_info = true, - show_headers = true, - formatters = { - json = "jq", - html = function(body) - return vim.fn.system({ "tidy", "-i", "-q", "-" }, body) - end - } - }, - jump_to_request = true, - }) - local rest_nvim = require('rest-nvim') - vim.api.nvim_create_autocmd("FileType", { - pattern = "http", - callback = function() - local buff = tonumber(vim.fn.expand(""), 10) - vim.keymap.set("n", "rn", rest_nvim.run, - { noremap = true, buffer = buff }) - vim.keymap.set("n", "rl", rest_nvim.last, - { noremap = true, buffer = buff }) - vim.keymap.set("n", "rp", function() rest_nvim.run(true) end, - { noremap = true, buffer = buff }) - end - }) -end - -return M diff --git a/lua/plugin/config/smartsplit.lua b/lua/plugin/config/smartsplit.lua deleted file mode 100644 index 8d9326d..0000000 --- a/lua/plugin/config/smartsplit.lua +++ /dev/null @@ -1,21 +0,0 @@ -local M = {} -local status, smart_splits = pcall(require, "smart-splits") - -function M.setup() - smart_splits.setup { - ignored_filetypes = { - 'nofile', - 'quickfix', - 'prompt', - }, - ignored_buftypes = { 'NvimTree' }, - resize_mode = { - silent = true, - hooks = { - on_leave = require("bufresize").register - } - } - } -end - -return M diff --git a/lua/plugin/config/smoothcursor.lua b/lua/plugin/config/smoothcursor.lua deleted file mode 100644 index 7d7e385..0000000 --- a/lua/plugin/config/smoothcursor.lua +++ /dev/null @@ -1,18 +0,0 @@ -local M = {} - -function M.setup() - require("smoothcursor").setup({ - cursor = "", - disable_float_win = true, - fancy = { - enable = true, - head = { - cursor = "", - texthl = "SmoothCursor", - linehl = "cursorline", - } - } - }) -end - -return M diff --git a/lua/plugin/config/statusline.lua b/lua/plugin/config/statusline.lua deleted file mode 100644 index 82d0332..0000000 --- a/lua/plugin/config/statusline.lua +++ /dev/null @@ -1,142 +0,0 @@ -local M = {} -local ui = require("core.default_config").ui - -local function getLsps() - local lspNames = "[" - for _, client in pairs(vim.lsp.get_active_clients()) do - lspNames = lspNames .. client.name .. ", " - end - - return string.sub(lspNames, 1, string.len(lspNames) - 2) .. "]" -end - -local function getTotalLines() - return vim.fn.line("$") -end - -local function search_result() - if vim.v.hlsearch == 0 then - return '' - end - local last_search = vim.fn.getreg('/') - if not last_search or last_search == '' then - return '' - end - local searchcount = vim.fn.searchcount { maxcount = 9999 } - return last_search .. '(' .. searchcount.current .. '/' .. searchcount.total .. ')' -end - -local function get_words() - if vim.bo.filetype == "md" or vim.bo.filetype == "txt" or vim.bo.filetype == "markdown" then - if vim.fn.wordcount().visual_words == 1 then - return tostring(vim.fn.wordcount().visual_words) .. " word" - elseif not (vim.fn.wordcount().visual_words == nil) then - return tostring(vim.fn.wordcount().visual_words) .. " words" - else - return tostring(vim.fn.wordcount().words) .. " words" - end - else - return "" - end -end - -local function filename() - local file = vim.fn.expand("%:p") - local homedir = vim.loop.os_homedir() - local base_dir = homedir .. "/projects" - local _, index = string.find(file, base_dir, 1, true) - if index then - return vim.fn.fnamemodify(file, ":~:.") - else - return vim.fn.expand("%:t") - end -end - -local function lsp_status() - local lsp = vim.lsp.util.get_diagnostics_count(0, [[Error]]) - local icon = '' - if lsp > 0 then - icon = ' ' - end - return icon .. 'LSP' -end - -function M.setup() - require("lualine").setup({ - options = { - theme = ui.theme, - section_separators = "", - component_separators = "", - }, - sections = { - lualine_a = { - { - "mode", - color = { - gui = "bold", - }, - }, - }, - lualine_b = { - "branch", - "diff", - lsp_status, - { - "diagnostics", - sources = { - "nvim_lsp", - }, - }, - }, - lualine_c = { - { - "filename", - file_status = true, - path = 1, - formatter = filename, - symbols = { - modified = '  ', - readonly = '  ', - unnamed = '  ', - newfile = '  ', - }, - }, - }, - lualine_x = { - getLsps, - search_result - }, - lualine_y = { - "filetype", - -- "encoding", - -- "fileformat", - get_words, - { - require("lazy.status").updates, - cond = require("lazy.status").has_updates, - color = { fg = "#ff9e64" }, - }, - { - "location", - color = { fg = "#ff9e64" }, - }, - getTotalLines - }, - lualine_z = { "progress" }, - }, - inactive_sections = { - lualine_c = { '%f %y %m' }, - lualine_x = {}, - }, - extensions = { - "fzf", - "fugitive", - "quickfix", - "nvim-tree", - "man", - "lazy" - }, - }) -end - -return M diff --git a/lua/plugin/config/treesitter.lua b/lua/plugin/config/treesitter.lua deleted file mode 100644 index afbf6cb..0000000 --- a/lua/plugin/config/treesitter.lua +++ /dev/null @@ -1,116 +0,0 @@ -local M = {} -local status, ts = pcall(require, "nvim-treesitter.configs") -local parser_config = require "nvim-treesitter.parsers".get_parser_configs() - -function M.setup() - if (not status) then return end - ts.setup { - ensure_installed = { - "cpp", - "python", - "html", - "javascript", - "typescript", - "json", - "json5", - "jsonc", - "go", - "gomod", - "bash", - "lua", - "luadoc", - "luap", - "comment", - "markdown", - "markdown_inline", - "glimmer", - "regex", - "vim", - "vimdoc", - "yaml", - "toml", - "tsx", - "css", - "scss", - "dockerfile", - }, - sync_install = false, - highlight = { - enable = true, - additional_vim_regex_highlighting = false, - disable = { "cpp", "latex" }, - }, - indent = { - enable = { "javascriptreact" }, - disable = { 'python' }, - }, - autotag = { enable = true }, - incremental_selection = { - enable = true, - keymaps = { - init_selection = '', - node_incremental = '', - scope_incremental = '', - node_decremental = '', - }, - }, - rainbow = { - enable = true, - extendend_mode = true, - max_file_lines = 1000, - query = 'rainbow-parens', - strategy = require('ts-rainbow').strategy.global, - }, - context_commentstring = { - enable = true, - enable_autocmd = false - }, - textobjects = { - select = { - enable = true, - lookahead = true, -- Automatically jump forward to textobj, similar to targets.vim - keymaps = { - -- You can use the capture groups defined in textobjects.scm - ['aa'] = '@parameter.outer', - ['ia'] = '@parameter.inner', - ['af'] = '@function.outer', - ['if'] = '@function.inner', - ['ac'] = '@class.outer', - ['ic'] = '@class.inner', - }, - }, - move = { - enable = true, - set_jumps = true, -- whether to set jumps in the jumplist - goto_next_start = { - [']m'] = '@function.outer', - [']]'] = '@class.outer', - }, - goto_next_end = { - [']M'] = '@function.outer', - [']['] = '@class.outer', - }, - goto_previous_start = { - ['[m'] = '@function.outer', - ['[['] = '@class.outer', - }, - goto_previous_end = { - ['[M'] = '@function.outer', - ['[]'] = '@class.outer', - }, - }, - swap = { - enable = true, - swap_next = { - ['a'] = '@parameter.inner', - }, - swap_previous = { - ['A'] = '@parameter.inner', - }, - }, - }, - } - parser_config.tsx.filetype_to_parsername = { "javascript", "typescript.tsx" } -end - -return M diff --git a/lua/plugin/config/treesj.lua b/lua/plugin/config/treesj.lua deleted file mode 100644 index 960566b..0000000 --- a/lua/plugin/config/treesj.lua +++ /dev/null @@ -1,12 +0,0 @@ -local M = {} - -function M.setup() - require('treesj').setup({ - notify = true, - dot_repeat = false, - max_join_length = 500, - use_default_keymaps = false, - }) -end - -return M diff --git a/lua/plugin/config/typescript-tools.lua b/lua/plugin/config/typescript-tools.lua deleted file mode 100644 index 91f75f1..0000000 --- a/lua/plugin/config/typescript-tools.lua +++ /dev/null @@ -1,195 +0,0 @@ -local M = {} -local methods = vim.lsp.protocol.Methods -local baseDefinitionHandler = vim.lsp.handlers["textDocument/definition"] - -local filter = require("lsp.utils.filter").filter -local filterReactDTS = require("lsp.utils.filterReactDTS").filterReactDTS - -local handlers = { - ["textDocument/hover"] = vim.lsp.with(vim.lsp.handlers.hover, { - silent = true, - border = EcoVim.ui.float.border, - }), - ["textDocument/signatureHelp"] = vim.lsp.with(vim.lsp.handlers.signature_help, { border = EcoVim.ui.float.border }), - ["textDocument/publishDiagnostics"] = vim.lsp.with( - vim.lsp.diagnostic.on_publish_diagnostics, - { virtual_text = EcoVim.lsp.virtual_text } - ), - ["textDocument/definition"] = function(err, result, method, ...) - P(result) - if vim.tbl_islist(result) and #result > 1 then - local filtered_result = filter(result, filterReactDTS) - return baseDefinitionHandler(err, filtered_result, method, ...) - end - - baseDefinitionHandler(err, result, method, ...) - end, -} - - --- Toggle format on save. -local autoformat = true -vim.api.nvim_create_user_command('ToggleAutoFormat', function() - autoformat = not autoformat -end, {}) - ----@param bufnr integer -local function format(bufnr) - if not autoformat then - return - end - - local clients = vim.lsp.get_clients { - bufnr = bufnr, - method = methods.textDocument_formatting or methods.textDocument_rangeFormatting, - } - - -- Prioritize formatting with EFM. - local name = nil - if vim.tbl_contains(clients, function(client) - return client.name == 'efm' - end) then - name = 'efm' - end - - if #clients == 0 then - return - end - - vim.lsp.buf.format { - bufnr = bufnr, - name = name, - async = #clients == 1, - } -end - ----@param bufnr number -local function setup_inlay_hints(bufnr) - local inlay_hints_group = vim.api.nvim_create_augroup('ToggleInlayHints', { clear = false }) - - -- Initial inlay hint display. - -- Idk why but without the delay inlay hints aren't displayed at the very start. - vim.defer_fn(function() - local mode = vim.api.nvim_get_mode().mode - vim.lsp.inlay_hint(bufnr, mode == 'n' or mode == 'v') - end, 500) - - vim.api.nvim_create_autocmd('InsertEnter', { - group = inlay_hints_group, - buffer = bufnr, - callback = function() - vim.lsp.inlay_hint(bufnr, false) - end, - }) - vim.api.nvim_create_autocmd('InsertLeave', { - group = inlay_hints_group, - buffer = bufnr, - callback = function() - vim.lsp.inlay_hint(bufnr, true) - end, - }) -end - - -function M.on_attach(buf_client, bufnr) - local function keymap(lhs, rhs, desc, mode) - mode = mode or 'n' - vim.keymap.set(mode, lhs, rhs, { buffer = bufnr, desc = desc }) - end - - if buf_client.supports_method(methods.textDocument_codeAction) then - keymap('ca', vim.lsp.buf.code_action, 'Code action', { 'n', 'v' }) - end - - if buf_client.supports_method(methods.textDocument_rename) then - vim.keymap.set('n', 'cr', vim.lsp.buf.rename, { desc = 'Rename' }) - end - - if buf_client.supports_method(methods.textDocument_definition) then - keymap('gd', function() - require('telescope.builtin').lsp_definitions { reuse_win = true } - end, 'Go to definition') - end - - if buf_client.supports_method(methods.textDocument_signatureHelp) then - keymap('', vim.lsp.buf.signature_help, 'Signature help', 'i') - end - - keymap('gr', 'Telescope lsp_references', 'Go to references') - keymap('gI', function() - require('telescope.builtin').lsp_implementations { reuse_win = true } - end, 'Go to implementation') - keymap('gD', function() - require('telescope.builtin').lsp_type_definitions { reuse_win = true } - end, 'Go to type definition') - - keymap('td', function() - require('telescope.builtin').lsp_document_symbols() - end, 'Document symbols') - keymap('tw', function() - require('telescope.builtin').lsp_dynamic_workspace_symbols() - end, 'Workspace symbols') - - keymap('cd', vim.diagnostic.open_float, 'Line diagnostics') - keymap('[d', vim.diagnostic.goto_prev, 'Previous diagnostic') - keymap(']d', vim.diagnostic.goto_next, 'Next diagnostic') - keymap('[e', function() - vim.diagnostic.goto_prev { severity = vim.diagnostic.severity.ERROR } - end, 'Previous error') - keymap(']e', function() - vim.diagnostic.goto_next { severity = vim.diagnostic.severity.ERROR } - end, 'Next error') - - -- noice deals with the UI. - keymap('K', vim.lsp.buf.hover, 'Hover') - - -- Enable inlay hints if the client supports it. - if buf_client.supports_method(methods.textDocument_inlayHint) then - setup_inlay_hints(bufnr) - end - - -- Set up format on save for some file types and specific projects. - local local_fmt_command = vim.g.format_command - if local_fmt_command then - vim.keymap.set('n', 'cf', function() - local cursor = vim.api.nvim_win_get_cursor(0) - vim.cmd(local_fmt_command) - cursor[1] = math.min(cursor[1], vim.api.nvim_buf_line_count(0)) - vim.api.nvim_win_set_cursor(0, cursor) - end, { desc = 'Format buffer' }) - end - if vim.tbl_contains({ 'lua', 'rust' }, vim.bo[bufnr].filetype) then - vim.api.nvim_create_autocmd('BufWritePre', { - buffer = bufnr, - group = vim.api.nvim_create_augroup('FormatOnSave', { clear = false }), - callback = function() - format(bufnr) - end, - }) - end -end - -function M.setup() - require("typescript-tools").setup({ - on_attach = function(client, bufnr) - if vim.fn.has("nvim-0.10") then - -- Enable inlay hints - vim.lsp.inlay_hint(bufnr, true) - end - end, - handlers = handlers, - settings = { - tsserver_plugins = { - "@styled/typescript-styled-plugin", - }, - separate_diagnostic_server = true, - tsserver_file_preferences = { - includeInlayParameterNameHints = "all", - includeCompletionsForModuleExports = true, - quotePreference = "auto", - }, - }, - }) -end - -return M diff --git a/lua/plugin/config/ufo.lua b/lua/plugin/config/ufo.lua deleted file mode 100644 index f8612c1..0000000 --- a/lua/plugin/config/ufo.lua +++ /dev/null @@ -1,62 +0,0 @@ -local M = {} - -local handler = function(virtText, lnum, endLnum, width, truncate) - local newVirtText = {} - local suffix = ('  %d '):format(endLnum - lnum) - local lines = ('[%d lines] '):format(endLnum - lnum) - local sufWidth = vim.fn.strdisplaywidth(suffix) - local targetWidth = width - sufWidth - local curWidth = 0 - for _, chunk in ipairs(virtText) do - local chunkText = chunk[1] - local chunkWidth = vim.fn.strdisplaywidth(chunkText) - if targetWidth > curWidth + chunkWidth then - table.insert(newVirtText, chunk) - else - chunkText = truncate(chunkText, targetWidth - curWidth) - local hlGroup = chunk[2] - table.insert(newVirtText, { chunkText, hlGroup }) - chunkWidth = vim.fn.strdisplaywidth(chunkText) - if curWidth + chunkWidth < targetWidth then - suffix = suffix .. (' '):rep(targetWidth - curWidth - chunkWidth) - end - break - end - curWidth = curWidth + chunkWidth - end - table.insert(newVirtText, { suffix, 'MoreMsg' }) - table.insert(virtText, { suffix, 'Comment' }) - table.insert(virtText, { lines, 'Todo' }) - return newVirtText -end - - -function M.setup() - require('ufo').setup({ - fold_virt_text_handler = handler, - provider_selector = function(bufnr, filetype, buftype) - return { - 'treesitter', - 'indent', - } - end, - preview = { - win_config = { - border = { - "┏", - "━", - "┓", - "┃", - "┛", - "━", - "┗", - "┃", - }, - winblend = 0, - winhighlight = "Normal:Folded", - } - } - }) -end - -return M diff --git a/lua/plugin/init.lua b/lua/plugin/init.lua deleted file mode 100644 index 33b1920..0000000 --- a/lua/plugin/init.lua +++ /dev/null @@ -1,518 +0,0 @@ -local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" -if not vim.loop.fs_stat(lazypath) then - local success, maybe_error = pcall( - vim.fn.system, { - "git", - "clone", - "--filter=blob:none", - "https://github.com/folke/lazy.nvim.git", - "--branch=stable", -- latest stable release - lazypath, - } - ) - if not success then - require('plugin.config.notification').error("ERROR: Fail to install plugin manager lazy.nvim", maybe_error) - require('plugin.config.notification').info("You can cleanup the " .. lazypath .. " and start again") - return - end -end -vim.opt.rtp:prepend(lazypath) - -local plugins = { - { - "neovim/nvim-lspconfig", - event = { "BufReadPre", "BufNewFile" }, - dependencies = { - { - "folke/neodev.nvim", - config = function() - require("neodev").setup() - end - }, - "williamboman/mason.nvim", - "williamboman/mason-lspconfig.nvim", - { - "j-hui/fidget.nvim", - branch = "legacy" - }, - { - "https://git.sr.ht/~whynothugo/lsp_lines.nvim", - config = function() - require("lsp_lines").setup() - end, - }, - }, - config = function() - require("plugin.config.lsp").setup() - end, - cmd = { "Mason" } - }, - { - "pmizio/typescript-tools.nvim", - ft = { "typescript", "typescriptreact" }, - event = { - "BufReadPost", - "BufNewFile", - }, - dependencies = { - "nvim-lua/plenary.nvim", - "nvim-lspconfig", - }, - -- opts = { - -- on_attach = require('plugin.config.typescript-tools').on_attach, - -- settings = { - -- separate_diagnostic_server = true, - -- tsserver_file_preferences = { - -- includeInlayParameterNameHints = 'literals', - -- includeInlayVariableTypeHints = true, - -- includeInlayFunctionLikeReturnTypeHints = true, - -- includeCompletionsForModuleExports = true, - -- quotePreference = "auto", - -- }, - -- }, - -- }, - }, - { - "folke/neoconf.nvim", - cmd = "Neoconf", - config = function() - require("neoconf").setup() - end - }, - { - -- AutoCompletion - "hrsh7th/nvim-cmp", - event = "InsertEnter", - dependencies = { - "hrsh7th/cmp-nvim-lsp", - "saadparwaiz1/cmp_luasnip", - "hrsh7th/cmp-buffer", - "hrsh7th/cmp-path", - "hrsh7th/cmp-nvim-lua", - "ray-x/cmp-treesitter", - "lukas-reineke/cmp-rg", - "quangnguyen30192/cmp-nvim-tags", - "andersevenrud/cmp-tmux", - "saadparwaiz1/cmp_luasnip", - "L3MON4D3/LuaSnip", - "rafamadriz/friendly-snippets", - "lukas-reineke/cmp-under-comparator", - { - "honza/vim-snippets", - dependencies = { - "friendly-snippets", - "vim-snippets", - } - } - }, - config = function() - require("plugin.config.cmp").setup() - end - }, - { - -- File Syntax - "nvim-treesitter/nvim-treesitter", - event = { - "BufReadPost", - "BufNewFile", - }, - build = function() - pcall(require("nvim-treesitter.install").update { with_sync = false }) - end, - config = function() - require("plugin.config.treesitter").setup() - end, - dependencies = { - "JoosepAlviste/nvim-ts-context-commentstring", - "nvim-treesitter/nvim-treesitter-textobjects", - "p00f/nvim-ts-rainbow", - "HiPhish/nvim-ts-rainbow2", - "windwp/nvim-ts-autotag", - "mizlan/iswap.nvim", - { - "m-demare/hlargs.nvim", - config = function() - require("hlargs").setup() - end - }, - { - "ZhiyuanLck/smart-pairs", - event = "InsertEnter", - config = function() - require("pairs"):setup() - end - } - } - }, - { - "kevinhwang91/nvim-ufo", - dependencies = "kevinhwang91/promise-async", - event = "BufReadPost", - config = function() - require("plugin.config.ufo").setup() - end - }, - { - "mrjones2014/smart-splits.nvim", - event = "BufEnter", - config = function() - require("plugin.config.smartsplit").setup() - end, - lazy = false, - dependencies = { - "kwkarlwang/bufresize.nvim", - config = function() - require("plugin.config.bufresize").setup() - end - } - }, - { - "lewis6991/gitsigns.nvim", - config = function() - require("plugin.config.gitsigns").setup() - end - }, - { - "NeogitOrg/neogit", - dependencies = { - "nvim-lua/plenary.nvim", - { - "sindrets/diffview.nvim", - lazy = true, - enabled = true, - event = "BufRead", - } - }, - config = function() - require("plugin.config.neogit").setup() - end - }, - - "jiangmiao/auto-pairs", - { "tpope/vim-surround", event = "BufEnter" }, - { "tpope/vim-repeat", event = "BufEnter" }, - - -- colorscheme - { "catppuccin/nvim", name = "catppuccin", priority = 1000 }, - { "Alexis12119/nightly.nvim", name = "nightly", priority = 1000 }, - { "rafamadriz/neon", name = "neon", priority = 1000 }, - { "rebelot/kanagawa.nvim", priority = 1000 }, - { "folke/tokyonight.nvim", priority = 1000 }, - - -- statusline - { - "nvim-lualine/lualine.nvim", - config = function() - require("plugin.config.statusline").setup() - end, - dependencies = { - "kyazdani42/nvim-web-devicons", - } - }, - - { - "lukas-reineke/indent-blankline.nvim", - main = "ibl", - config = function() - require("plugin.config.indent_blankline").setup() - end - }, -- Add indentation guides even on blank lines - - { - "numToStr/Comment.nvim", - config = function() - require("Comment").setup({ - pre_hook = require("ts_context_commentstring.integrations.comment_nvim").create_pre_hook() - }) - end, - dependencies = { - "nvim-ts-context-commentstring", - "JoosepAlviste/nvim-ts-context-commentstring" - } - }, -- "gc" to comment visual regions/lines - - "tpope/vim-sleuth", -- Detect tabstop and shiftwidth automatically - { -- braket and tag - "windwp/nvim-autopairs", - config = function() - require("plugin.config.autopairs").setup() - end - }, - - { - "max397574/better-escape.nvim", - event = "InsertEnter", - config = function() - require("better_escape").setup { - mapping = { "jk" }, -- a table with mappings to use - } - end - }, - - { - -- File manager - "nvim-tree/nvim-tree.lua", - version = "nightly", - event = "VimEnter", - config = function() - require("plugin.config.nvimtree").setup() - end, - dependencies = { - { - "antosha417/nvim-lsp-file-operations", - config = function() - require("lsp-file-operations").setup() - end - } - } - }, - { - -- Notifocation - "rcarriga/nvim-notify", - event = "VeryLazy", - config = function() - require("plugin.config.notification").setup() - end, - lazy = false - }, - - { - -- Bufferline - "akinsho/bufferline.nvim", - version = "v3.*", - config = function() - require("plugin.config.bufferline").setup() - end - }, - - { - -- Telescope - "nvim-telescope/telescope.nvim", - event = { "VimEnter" }, - cmd = { "Telescope" }, - version = "0.1.x", - dependencies = { - "nvim-lua/plenary.nvim", - { - "nvim-telescope/telescope-fzf-native.nvim", - run = "make", - cond = vim.fn.executable "make" == 1, - }, - -- "debugloop/telescope-undo.nvim" - "nvim-telescope/telescope-symbols.nvim", - "desdic/agrolens.nvim", - }, - config = function() - require("plugin.config.telescope").setup() - end - }, - - { - "kevinhwang91/nvim-bqf", - ft = "qf", - cmd = "BqfAutoToggle", - event = "QuickFixCmdPost", - }, - - { - -- Lastplace - "ethanholz/nvim-lastplace", - event = "BufRead", - config = function() - require("plugin.config.lastplace").setup() - end - }, - - { - -- keymaps, commands, and autocommands - "mrjones2014/legendary.nvim", - priority = 10000, - lazy = false, - dependencies = { - "kkharji/sqlite.lua", - { - "stevearc/dressing.nvim", - event = "VeryLazy", - config = function() - require("dressing").setup() - end - } - }, - config = function() - require("plugin.config.legendary").setup() - end - }, - { - "monaqa/dial.nvim", - event = "VeryLazy", - keys = { "", { "", mode = "n" } }, - }, - { - "mvllow/modes.nvim", - event = "VeryLazy", - config = function() - require("plugin.config.modes").setup() - end - }, - - { - "gen740/SmoothCursor.nvim", - event = "VeryLazy", - config = function() - require("plugin.config.smoothcursor").setup() - end - }, - - { - "NTBBloodbath/rest.nvim", - event = "VeryLazy", - dependencies = { - "nvim-lua/plenary.nvim" - }, - config = function() - require("plugin.config.rest").setup() - end - }, - { - "folke/flash.nvim", - event = "VeryLazy", - keys = { - { "s", mode = { "n", "x", "o" }, function() require("flash").jump() end, desc = "Flash" }, - { "S", mode = { "n", "o", "x" }, 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, - "Treesitter Search" - }, - { - "", - mode = { "c" }, - function() require("flash").toggle() end, - desc = - "Toggle Flash Search" - }, - }, - }, - - { - -- Dashboard - "goolord/alpha-nvim", - event = "VimEnter", - config = function() - require("plugin.config.dashboard").setup() - end - }, - - { - -- Split - "Wansmer/treesj", - event = "BufWinEnter", - dependencies = { "nvim-treesitter/nvim-treesitter" }, - config = function() - require("plugin.config.treesj").setup() - end, - }, - - { -- tmux nav for nvim - "alexghergh/nvim-tmux-navigation", - event = "VeryLazy", - config = function() - require "nvim-tmux-navigation".setup { - disable_when_zoomed = true, - keybindings = { - left = "", - down = "", - up = "", - right = "", - } - } - end - }, - - { - "cpea2506/relative-toggle.nvim", - config = function() - require("plugin.config.relativenumber").setup() - end - }, - - { - "ray-x/sad.nvim", - event = "VeryLazy", - dependencies = { "ray-x/guihua.lua", run = "cd lua/fzy && make" }, - config = function() - require("sad").setup {} - end, - }, - -- { - -- "akinsho/toggleterm.nvim", - -- lazy = true, - -- cmd = { - -- "ToggleTerm", - -- "ToggleTermSetName", - -- "ToggleTermToggleAll", - -- "ToggleTermSendVisualLines", - -- "ToggleTermSendCurrentLine", - -- "ToggleTermSendVisualSelection", - -- }, - -- config = function() - -- require("toggleterm").setup() - -- end, - -- } -} - -local opts = { - spec = { - { import = "base" }, - { import = "pde" }, - }, - install = { - missing = true, - colorscheme = { - "catppuccin", - "tokyonight", - }, - }, - rtp = { - disabled_plugins = { - "2html_plugin", - "tohtml", - "getscript", - "getscriptPlugin", - "gzip", - "logipat", - "netrw", - "netrwPlugin", - "netrwSettings", - "netrwFileHandlers", - "matchit", - "tar", - "tarPlugin", - "rrhelper", - "spellfile", - "spellfile_plugin", - "vimball", - "vimballPlugin", - "zip", - "zipPlugin", - "tutor", - "rplugin", - "syntax", - "synmenu", - "optwin", - "compiler", - "bugreport", - } - } -} - -require("lazy").setup(plugins, opts) -require("plugin.config.colorscheme").setup() - - -------------------------------- ------------- keymaps ---------- -------------------------------- -require("core.default_config").keymaps.default() diff --git a/lua/plugins/basic.lua b/lua/plugins/basic.lua new file mode 100644 index 0000000..1515d74 --- /dev/null +++ b/lua/plugins/basic.lua @@ -0,0 +1,37 @@ +return { + { + -- tmux nav for nvim + "alexghergh/nvim-tmux-navigation", + event = "VeryLazy", + config = function() + require "nvim-tmux-navigation".setup { + disable_when_zoomed = true, + keybindings = { + left = "", + down = "", + up = "", + right = "", + } + } + end + }, + { + 'stevearc/oil.nvim', + dependencies = { "nvim-tree/nvim-web-devicons" }, + keys = { + { "n", mode = { "n" }, "Oil", desc = "Oil Explorer" }, + }, + opts = { + default_file_explorer = true, + columns = { + "icon", + "permissions", + "size", + "mtime", + }, + }, + }, + "jiangmiao/auto-pairs", + { "tpope/vim-surround", event = "BufEnter" }, + { "tpope/vim-repeat", event = "BufEnter" }, +} diff --git a/lua/plugins/cmp.lua b/lua/plugins/cmp.lua new file mode 100644 index 0000000..4751c3d --- /dev/null +++ b/lua/plugins/cmp.lua @@ -0,0 +1,31 @@ +-- Auto Completion: Cmp + +return { + "hrsh7th/nvim-cmp", + event = "InsertEnter", + dependencies = { + "hrsh7th/cmp-nvim-lsp", + "saadparwaiz1/cmp_luasnip", + "hrsh7th/cmp-buffer", + "hrsh7th/cmp-path", + "hrsh7th/cmp-nvim-lua", + "ray-x/cmp-treesitter", + "lukas-reineke/cmp-rg", + "quangnguyen30192/cmp-nvim-tags", + "andersevenrud/cmp-tmux", + "saadparwaiz1/cmp_luasnip", + "L3MON4D3/LuaSnip", + "rafamadriz/friendly-snippets", + "lukas-reineke/cmp-under-comparator", + { + "honza/vim-snippets", + dependencies = { + "friendly-snippets", + "vim-snippets", + } + } + }, + config = function() + require("utils.cmp").setup() + end +} diff --git a/lua/plugins/lsp/lspconfig.lua b/lua/plugins/lsp/lspconfig.lua new file mode 100644 index 0000000..495380a --- /dev/null +++ b/lua/plugins/lsp/lspconfig.lua @@ -0,0 +1,166 @@ +return { + "neovim/nvim-lspconfig", + event = { "BufReadPre", "BufNewFile" }, + dependencies = { + "hrsh7th/cmp-nvim-lsp", + { "antosha417/nvim-lsp-file-operations", config = true }, + { "folke/neoconf.nvim", cmd = "Neoconf", config = true }, + { "folke/neodev.nvim", config = true }, + { "j-hui/fidget.nvim", branch = "legacy" }, + }, + config = function() + local lspconfig = require("lspconfig") + local cmp_nvim_lsp = require("cmp_nvim_lsp") + + local keymap = vim.keymap -- for conciseness + + local opts = { noremap = true, silent = true } + local on_attach = function(client, bufnr) + opts.buffer = bufnr + opts.desc = "Show LSP references" + keymap.set("n", "gr", "Telescope lsp_references", opts) -- show definition, references + + opts.desc = "Go to declaration" + keymap.set("n", "gD", vim.lsp.buf.declaration, opts) -- go to declaration + + opts.desc = "Show LSP definitions" + keymap.set("n", "gd", "Telescope lsp_definitions", opts) -- show lsp definitions + + opts.desc = "Show LSP implementations" + keymap.set("n", "gi", "Telescope lsp_implementations", opts) -- show lsp implementations + + opts.desc = "Show LSP type definitions" + keymap.set("n", "gt", "Telescope lsp_type_definitions", opts) -- show lsp type definitions + + opts.desc = "See available code actions" + keymap.set({ "n", "v" }, "ca", vim.lsp.buf.code_action, opts) -- see available code actions, in visual mode will apply to selection + + opts.desc = "Smart rename" + keymap.set("n", "rn", vim.lsp.buf.rename, opts) -- smart rename + + opts.desc = "Show buffer diagnostics" + keymap.set("n", "D", "Telescope diagnostics bufnr=0", opts) -- show diagnostics for file + + opts.desc = "Show line diagnostics" + keymap.set("n", "d", vim.diagnostic.open_float, opts) -- show diagnostics for line + + opts.desc = "Go to previous diagnostic" + keymap.set("n", "[d", vim.diagnostic.goto_prev, opts) -- jump to previous diagnostic in buffer + + opts.desc = "Go to next diagnostic" + keymap.set("n", "]d", vim.diagnostic.goto_next, opts) -- jump to next diagnostic in buffer + + opts.desc = "Show documentation for what is under cursor" + keymap.set("n", "K", vim.lsp.buf.hover, opts) -- show documentation for what is under cursor + + opts.desc = "Restart LSP" + keymap.set("n", "rs", ":LspRestart", opts) -- mapping to restart lsp if necessary + end + + -- used to enable autocompletion (assign to every lsp server config) + local capabilities = cmp_nvim_lsp.default_capabilities() + + -- Change the Diagnostic symbols in the sign column (gutter) + -- (not in youtube nvim video) + local signs = { + Error = " ", + Warn = " ", + Hint = "󰠠 ", + Info = " ", + } + for type, icon in pairs(signs) do + local hl = "DiagnosticSign" .. type + vim.fn.sign_define(hl, { text = icon, texthl = hl, numhl = "" }) + end + + if vim.lsp.setup then + vim.lsp.setup { + floating_preview = { border = { "╭", "─", "╮", "│", "╯", "─", "╰", "│" } }, + diagnostics = { + signs = { error = " ", warning = " ", hint = " ", information = " " }, + display = { + underline = true, + update_in_insert = false, + virtual_text = false, + severity_sort = true, + }, + }, + completion = { + kind = { + Class = " ", + Color = " ", + Constant = " ", + Constructor = " ", + Enum = "了 ", + EnumMember = " ", + Field = " ", + File = " ", + Folder = " ", + Function = " ", + Interface = "ﰮ ", + Keyword = " ", + Method = "ƒ ", + Module = " ", + Property = " ", + Snippet = " ", + Struct = " ", + Text = " ", + Unit = " ", + Value = " ", + Variable = " ", + }, + }, + } + else + end + + + -- configure html server + lspconfig["html"].setup({ + capabilities = capabilities, + on_attach = on_attach, + }) + + -- configure typescript server with plugin + lspconfig["tsserver"].setup({ + capabilities = capabilities, + on_attach = on_attach, + }) + + -- configure css server + lspconfig["cssls"].setup({ + capabilities = capabilities, + on_attach = on_attach, + }) + + -- configure emmet language server + lspconfig["emmet_ls"].setup({ + capabilities = capabilities, + on_attach = on_attach, + filetypes = { "html", "typescriptreact", "javascriptreact", "css", "sass", "scss", "less", "svelte" }, + }) + + -- configure lua server (with special settings) + lspconfig["lua_ls"].setup({ + capabilities = capabilities, + on_attach = on_attach, + settings = { -- custom settings for lua + Lua = { + -- make the language server recognize "vim" global + diagnostics = { + globals = { "vim" }, + }, + workspace = { + -- make language server aware of runtime files + library = { + [vim.fn.expand("$VIMRUNTIME/lua")] = true, + [vim.fn.stdpath("config") .. "/lua"] = true, + }, + }, + }, + }, + }) + -- Turn on lsp status information + require("fidget").setup() + end, +} diff --git a/lua/plugins/lsp/mason.lua b/lua/plugins/lsp/mason.lua new file mode 100644 index 0000000..917fca6 --- /dev/null +++ b/lua/plugins/lsp/mason.lua @@ -0,0 +1,32 @@ +return { + "williamboman/mason.nvim", + dependencies = { + "williamboman/mason-lspconfig.nvim", + "WhoIsSethDaniel/mason-tool-installer.nvim", + }, + config = function() + local mason = require("mason") + local mason_lspconfig = require("mason-lspconfig") + local mason_tool_installer = require("mason-tool-installer") + + mason.setup({ + ui = { + icons = { + package_installed = "✓", + package_pending = "➜", + package_uninstalled = "✗", + }, + }, + }) + + mason_lspconfig.setup({ + ensure_installed = { + "tsserver", + "html", + "cssls", + "lua_ls", + }, + automatic_installation = true, + }) + end, +} diff --git a/lua/plugins/telescope.lua b/lua/plugins/telescope.lua new file mode 100644 index 0000000..2d15f18 --- /dev/null +++ b/lua/plugins/telescope.lua @@ -0,0 +1,44 @@ +return { + { + "nvim-telescope/telescope.nvim", + event = { "VimEnter" }, + cmd = { "Telescope" }, + version = "0.1.x", + dependencies = { + "nvim-lua/plenary.nvim", + { + "nvim-telescope/telescope-fzf-native.nvim", + run = "make", + cond = vim.fn.executable "make" == 1, + }, + "nvim-telescope/telescope-symbols.nvim", + "desdic/agrolens.nvim", + }, + keys = {}, + config = function() + require("utils.telescope").setup() + end + }, + { + "folke/flash.nvim", + event = "VeryLazy", + keys = { + { "s", mode = { "n", "x", "o" }, function() require("flash").jump() end, desc = "Flash" }, + { "S", mode = { "n", "o", "x" }, 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, + "Treesitter Search" + }, + { + "", + mode = { "c" }, + function() require("flash").toggle() end, + desc = + "Toggle Flash Search" + }, + }, + }, +} diff --git a/lua/plugins/treesitter.lua b/lua/plugins/treesitter.lua new file mode 100644 index 0000000..bed5102 --- /dev/null +++ b/lua/plugins/treesitter.lua @@ -0,0 +1,162 @@ +return { + { + "nvim-treesitter/nvim-treesitter", + event = { + "BufReadPost", + "BufNewFile", + }, + dependencies = { + "JoosepAlviste/nvim-ts-context-commentstring", + "nvim-treesitter/nvim-treesitter-textobjects", + "p00f/nvim-ts-rainbow", + "HiPhish/nvim-ts-rainbow2", + "windwp/nvim-ts-autotag", + "mizlan/iswap.nvim", + { + "m-demare/hlargs.nvim", + config = function() + require("hlargs").setup() + end + }, + { + "ZhiyuanLck/smart-pairs", + event = "InsertEnter", + config = function() + require("pairs"):setup() + end + } + }, + build = function() + pcall(require("nvim-treesitter.install").update { with_sync = false }) + end, + config = function() + local status, treesitter = pcall(require, "nvim-treesitter.configs") + if (not status) then return end + treesitter.setup { + ensure_installed = { + "cpp", + "python", + "html", + "javascript", + "typescript", + "json", + "json5", + "jsonc", + "go", + "gomod", + "bash", + "lua", + "luadoc", + "luap", + "comment", + "markdown", + "markdown_inline", + "glimmer", + "regex", + "vim", + "vimdoc", + "yaml", + "toml", + "tsx", + "css", + "scss", + "dockerfile", + }, + sync_install = false, + highlight = { + enable = true, + additional_vim_regex_highlighting = false, + disable = { "cpp", "latex" }, + }, + indent = { + enable = { "javascriptreact" }, + disable = { 'python' }, + }, + autotag = { enable = true }, + incremental_selection = { + enable = true, + keymaps = { + init_selection = '', + node_incremental = '', + scope_incremental = '', + node_decremental = '', + }, + }, + rainbow = { + enable = true, + extendend_mode = true, + max_file_lines = 1000, + query = 'rainbow-parens', + strategy = require('ts-rainbow').strategy.global, + }, + context_commentstring = { + enable = true, + enable_autocmd = false + }, + textobjects = { + select = { + enable = true, + lookahead = true, -- Automatically jump forward to textobj, similar to targets.vim + keymaps = { + -- You can use the capture groups defined in textobjects.scm + ['aa'] = '@parameter.outer', + ['ia'] = '@parameter.inner', + ['af'] = '@function.outer', + ['if'] = '@function.inner', + ['ac'] = '@class.outer', + ['ic'] = '@class.inner', + }, + }, + move = { + enable = true, + set_jumps = true, -- whether to set jumps in the jumplist + goto_next_start = { + [']m'] = '@function.outer', + [']]'] = '@class.outer', + }, + goto_next_end = { + [']M'] = '@function.outer', + [']['] = '@class.outer', + }, + goto_previous_start = { + ['[m'] = '@function.outer', + ['[['] = '@class.outer', + }, + goto_previous_end = { + ['[M'] = '@function.outer', + ['[]'] = '@class.outer', + }, + }, + swap = { + enable = true, + swap_next = { + ['a'] = '@parameter.inner', + }, + swap_previous = { + ['A'] = '@parameter.inner', + }, + }, + }, + } + end, + }, + { + "lukas-reineke/indent-blankline.nvim", + main = "ibl", + config = function() + require("utils.indent_blankline").setup() + end + }, + { + "numToStr/Comment.nvim", + config = function() + require("Comment").setup({ + pre_hook = require("ts_context_commentstring.integrations.comment_nvim").create_pre_hook() + }) + end, + dependencies = { + "nvim-ts-context-commentstring", + "JoosepAlviste/nvim-ts-context-commentstring" + } + }, +} diff --git a/lua/plugin/config/cmp.lua b/lua/utils/cmp.lua similarity index 99% rename from lua/plugin/config/cmp.lua rename to lua/utils/cmp.lua index 81227df..851809d 100644 --- a/lua/plugin/config/cmp.lua +++ b/lua/utils/cmp.lua @@ -14,9 +14,9 @@ local types = require("cmp.types") local lsp_symbol = "" -local luasnip_symbol = "﬌" +local luasnip_symbol = "" local treesitter_symbol = "" -local buffer_symbol = "﬘" +local buffer_symbol = "" local tags_symbol = "" local rg_symbol = "" local path_symbol = "" diff --git a/lua/plugin/config/indent_blankline.lua b/lua/utils/indent_blankline.lua similarity index 99% rename from lua/plugin/config/indent_blankline.lua rename to lua/utils/indent_blankline.lua index 0e37e9c..011a2a3 100644 --- a/lua/plugin/config/indent_blankline.lua +++ b/lua/utils/indent_blankline.lua @@ -35,3 +35,4 @@ function M.setup() end return M + diff --git a/lua/plugin/config/telescope.lua b/lua/utils/telescope.lua similarity index 84% rename from lua/plugin/config/telescope.lua rename to lua/utils/telescope.lua index 023b893..bc27d4f 100644 --- a/lua/plugin/config/telescope.lua +++ b/lua/utils/telescope.lua @@ -1,5 +1,5 @@ local M = {} -local telescope = require('telescope') +local telescope = require("telescope") function M.setup() telescope.setup { @@ -128,27 +128,5 @@ function M.treesitter() } end -function M.colorscheme_picker() - local ui = require("core.default_config").ui - require('telescope.pickers').new({}, { - prompt_title = "Select ColorScheme", - finder = require('telescope.finders').new_table({ - results = ui.theme_toggle - }), - sorter = require('telescope.config').values.generic_sorter({}), - attach_mappings = function(prompt_bufnr, map) - local select_theme = function() - local selection = require('telescope.actions').get_selected_entry() - if selection then - ui.theme = selection.value - end - end - map('i', '', select_theme) - map('n', '', select_theme) - return true - end - }):find() -end - return M From 6d771e30bb32532d2521b2db4f9f364c927401cf Mon Sep 17 00:00:00 2001 From: Raju Ghorai Date: Tue, 31 Oct 2023 19:45:47 +0530 Subject: [PATCH 02/23] =?UTF-8?q?=F0=9F=98=B3=20Added:=20colorscheme?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lua/config/init.lua | 1 + lua/config/lazy.lua | 2 + lua/plugins/basic.lua | 40 ++++++++++++++- lua/plugins/colorschemes/catppuccin.lua | 65 +++++++++++++++++++++++++ lua/plugins/colorschemes/kanagawa.lua | 52 ++++++++++++++++++++ lua/plugins/colorschemes/tokyonight.lua | 28 +++++++++++ lua/plugins/telescope.lua | 16 +++++- 7 files changed, 202 insertions(+), 2 deletions(-) create mode 100644 lua/plugins/colorschemes/catppuccin.lua create mode 100644 lua/plugins/colorschemes/kanagawa.lua create mode 100644 lua/plugins/colorschemes/tokyonight.lua diff --git a/lua/config/init.lua b/lua/config/init.lua index 74740c5..d4c1c10 100644 --- a/lua/config/init.lua +++ b/lua/config/init.lua @@ -1,2 +1,3 @@ require("config.options") require("config.lazy") +vim.cmd[[colorscheme catppuccin]] diff --git a/lua/config/lazy.lua b/lua/config/lazy.lua index d2aa059..3b9b02c 100644 --- a/lua/config/lazy.lua +++ b/lua/config/lazy.lua @@ -28,6 +28,7 @@ require("lazy").setup({ spec = { { import = "plugins" }, { import = "plugins.lsp" }, + { import = "plugins.colorschemes" }, }, defaults = { lazy = false, @@ -46,3 +47,4 @@ require("lazy").setup({ }, }, }, opts) + diff --git a/lua/plugins/basic.lua b/lua/plugins/basic.lua index 1515d74..2cc95a5 100644 --- a/lua/plugins/basic.lua +++ b/lua/plugins/basic.lua @@ -16,7 +16,7 @@ return { end }, { - 'stevearc/oil.nvim', + "stevearc/oil.nvim", dependencies = { "nvim-tree/nvim-web-devicons" }, keys = { { "n", mode = { "n" }, "Oil", desc = "Oil Explorer" }, @@ -34,4 +34,42 @@ return { "jiangmiao/auto-pairs", { "tpope/vim-surround", event = "BufEnter" }, { "tpope/vim-repeat", event = "BufEnter" }, + + { + "max397574/better-escape.nvim", + event = "InsertEnter", + config = function() + require("better_escape").setup { + mapping = { "jk" }, -- a table with mappings to use + } + end + }, + { + -- Lastplace + "ethanholz/nvim-lastplace", + event = "BufRead", + config = function() + local status, lastplace = pcall(require, "nvim-lastplace") + if (not status) then return end + lastplace.setup({ + lastplace_ignore_buftype = { + "quickfix", + "nofile", + "help", + }, + lastplace_ignore_filetype = { + "gitcommit", + "gitrebase", + "svn", + "hgcommit", + }, + lastplace_open_folds = true, + }) + end + }, + { + "monaqa/dial.nvim", + event = "VeryLazy", + keys = { "", { "", mode = "n" } }, + }, } diff --git a/lua/plugins/colorschemes/catppuccin.lua b/lua/plugins/colorschemes/catppuccin.lua new file mode 100644 index 0000000..1584aa9 --- /dev/null +++ b/lua/plugins/colorschemes/catppuccin.lua @@ -0,0 +1,65 @@ +if true then + return { + "catppuccin/nvim", + name = "catppuccin", + priority = 1000, + config = function() + require("catppuccin").setup({ + flavour = "mocha", + background = { + dark = "mocha", + }, + transparent_background = true, + show_end_of_buffer = false, + term_colors = true, + dim_inactive = { + enabled = false, + shade = "light", + percentage = 0.10, + }, + styles = { + comments = { "italic" }, + conditionals = { "italic" }, + loops = { "reverse" }, + functions = { "italic" }, + keywords = {}, + strings = {}, + variables = { "italic" }, + numbers = {}, + booleans = { "italic" }, + properties = {}, + types = {}, + operators = {}, + }, + integrations = { + flash = true, + alpha = true, + cmp = true, + gitsigns = true, + nvimtree = true, + treesitter = true, + notify = true, + neogit = true, + treesitter_context = true, + ts_rainbow2 = true, + ts_rainbow = true, + indent_blankline = { enabled = true }, + mason = true, + telescope = { + enabled = true, + style = "nvchad", + }, + native_lsp = { + enabled = true, + underlines = { + errors = { "undercurl" }, + hints = { "undercurl" }, + warnings = { "undercurl" }, + information = { "undercurl" }, + }, + }, + }, + }) + end, + } +end diff --git a/lua/plugins/colorschemes/kanagawa.lua b/lua/plugins/colorschemes/kanagawa.lua new file mode 100644 index 0000000..bb9618f --- /dev/null +++ b/lua/plugins/colorschemes/kanagawa.lua @@ -0,0 +1,52 @@ +if true then + return { + "rebelot/kanagawa.nvim", + priority = 1000, + config = function() + require('kanagawa').setup({ + compile = true, + commentStyle = { italic = true }, + functionStyle = { italic = true }, + keywordStyle = { italic = true }, + statementStyle = { bold = true }, + typeStyle = {}, + transparent = false, + theme = "dragon", + colors = { + palette = {}, + theme = { + wave = {}, + lotus = {}, + dragon = {}, + all = { + ui = { + bg_gutter = "none" + } + } + }, + }, + overrides = function(colors) + local theme = colors.theme + return { + TelescopeTitle = { bold = true }, + TelescopePromptNormal = { bg = theme.ui.bg_p1, fg = "none" }, + TelescopePromptBorder = { fg = theme.ui.bg_p1, bg = "none" }, + TelescopeResultsNormal = { fg = theme.ui.fg_dim, bg = "none" }, + TelescopeResultsBorder = { fg = theme.ui.bg_m1, bg = "none" }, + TelescopePreviewNormal = { bg = theme.ui.bg_dim }, + -- TelescopePreviewBorder = { bg = theme.ui.bg_dim, fg = theme.ui.bg_dim }, + -- NormalFloat = { bg = "none" }, + LineNr = { bg = "none" }, + CursorLineNr = { bg = "none" }, + GitsignsAdd = { bg = "none" }, + GitSignsChange = { bg = "none" }, + GitsignsDelete = { bg = "none" }, + } + end, + background = { + dark = "dragon", + }, + }) + end + } +end diff --git a/lua/plugins/colorschemes/tokyonight.lua b/lua/plugins/colorschemes/tokyonight.lua new file mode 100644 index 0000000..a616ff0 --- /dev/null +++ b/lua/plugins/colorschemes/tokyonight.lua @@ -0,0 +1,28 @@ +if true then + return { + "folke/tokyonight.nvim", + name = "tokyonight", + priority = 1000, + config = function() + require("tokyonight").setup({ + style = "moon", + light_style = "night", + transparent = true, + terminal_colors = true, + styles = { + comments = { italic = true }, + keywords = { italic = true }, + functions = { italic = true }, + variables = { italic = true }, + sidebars = "dark", + floats = "dark", + }, + sidebars = { "qf", "help" }, + day_brightness = 0.3, + hide_inactive_statusline = true, + dim_inactive = true, + lualine_bold = true, + }) + end, + } +end diff --git a/lua/plugins/telescope.lua b/lua/plugins/telescope.lua index 2d15f18..c52a779 100644 --- a/lua/plugins/telescope.lua +++ b/lua/plugins/telescope.lua @@ -14,7 +14,21 @@ return { "nvim-telescope/telescope-symbols.nvim", "desdic/agrolens.nvim", }, - keys = {}, + keys = { + { + "?", + mode = { "n" }, + function() require("telescope.builtin").oldfiles() end, + desc = + "[?] Find recently opened files" + }, + { + "sf", + mode = { "n" }, + function() require("telescope.builtin").find_files() end, + desc = "[S]earch [F]iles", + }, + }, config = function() require("utils.telescope").setup() end From 7606bc53d9280f1c7923853bfdffc24a7ca546a1 Mon Sep 17 00:00:00 2001 From: Raju Ghorai Date: Tue, 31 Oct 2023 21:24:50 +0530 Subject: [PATCH 03/23] =?UTF-8?q?=F0=9F=92=8BFix:=20git,=20statusline=20an?= =?UTF-8?q?d=20telescope?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lua/config/init.lua | 1 + lua/config/keymaps.lua | 12 ++++ lua/plugins/basic.lua | 88 +++++++++++++++++++++-- lua/plugins/git.lua | 95 +++++++++++++++++++++++++ lua/plugins/statusline.lua | 10 +++ lua/plugins/telescope.lua | 32 ++++++++- lua/plugins/treesitter.lua | 30 ++++++-- lua/utils/lualine.lua | 142 +++++++++++++++++++++++++++++++++++++ 8 files changed, 399 insertions(+), 11 deletions(-) create mode 100644 lua/config/keymaps.lua create mode 100644 lua/plugins/git.lua create mode 100644 lua/plugins/statusline.lua create mode 100644 lua/utils/lualine.lua diff --git a/lua/config/init.lua b/lua/config/init.lua index d4c1c10..9d787c7 100644 --- a/lua/config/init.lua +++ b/lua/config/init.lua @@ -1,3 +1,4 @@ require("config.options") require("config.lazy") +require("config.keymaps") vim.cmd[[colorscheme catppuccin]] diff --git a/lua/config/keymaps.lua b/lua/config/keymaps.lua new file mode 100644 index 0000000..2005326 --- /dev/null +++ b/lua/config/keymaps.lua @@ -0,0 +1,12 @@ +local keymap = vim.api.nvim_set_keymap +local opts = { noremap = true, silent = true } + +keymap("n", "", ":nohlsearch", {}) +keymap("n", "aa", ":hide", opts) + +-- Stay in indent mode +keymap("v", "<", "", ">gv", opts) + +keymap("n", "v", ":vsp", opts) +keymap("n", "V", ":sp", opts) diff --git a/lua/plugins/basic.lua b/lua/plugins/basic.lua index 2cc95a5..85fb502 100644 --- a/lua/plugins/basic.lua +++ b/lua/plugins/basic.lua @@ -19,7 +19,8 @@ return { "stevearc/oil.nvim", dependencies = { "nvim-tree/nvim-web-devicons" }, keys = { - { "n", mode = { "n" }, "Oil", desc = "Oil Explorer" }, + { "n", mode = { "n" }, "Oil", desc = "Oil Explorer Current" }, + { "N", mode = { "n" }, "Oil .", desc = "Oil Explorer Root" }, }, opts = { default_file_explorer = true, @@ -34,13 +35,12 @@ return { "jiangmiao/auto-pairs", { "tpope/vim-surround", event = "BufEnter" }, { "tpope/vim-repeat", event = "BufEnter" }, - { "max397574/better-escape.nvim", event = "InsertEnter", config = function() require("better_escape").setup { - mapping = { "jk" }, -- a table with mappings to use + mapping = { "jk" }, } end }, @@ -68,8 +68,86 @@ return { end }, { - "monaqa/dial.nvim", + "cpea2506/relative-toggle.nvim", + config = function() + local status, relativetoggle = pcall(require, "relative-toggle") + if (not status) then return end + relativetoggle.setup({ + pattern = "*", + events = { + on = { + "BufEnter", + "FocusGained", + "InsertLeave", + "WinEnter", + "CmdlineLeave", + }, + off = { + "BufLeave", + "FocusLost", + "InsertEnter", + "WinLeave", + "CmdlineEnter", + }, + }, + }) + end + }, + { + "rcarriga/nvim-notify", + priority = 1000, event = "VeryLazy", - keys = { "", { "", mode = "n" } }, + config = function() + local status, notify = pcall(require, "notify") + if (not status) then return end + notify.setup({ + stages = "fade_in_slide_out", + render = "compact", + timeout = 1500, + fps = 20, + max_height = function() + return math.floor(vim.o.lines * 0.75) + end, + max_width = function() + return math.floor(vim.o.columns * 0.75) + end, + background_colour = "#000000", + minimum_width = 26, + icons = { + ERROR = "", + WARN = "", + INFO = "", + DEBUG = "", + TRACE = "✎", + } + }) + vim.notify = notify + end, + lazy = false + }, + { + "echasnovski/mini.bufremove", + + keys = { + { + "bd", + function() + local bd = require("mini.bufremove").delete + if vim.bo.modified then + local choice = vim.fn.confirm(("Save changes to %q?"):format(vim.fn.bufname()), "&Yes\n&No\n&Cancel") + if choice == 1 then -- Yes + vim.cmd.write() + bd(0) + elseif choice == 2 then -- No + bd(0, true) + end + else + bd(0) + end + end, + desc = "Delete Buffer", + }, + { "bD", function() require("mini.bufremove").delete(0, true) end, desc = "Delete Buffer (Force)" }, + }, }, } diff --git a/lua/plugins/git.lua b/lua/plugins/git.lua new file mode 100644 index 0000000..e7c0679 --- /dev/null +++ b/lua/plugins/git.lua @@ -0,0 +1,95 @@ +return { + { + "lewis6991/gitsigns.nvim", + event = { "BufRead" }, + config = function() + local status, gitsigns = pcall(require, 'gitsigns') + if (not status) then return end + + gitsigns.setup { + signs = { + add = { + text = "▎", + hl = "GitSignsAdd", + numhl = "GitSignsAddNr", + linehl = "GitSignsAddLn", + }, + delete = { + text = "_", + hl = "GitSignsDelete", + numhl = "GitSignsDeleteNr", + linehl = "GitSignsDeleteLn", + }, + change = { + text = "▎", + hl = "GitSignsChange", + numhl = "GitSignsChangeNr", + linehl = "GitSignsChangeLn", + }, + changedelete = { + text = "▎", + hl = "GitSignsDelete", + numhl = "GitSignsChangeNr", + linehl = "GitSignsChangeLn", + }, + topdelete = { + text = '‾', + hl = "GitSignsDelete", + numhl = "GitSignsDeleteNr", + linehl = "GitSignsDeleteLn", + }, + }, + numhl = false, + linehl = false, + watch_gitdir = { + interval = 1000, + follow_files = true, + }, + current_line_blame_opts = { + virt_text = true, + virt_text_pos = "eol", + delay = 1000, + ignore_whitespace = false + }, + current_line_blame_formatter_opts = { relative_time = true }, + sign_priority = 6, + update_debounce = 100, + status_formatter = nil, + max_file_length = 40000, + preview_config = { + border = "shadow", + style = "minimal", + relative = "cursor", + row = 0, + col = 1 + } + } + end + }, + { + "NeogitOrg/neogit", + event = "VimEnter", + dependencies = { + "nvim-lua/plenary.nvim", + { + "sindrets/diffview.nvim", + lazy = true, + enabled = true, + event = "BufRead", + } + }, + keys = { + { "l", mode = { "n" }, "Neogit", desc = "Git" }, + { "L", mode = { "n" }, "Neogit commit", desc = "Git" }, + }, + config = function() + require('neogit').setup { + kind = "vsplit", + integrations = { + telescope = true, + diffview = true, + } + } + end + }, +} diff --git a/lua/plugins/statusline.lua b/lua/plugins/statusline.lua new file mode 100644 index 0000000..d9364cf --- /dev/null +++ b/lua/plugins/statusline.lua @@ -0,0 +1,10 @@ +return { + "nvim-lualine/lualine.nvim", + event = "VimEnter", + dependencies = { + "kyazdani42/nvim-web-devicons", + }, + config = function() + require("utils.lualine").setup() + end, +} diff --git a/lua/plugins/telescope.lua b/lua/plugins/telescope.lua index c52a779..ab04f5b 100644 --- a/lua/plugins/telescope.lua +++ b/lua/plugins/telescope.lua @@ -11,8 +11,6 @@ return { run = "make", cond = vim.fn.executable "make" == 1, }, - "nvim-telescope/telescope-symbols.nvim", - "desdic/agrolens.nvim", }, keys = { { @@ -28,6 +26,36 @@ return { function() require("telescope.builtin").find_files() end, desc = "[S]earch [F]iles", }, + { + "sw", + mode = { "n" }, + function() require("telescope.builtin").grep_string() end, + desc = "[S]earch current [W]ord", + }, + { + "sg", + mode = { "n" }, + function() require("telescope.builtin").live_grep() end, + desc = "[S]earch by [G]rep", + }, + { + "st", + mode = { "n" }, + function() require("telescope.builtin").tags() end, + desc = "[S]earch by [T]ags", + }, + { + "", + mode = { "n" }, + function() require("telescope.builtin").buffers() end, + desc = "[/] Fuzzily search in current buffer", + }, + { + "/", + mode = { "n" }, + function() require("utils.telescope").current_buffer_fuzzy_find() end, + desc = "[/] Fuzzily search in current buffer", + }, }, config = function() require("utils.telescope").setup() diff --git a/lua/plugins/treesitter.lua b/lua/plugins/treesitter.lua index bed5102..d890843 100644 --- a/lua/plugins/treesitter.lua +++ b/lua/plugins/treesitter.lua @@ -1,10 +1,12 @@ return { { "nvim-treesitter/nvim-treesitter", - event = { - "BufReadPost", - "BufNewFile", - }, + event = { "VeryLazy", "BufReadPost", "BufNewFile" }, + init = function(plugin) + require("lazy.core.loader").add_to_rtp(plugin) + require("nvim-treesitter.query_predicates") + end, + cmd = { "TSUpdateSync", "TSUpdate", "TSInstall" }, dependencies = { "JoosepAlviste/nvim-ts-context-commentstring", "nvim-treesitter/nvim-treesitter-textobjects", @@ -142,6 +144,7 @@ return { }, { "lukas-reineke/indent-blankline.nvim", + event = "BufWinEnter", main = "ibl", config = function() require("utils.indent_blankline").setup() @@ -149,6 +152,7 @@ return { }, { "numToStr/Comment.nvim", + event = "BufWinEnter", config = function() require("Comment").setup({ pre_hook = require("ts_context_commentstring.integrations.comment_nvim").create_pre_hook() @@ -159,4 +163,22 @@ return { "JoosepAlviste/nvim-ts-context-commentstring" } }, + { + -- Split + "Wansmer/treesj", + event = "BufWinEnter", + dependencies = { "nvim-treesitter/nvim-treesitter" }, + keys = { + { "j", mode = { "n" }, function() require("treej").toggle() end, desc = "Toggle Split or Join" }, + { "k", mode = { "n" }, ":ISwap", desc = "Swap" }, + }, + config = function() + require('treesj').setup({ + notify = true, + dot_repeat = false, + max_join_length = 500, + use_default_keymaps = false, + }) + end, + }, } diff --git a/lua/utils/lualine.lua b/lua/utils/lualine.lua new file mode 100644 index 0000000..5e138fb --- /dev/null +++ b/lua/utils/lualine.lua @@ -0,0 +1,142 @@ +local M = {} +local ui = "catppuccin" + +local function getLsps() + local lspNames = "[" + for _, client in pairs(vim.lsp.get_active_clients()) do + lspNames = lspNames .. client.name .. ", " + end + + return string.sub(lspNames, 1, string.len(lspNames) - 2) .. "]" +end + +local function getTotalLines() + return vim.fn.line("$") +end + +local function search_result() + if vim.v.hlsearch == 0 then + return '' + end + local last_search = vim.fn.getreg('/') + if not last_search or last_search == '' then + return '' + end + local searchcount = vim.fn.searchcount { maxcount = 9999 } + return last_search .. '(' .. searchcount.current .. '/' .. searchcount.total .. ')' +end + +local function get_words() + if vim.bo.filetype == "md" or vim.bo.filetype == "txt" or vim.bo.filetype == "markdown" then + if vim.fn.wordcount().visual_words == 1 then + return tostring(vim.fn.wordcount().visual_words) .. " word" + elseif not (vim.fn.wordcount().visual_words == nil) then + return tostring(vim.fn.wordcount().visual_words) .. " words" + else + return tostring(vim.fn.wordcount().words) .. " words" + end + else + return "" + end +end + +local function filename() + local file = vim.fn.expand("%:p") + local homedir = vim.loop.os_homedir() + local base_dir = homedir .. "/projects" + local _, index = string.find(file, base_dir, 1, true) + if index then + return vim.fn.fnamemodify(file, ":~:.") + else + return vim.fn.expand("%:t") + end +end + +local function lsp_status() + local lsp = vim.lsp.util.get_diagnostics_count(0, [[Error]]) + local icon = '' + if lsp > 0 then + icon = ' ' + end + return icon .. 'LSP' +end + +function M.setup() + require("lualine").setup({ + options = { + theme = ui.theme, + section_separators = "", + component_separators = "", + }, + sections = { + lualine_a = { + { + "mode", + color = { + gui = "bold", + }, + }, + }, + lualine_b = { + "branch", + "diff", + lsp_status, + { + "diagnostics", + sources = { + "nvim_lsp", + }, + }, + }, + lualine_c = { + { + "filename", + file_status = true, + path = 1, + formatter = filename, + symbols = { + modified = '  ', + readonly = '  ', + unnamed = '  ', + newfile = '  ', + }, + }, + }, + lualine_x = { + getLsps, + search_result + }, + lualine_y = { + "filetype", + -- "encoding", + -- "fileformat", + get_words, + { + require("lazy.status").updates, + cond = require("lazy.status").has_updates, + color = { fg = "#ff9e64" }, + }, + { + "location", + color = { fg = "#ff9e64" }, + }, + getTotalLines + }, + lualine_z = { "progress" }, + }, + inactive_sections = { + lualine_c = { '%f %y %m' }, + lualine_x = {}, + }, + extensions = { + "fzf", + "fugitive", + "quickfix", + "nvim-tree", + "man", + "lazy" + }, + }) +end + +return M From a23d3e92aac2acff4c281858b6fb5994a37a3280 Mon Sep 17 00:00:00 2001 From: Raju Ghorai Date: Tue, 31 Oct 2023 21:57:31 +0530 Subject: [PATCH 04/23] =?UTF-8?q?=F0=9F=98=99Final:=20added=20autocmds,=20?= =?UTF-8?q?basic=20and=20extras?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lazy-lock.json | 48 ----------------- lua/config/autocmds.lua | 7 +++ lua/config/init.lua | 1 + lua/config/lazy.lua | 3 +- lua/plugins/basic.lua | 25 +++++++-- lua/plugins/extras/coding/codeium.lua | 20 ++++++++ lua/plugins/extras/lsp/none-ls.lua | 74 +++++++++++++++++++++++++++ lua/utils/nvimtree.lua | 69 +++++++++++++++++++++++++ 8 files changed, 195 insertions(+), 52 deletions(-) delete mode 100644 lazy-lock.json create mode 100644 lua/config/autocmds.lua create mode 100644 lua/plugins/extras/coding/codeium.lua create mode 100644 lua/plugins/extras/lsp/none-ls.lua create mode 100644 lua/utils/nvimtree.lua diff --git a/lazy-lock.json b/lazy-lock.json deleted file mode 100644 index 71210a8..0000000 --- a/lazy-lock.json +++ /dev/null @@ -1,48 +0,0 @@ -{ - "Comment.nvim": { "branch": "master", "commit": "0236521ea582747b58869cb72f70ccfa967d2e89" }, - "LuaSnip": { "branch": "master", "commit": "80a8528f084a97b624ae443a6f50ff8074ba486b" }, - "agrolens.nvim": { "branch": "main", "commit": "a2f15094a2b7e7bc79184de8edc13034116d8d47" }, - "auto-pairs": { "branch": "master", "commit": "39f06b873a8449af8ff6a3eee716d3da14d63a76" }, - "cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" }, - "cmp-nvim-lsp": { "branch": "main", "commit": "44b16d11215dce86f253ce0c30949813c0a90765" }, - "cmp-nvim-lua": { "branch": "main", "commit": "f12408bdb54c39c23e67cab726264c10db33ada8" }, - "cmp-nvim-tags": { "branch": "main", "commit": "30bdc2eec86eb66730af541bb06d24d4a67e3eeb" }, - "cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" }, - "cmp-rg": { "branch": "master", "commit": "677a7874ee8f1afc648c2e7d63a97bc21a7663c5" }, - "cmp-tmux": { "branch": "main", "commit": "97ec06b8030b8bf6d1fd83d49bdd16c98e04c845" }, - "cmp-treesitter": { "branch": "master", "commit": "b8bc760dfcc624edd5454f0982b63786a822eed9" }, - "cmp-under-comparator": { "branch": "master", "commit": "6857f10272c3cfe930cece2afa2406e1385bfef8" }, - "cmp_luasnip": { "branch": "master", "commit": "05a9ab28b53f71d1aece421ef32fee2cb857a843" }, - "fidget.nvim": { "branch": "legacy", "commit": "90c22e47be057562ee9566bad313ad42d622c1d3" }, - "flash.nvim": { "branch": "main", "commit": "48817af25f51c0590653bbc290866e4890fe1cbe" }, - "friendly-snippets": { "branch": "main", "commit": "43727c2ff84240e55d4069ec3e6158d74cb534b6" }, - "hlargs.nvim": { "branch": "main", "commit": "6218a401824c5733ac50b264991b62d064e85ab2" }, - "indent-blankline.nvim": { "branch": "master", "commit": "29be0919b91fb59eca9e90690d76014233392bef" }, - "iswap.nvim": { "branch": "master", "commit": "e05889db694524f68eb69567a70a98470994b890" }, - "lazy.nvim": { "branch": "main", "commit": "16603c6917435d8446f7357cb61095138a417085" }, - "mason-lspconfig.nvim": { "branch": "main", "commit": "397273083f988c1a17acf3816947cd198338e700" }, - "mason-tool-installer.nvim": { "branch": "main", "commit": "e4f34741daa9cf95de68a603d3e7a6844a69fdf0" }, - "mason.nvim": { "branch": "main", "commit": "cd7835b15f5a4204fc37e0aa739347472121a54c" }, - "neoconf.nvim": { "branch": "main", "commit": "393d37abd9d82adcac627309a41758ae8e140d9e" }, - "neodev.nvim": { "branch": "main", "commit": "a4b6e7ca11ff5be2264d5c169fcedd97d8699ec4" }, - "nvim-cmp": { "branch": "main", "commit": "51260c02a8ffded8e16162dcf41a23ec90cfba62" }, - "nvim-lsp-file-operations": { "branch": "master", "commit": "0ae13ac58136c6175638b6e1ba04cb487dd22272" }, - "nvim-lspconfig": { "branch": "master", "commit": "61f984586fefa9869f07f3027e0dce5752412786" }, - "nvim-tmux-navigation": { "branch": "main", "commit": "543f090a45cef28156162883d2412fffecb6b750" }, - "nvim-treesitter": { "branch": "master", "commit": "efec7115d8175bdb6720eeb4e26196032cb52593" }, - "nvim-treesitter-textobjects": { "branch": "master", "commit": "e69a504baf2951d52e1f1fbb05145d43f236cbf1" }, - "nvim-ts-autotag": { "branch": "main", "commit": "6be1192965df35f94b8ea6d323354f7dc7a557e4" }, - "nvim-ts-context-commentstring": { "branch": "main", "commit": "92e688f013c69f90c9bbd596019ec10235bc51de" }, - "nvim-ts-rainbow": { "branch": "master", "commit": "ef95c15a935f97c65a80e48e12fe72d49aacf9b9" }, - "nvim-ts-rainbow2": { "branch": "master", "commit": "b3120cd5ae9ca524af9cb602f41e12e301fa985f" }, - "nvim-web-devicons": { "branch": "master", "commit": "5de460ca7595806044eced31e3c36c159a493857" }, - "oil.nvim": { "branch": "master", "commit": "05a80e24f6c920e29ed741d12ede0840e456a3e4" }, - "plenary.nvim": { "branch": "master", "commit": "50012918b2fc8357b87cff2a7f7f0446e47da174" }, - "smart-pairs": { "branch": "master", "commit": "6e7a5a8e3906f7a8a8c5b8603d5264ff1b5d87c3" }, - "telescope-fzf-native.nvim": { "branch": "main", "commit": "6c921ca12321edaa773e324ef64ea301a1d0da62" }, - "telescope-symbols.nvim": { "branch": "master", "commit": "f2060117d965df4a626f068a4ebbd8ee051aa076" }, - "telescope.nvim": { "branch": "master", "commit": "7011eaae0ac1afe036e30c95cf80200b8dc3f21a" }, - "vim-repeat": { "branch": "master", "commit": "24afe922e6a05891756ecf331f39a1f6743d3d5a" }, - "vim-snippets": { "branch": "master", "commit": "ccc2fa1529d372f7ac16d5eb07a385a72b50e05d" }, - "vim-surround": { "branch": "master", "commit": "3d188ed2113431cf8dac77be61b842acb64433d9" } -} \ No newline at end of file diff --git a/lua/config/autocmds.lua b/lua/config/autocmds.lua new file mode 100644 index 0000000..9158300 --- /dev/null +++ b/lua/config/autocmds.lua @@ -0,0 +1,7 @@ +vim.cmd([[command! Format :lua FormatWithLSP()]]) + +-- Define a function to trigger LSP formatting +function FormatWithLSP() + -- Call LSP formatting function + vim.lsp.buf.format({ async = true }) +end diff --git a/lua/config/init.lua b/lua/config/init.lua index 9d787c7..bcb05c4 100644 --- a/lua/config/init.lua +++ b/lua/config/init.lua @@ -1,4 +1,5 @@ require("config.options") require("config.lazy") require("config.keymaps") +require("config.autocmds") vim.cmd[[colorscheme catppuccin]] diff --git a/lua/config/lazy.lua b/lua/config/lazy.lua index 3b9b02c..de557ed 100644 --- a/lua/config/lazy.lua +++ b/lua/config/lazy.lua @@ -26,9 +26,11 @@ local opts = { require("lazy").setup({ spec = { + -- { import = "plugins.extras.coding" }, { import = "plugins" }, { import = "plugins.lsp" }, { import = "plugins.colorschemes" }, + -- { import = "plugins.extras.lsp" }, }, defaults = { lazy = false, @@ -47,4 +49,3 @@ require("lazy").setup({ }, }, }, opts) - diff --git a/lua/plugins/basic.lua b/lua/plugins/basic.lua index 85fb502..0f1e5ab 100644 --- a/lua/plugins/basic.lua +++ b/lua/plugins/basic.lua @@ -19,8 +19,8 @@ return { "stevearc/oil.nvim", dependencies = { "nvim-tree/nvim-web-devicons" }, keys = { - { "n", mode = { "n" }, "Oil", desc = "Oil Explorer Current" }, - { "N", mode = { "n" }, "Oil .", desc = "Oil Explorer Root" }, + { "e", mode = { "n" }, "Oil", desc = "Oil Explorer Current" }, + { "E", mode = { "n" }, "Oil .", desc = "Oil Explorer Root" }, }, opts = { default_file_explorer = true, @@ -127,7 +127,7 @@ return { }, { "echasnovski/mini.bufremove", - + event = "BufEnter", keys = { { "bd", @@ -150,4 +150,23 @@ return { { "bD", function() require("mini.bufremove").delete(0, true) end, desc = "Delete Buffer (Force)" }, }, }, + { + "nvim-tree/nvim-tree.lua", + version = "nightly", + event = "VimEnter", + keys = { + { "n", mode = { "n" }, "NvimTreeToggle", desc = "NvimTree Explorer" }, + }, + config = function() + require("utils.nvimtree").setup() + end, + dependencies = { + { + "antosha417/nvim-lsp-file-operations", + config = function() + require("lsp-file-operations").setup() + end + } + } + } } diff --git a/lua/plugins/extras/coding/codeium.lua b/lua/plugins/extras/coding/codeium.lua new file mode 100644 index 0000000..7c940e4 --- /dev/null +++ b/lua/plugins/extras/coding/codeium.lua @@ -0,0 +1,20 @@ +return { + { + "nvim-cmp", + dependencies = { + { + "Exafunction/codeium.nvim", + cmd = "Codeium", + build = ":Codeium Auth", + opts = {}, + }, + }, + opts = function(_, opts) + table.insert(opts.sources, 1, { + name = "codeium", + group_index = 1, + priority = 100, + }) + end, + }, +} diff --git a/lua/plugins/extras/lsp/none-ls.lua b/lua/plugins/extras/lsp/none-ls.lua new file mode 100644 index 0000000..c4833f1 --- /dev/null +++ b/lua/plugins/extras/lsp/none-ls.lua @@ -0,0 +1,74 @@ +return { + "nvimtools/none-ls.nvim", -- configure formatters & linters + lazy = true, + -- event = { "BufReadPre", "BufNewFile" }, -- to enable uncomment this + dependencies = { + "jay-babu/mason-null-ls.nvim", + }, + config = function() + local mason_null_ls = require("mason-null-ls") + + local null_ls = require("null-ls") + + local null_ls_utils = require("null-ls.utils") + + mason_null_ls.setup({ + ensure_installed = { + "prettier", -- prettier formatter + "stylua", -- lua formatter + "black", -- python formatter + "pylint", -- python linter + "eslint_d", -- js linter + }, + }) + + -- for conciseness + local formatting = null_ls.builtins.formatting -- to setup formatters + local diagnostics = null_ls.builtins.diagnostics -- to setup linters + + -- to setup format on save + local augroup = vim.api.nvim_create_augroup("LspFormatting", {}) + + -- configure null_ls + null_ls.setup({ + -- add package.json as identifier for root (for typescript monorepos) + root_dir = null_ls_utils.root_pattern(".null-ls-root", "Makefile", ".git", "package.json"), + -- setup formatters & linters + sources = { + -- to disable file types use + -- "formatting.prettier.with({disabled_filetypes: {}})" (see null-ls docs) + formatting.prettier.with({ + extra_filetypes = { "svelte" }, + }), -- js/ts formatter + formatting.stylua, -- lua formatter + formatting.isort, + formatting.black, + diagnostics.pylint, + diagnostics.eslint_d.with({ -- js/ts linter + condition = function(utils) + return utils.root_has_file({ ".eslintrc.js", ".eslintrc.cjs" }) -- only enable if root has .eslintrc.js or .eslintrc.cjs + end, + }), + }, + -- configure format on save + on_attach = function(current_client, bufnr) + if current_client.supports_method("textDocument/formatting") then + vim.api.nvim_clear_autocmds({ group = augroup, buffer = bufnr }) + vim.api.nvim_create_autocmd("BufWritePre", { + group = augroup, + buffer = bufnr, + callback = function() + vim.lsp.buf.format({ + filter = function(client) + -- only use null-ls for formatting instead of lsp server + return client.name == "null-ls" + end, + bufnr = bufnr, + }) + end, + }) + end + end, + }) + end, +} diff --git a/lua/utils/nvimtree.lua b/lua/utils/nvimtree.lua new file mode 100644 index 0000000..1effd44 --- /dev/null +++ b/lua/utils/nvimtree.lua @@ -0,0 +1,69 @@ +local M = {} +local status, nvimtree = pcall(require, 'nvim-tree') + +function M.setup() + -- Load nvim-tree plugin + if (not status) then return end + nvimtree.setup { + -- Set options for nvim-tree + disable_netrw = false, -- Disable netrw + hijack_netrw = false, -- Hijack netrw window on startup + update_focused_file = { + enable = true, -- Update the focused file in the tree when you change files + update_cwd = true, -- Update the current working directory of the tree + }, + view = { + cursorline = true, + width = 30, -- Set the width of the tree view + side = 'right', -- Put the tree view on the left side of the editor + }, + actions = { + open_file = { + resize_window = true, + } + }, + filters = { + dotfiles = true, + exclude = { + 'node_modules', + '.venv', + 'env', + '.env', + }, + }, + renderer = { + add_trailing = true, + group_empty = true, + highlight_git = true, + indent_width = 1, + indent_markers = { + enable = true, + }, + icons = { + git_placement = "after", + show = { + file = true, + }, + glyphs = { + default = " ", + }, + }, + }, + log = { + enable = true, + truncate = true, + types = { + all = true, + config = true, + copy_paste = true, + dev = true, + diagnostics = true, + git = true, + profile = true, + watcher = true, + }, + }, + } +end + +return M From d26f9589792144020ee101b758fa0a65bf7bf7bb Mon Sep 17 00:00:00 2001 From: Raju Ghorai Date: Tue, 31 Oct 2023 22:07:45 +0530 Subject: [PATCH 05/23] update code --- .gitignore | 1 + lua/config/lazy.lua | 2 +- lua/plugins/extras/coding/codeium.lua | 30 +++++++++++++-------------- 3 files changed, 16 insertions(+), 17 deletions(-) diff --git a/.gitignore b/.gitignore index 1b83131..fc6c742 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,4 @@ test.sh .luarc.json nvim plugin/packer_compiled.lua +lazy-locak.json diff --git a/lua/config/lazy.lua b/lua/config/lazy.lua index de557ed..c4f4c7c 100644 --- a/lua/config/lazy.lua +++ b/lua/config/lazy.lua @@ -26,10 +26,10 @@ local opts = { require("lazy").setup({ spec = { - -- { import = "plugins.extras.coding" }, { import = "plugins" }, { import = "plugins.lsp" }, { import = "plugins.colorschemes" }, + { import = "plugins.extras.coding" }, -- { import = "plugins.extras.lsp" }, }, defaults = { diff --git a/lua/plugins/extras/coding/codeium.lua b/lua/plugins/extras/coding/codeium.lua index 7c940e4..1f98b62 100644 --- a/lua/plugins/extras/coding/codeium.lua +++ b/lua/plugins/extras/coding/codeium.lua @@ -1,20 +1,18 @@ return { - { - "nvim-cmp", - dependencies = { - { - "Exafunction/codeium.nvim", - cmd = "Codeium", - build = ":Codeium Auth", - opts = {}, - }, + "nvim-cmp", + dependencies = { + { + "Exafunction/codeium.nvim", + cmd = "Codeium", + build = ":Codeium Auth", + opts = {}, }, - opts = function(_, opts) - table.insert(opts.sources, 1, { - name = "codeium", - group_index = 1, - priority = 100, - }) - end, }, + opts = function(_, opts) + table.insert(opts.sources, 1, { + name = "codeium", + group_index = 1, + priority = 100, + }) + end, } From d600d76f4bbead63a8e0c210e53eee8a96569336 Mon Sep 17 00:00:00 2001 From: Raju Ghorai Date: Tue, 31 Oct 2023 22:10:54 +0530 Subject: [PATCH 06/23] updated code --- lua/config/lazy.lua | 2 +- lua/plugins/extras/coding/codeium.lua | 7 ------- 2 files changed, 1 insertion(+), 8 deletions(-) diff --git a/lua/config/lazy.lua b/lua/config/lazy.lua index c4f4c7c..4c5ff5c 100644 --- a/lua/config/lazy.lua +++ b/lua/config/lazy.lua @@ -29,7 +29,7 @@ require("lazy").setup({ { import = "plugins" }, { import = "plugins.lsp" }, { import = "plugins.colorschemes" }, - { import = "plugins.extras.coding" }, + -- { import = "plugins.extras.coding" }, -- { import = "plugins.extras.lsp" }, }, defaults = { diff --git a/lua/plugins/extras/coding/codeium.lua b/lua/plugins/extras/coding/codeium.lua index 1f98b62..dd0b2ba 100644 --- a/lua/plugins/extras/coding/codeium.lua +++ b/lua/plugins/extras/coding/codeium.lua @@ -8,11 +8,4 @@ return { opts = {}, }, }, - opts = function(_, opts) - table.insert(opts.sources, 1, { - name = "codeium", - group_index = 1, - priority = 100, - }) - end, } From a0420f40402eae967732c36d16901fdcf8ad1bd6 Mon Sep 17 00:00:00 2001 From: Raju Ghorai Date: Tue, 31 Oct 2023 22:27:19 +0530 Subject: [PATCH 07/23] =?UTF-8?q?=EF=A9=ADAdded:=20Dashboard?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lua/config/lazy.lua | 1 + lua/plugins/extras/dashboard/alpha.lua | 26 ++++++++++++++++++++++++++ lua/plugins/telescope.lua | 7 +++++++ lua/plugins/treesitter.lua | 2 +- lua/utils/cmp.lua | 6 +++--- 5 files changed, 38 insertions(+), 4 deletions(-) create mode 100644 lua/plugins/extras/dashboard/alpha.lua diff --git a/lua/config/lazy.lua b/lua/config/lazy.lua index 4c5ff5c..d190e30 100644 --- a/lua/config/lazy.lua +++ b/lua/config/lazy.lua @@ -31,6 +31,7 @@ require("lazy").setup({ { import = "plugins.colorschemes" }, -- { import = "plugins.extras.coding" }, -- { import = "plugins.extras.lsp" }, + -- { import = "plugins.extras.dashboard" }, }, defaults = { lazy = false, diff --git a/lua/plugins/extras/dashboard/alpha.lua b/lua/plugins/extras/dashboard/alpha.lua new file mode 100644 index 0000000..75be2c0 --- /dev/null +++ b/lua/plugins/extras/dashboard/alpha.lua @@ -0,0 +1,26 @@ +return { + "goolord/alpha-nvim", + event = "VimEnter", + config = function() + local alpha = require("alpha") + local dashboard = require("alpha.themes.dashboard") + -- dashboard.section.header.val = require("config.default").options.figlet_name + + dashboard.section.buttons.val = { + dashboard.button("e", " New File", ":ene startinsert "), + dashboard.button("LDR ?", " Recently Opened Files", ":Telescope oldfiles"), + dashboard.button("LDR n", "  File Explorer", ":NvimTreeOpen"), + dashboard.button("LDR sf", "🔍 Search Files", ":Telescope find_files"), + dashboard.button("LDR sg", " Search Grep", ":Telescope live_grep"), + dashboard.button("q", "󰅙 Quit NVIM", ":qa"), + } + + dashboard.section.footer.val = "Total plugins: " .. require("lazy").stats().count + dashboard.section.header.opts.hl = "Include" + dashboard.section.buttons.opts.hl = "Keyword" + dashboard.opts.opts.noautocmd = true + + + alpha.setup(dashboard.opts) + end +} diff --git a/lua/plugins/telescope.lua b/lua/plugins/telescope.lua index ab04f5b..f21b0e5 100644 --- a/lua/plugins/telescope.lua +++ b/lua/plugins/telescope.lua @@ -11,6 +11,7 @@ return { run = "make", cond = vim.fn.executable "make" == 1, }, + "nvim-telescope/telescope-symbols.nvim", }, keys = { { @@ -44,6 +45,12 @@ return { function() require("telescope.builtin").tags() end, desc = "[S]earch by [T]ags", }, + { + "ss", + mode = { "n" }, + function() require("telescope.builtin").symbols() end, + desc = "[S]earch [S]ymbols", + }, { "", mode = { "n" }, diff --git a/lua/plugins/treesitter.lua b/lua/plugins/treesitter.lua index d890843..3938c8b 100644 --- a/lua/plugins/treesitter.lua +++ b/lua/plugins/treesitter.lua @@ -26,7 +26,7 @@ return { config = function() require("pairs"):setup() end - } + }, }, build = function() pcall(require("nvim-treesitter.install").update { with_sync = false }) diff --git a/lua/utils/cmp.lua b/lua/utils/cmp.lua index 851809d..bf78d9b 100644 --- a/lua/utils/cmp.lua +++ b/lua/utils/cmp.lua @@ -21,6 +21,7 @@ local tags_symbol = "" local rg_symbol = "" local path_symbol = "" local tmux_symbol = "" +local codeium_symbol = "" local function deprioritize_snippet(entry1, entry2) if entry1:get_kind() == types.lsp.CompletionItemKind.Snippet then @@ -32,9 +33,6 @@ local function deprioritize_snippet(entry1, entry2) end function M.setup() - -- nvim-cmp setup - - cmp.setup { snippet = { expand = function(args) @@ -116,6 +114,7 @@ function M.setup() { name = 'tags', icon = tags_symbol, max_item_count = 5 }, { name = 'path', icon = path_symbol, max_item_count = 4 }, { name = 'tmux', icon = tmux_symbol, max_item_count = 3 }, + -- { name = 'codeium', icon = codeium_symbol, max_item_count = 3 }, }, formatting = { fields = { "kind", "abbr", "menu" }, @@ -157,6 +156,7 @@ function M.setup() tags = "[Tags]", path = "[Path]", tmux = "[Tmux]", + -- codeium = "[CODEIUM]", })[entry.source.name] return vim_item end, From 1f3e51200189e0066a71d059551b68028fa82bd8 Mon Sep 17 00:00:00 2001 From: Raju Ghorai Date: Tue, 31 Oct 2023 22:31:21 +0530 Subject: [PATCH 08/23] =?UTF-8?q?=F0=9F=8C=B1=20added:=20bufferline=20and?= =?UTF-8?q?=20rest?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lua/plugins/extras/dashboard/bufferline.lua | 46 +++++++++++++++++++++ lua/plugins/extras/rest/rest.lua | 39 +++++++++++++++++ 2 files changed, 85 insertions(+) create mode 100644 lua/plugins/extras/dashboard/bufferline.lua create mode 100644 lua/plugins/extras/rest/rest.lua diff --git a/lua/plugins/extras/dashboard/bufferline.lua b/lua/plugins/extras/dashboard/bufferline.lua new file mode 100644 index 0000000..3114ba5 --- /dev/null +++ b/lua/plugins/extras/dashboard/bufferline.lua @@ -0,0 +1,46 @@ +return { + { + "akinsho/bufferline.nvim", + version = "v3.*", + opts = { + options = { + offsets = { + { + filetype = "NvimTree", + text = " Explorer", + highlight = "Directory", + text_align = "left", + padding = 1 + }, + }, + left_trunc_marker = "", + right_trunc_marker = "", + number_style = "", + numbers = function(opts) + return string.format("%s", opts.ordinal) + end, + separator_style = { "|", "|" }, + insert_at_end = false, + insert_at_start = true, + close_icon = "", + modified_icon = "", + icon_pinned = "車", + semantic_letters = true, + show_buffer_close_icons = false, + show_tab_indicators = false, + always_show_bufferline = true, + max_name_length = 30, + max_prefix_length = 15, + tab_size = 20, + sort_by = "extension", + custom_filter = function(buf_number) + local name = vim.fn.bufname(buf_number) + if name ~= "" and not name:match("^term://") then + return true + end + end, + -- highlight = require("catppuccin.groups.integrations.bufferline").get(), + }, + }, + }, +} diff --git a/lua/plugins/extras/rest/rest.lua b/lua/plugins/extras/rest/rest.lua new file mode 100644 index 0000000..e1db184 --- /dev/null +++ b/lua/plugins/extras/rest/rest.lua @@ -0,0 +1,39 @@ +return { + "NTBBloodbath/rest.nvim", + event = "VeryLazy", + dependencies = { + "nvim-lua/plenary.nvim" + }, + config = function() + local status, restnv = pcall(require, "rest-nvim") + restnv.setup({ + result_split_horizontal = false, + highlight = { enabled = true, timeout = 150 }, + result = { + show_url = true, + show_http_info = true, + show_headers = true, + formatters = { + json = "jq", + html = function(body) + return vim.fn.system({ "tidy", "-i", "-q", "-" }, body) + end + } + }, + jump_to_request = true, + }) + local rest_nvim = require('rest-nvim') + vim.api.nvim_create_autocmd("FileType", { + pattern = "http", + callback = function() + local buff = tonumber(vim.fn.expand(""), 10) + vim.keymap.set("n", "rn", rest_nvim.run, + { noremap = true, buffer = buff }) + vim.keymap.set("n", "rl", rest_nvim.last, + { noremap = true, buffer = buff }) + vim.keymap.set("n", "rp", function() rest_nvim.run(true) end, + { noremap = true, buffer = buff }) + end + }) + end +} From 980fdae5c68c97514cc5052e3ba54e7149261445 Mon Sep 17 00:00:00 2001 From: Raju Ghorai Date: Wed, 1 Nov 2023 09:19:56 +0530 Subject: [PATCH 09/23] =?UTF-8?q?=EF=A9=B6Update:=20configs,=20cmp=20confi?= =?UTF-8?q?gs=20and=20explorer?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lua/config/autocmds.lua | 1 - lua/config/keymaps.lua | 26 +++++++++++++++++++- lua/plugins/basic.lua | 30 +++++++----------------- lua/plugins/extras/explorer/nvimtree.lua | 19 +++++++++++++++ lua/plugins/lsp/lspconfig.lua | 5 +--- lua/utils/cmp.lua | 26 +++++++++++--------- 6 files changed, 68 insertions(+), 39 deletions(-) create mode 100644 lua/plugins/extras/explorer/nvimtree.lua diff --git a/lua/config/autocmds.lua b/lua/config/autocmds.lua index 9158300..7c48482 100644 --- a/lua/config/autocmds.lua +++ b/lua/config/autocmds.lua @@ -2,6 +2,5 @@ vim.cmd([[command! Format :lua FormatWithLSP()]]) -- Define a function to trigger LSP formatting function FormatWithLSP() - -- Call LSP formatting function vim.lsp.buf.format({ async = true }) end diff --git a/lua/config/keymaps.lua b/lua/config/keymaps.lua index 2005326..46ca818 100644 --- a/lua/config/keymaps.lua +++ b/lua/config/keymaps.lua @@ -1,7 +1,8 @@ local keymap = vim.api.nvim_set_keymap +local map = vim.keymap.set local opts = { noremap = true, silent = true } +local expr_opts = { expr = true, silent = true } -keymap("n", "", ":nohlsearch", {}) keymap("n", "aa", ":hide", opts) -- Stay in indent mode @@ -10,3 +11,26 @@ keymap("v", ">", ">gv", opts) keymap("n", "v", ":vsp", opts) keymap("n", "V", ":sp", opts) + +-- better up/down +map({ "n", "x" }, "j", "v:count == 0 ? 'gj' : 'j'", expr_opts) +map({ "n", "x" }, "", "v:count == 0 ? 'gj' : 'j'", expr_opts) +map({ "n", "x" }, "k", "v:count == 0 ? 'gk' : 'k'", expr_opts) +map({ "n", "x" }, "", "v:count == 0 ? 'gk' : 'k'", expr_opts) + +-- Resize window using arrow keys +map("n", "", "resize +2", { desc = "Increase window height" }) +map("n", "", "resize -2", { desc = "Decrease window height" }) +map("n", "", "vertical resize -2", { desc = "Decrease window width" }) +map("n", "", "vertical resize +2", { desc = "Increase window width" }) + +-- Move Lines +map("n", "", "m .+1==", { desc = "Move down" }) +map("n", "", "m .-2==", { desc = "Move up" }) +map("i", "", "m .+1==gi", { desc = "Move down" }) +map("i", "", "m .-2==gi", { desc = "Move up" }) +map("v", "", ":m '>+1gv=gv", { desc = "Move down" }) +map("v", "", ":m '<-2gv=gv", { desc = "Move up" }) + +-- Clear search with +map({ "i", "n" }, "", "noh", { desc = "Escape and clear hlsearch" }) diff --git a/lua/plugins/basic.lua b/lua/plugins/basic.lua index 0f1e5ab..92f6aed 100644 --- a/lua/plugins/basic.lua +++ b/lua/plugins/basic.lua @@ -11,16 +11,17 @@ return { down = "", up = "", right = "", - } + }, } end }, { "stevearc/oil.nvim", + event = "VimEnter", dependencies = { "nvim-tree/nvim-web-devicons" }, keys = { - { "e", mode = { "n" }, "Oil", desc = "Oil Explorer Current" }, - { "E", mode = { "n" }, "Oil .", desc = "Oil Explorer Root" }, + { "n", mode = { "n" }, "Oil", desc = "Oil Explorer Current" }, + { "N", mode = { "n" }, "Oil .", desc = "Oil Explorer Root" }, }, opts = { default_file_explorer = true, @@ -30,6 +31,10 @@ return { "size", "mtime", }, + buf_options = { + buflisted = false, + bufhidden = "hide", + }, }, }, "jiangmiao/auto-pairs", @@ -150,23 +155,4 @@ return { { "bD", function() require("mini.bufremove").delete(0, true) end, desc = "Delete Buffer (Force)" }, }, }, - { - "nvim-tree/nvim-tree.lua", - version = "nightly", - event = "VimEnter", - keys = { - { "n", mode = { "n" }, "NvimTreeToggle", desc = "NvimTree Explorer" }, - }, - config = function() - require("utils.nvimtree").setup() - end, - dependencies = { - { - "antosha417/nvim-lsp-file-operations", - config = function() - require("lsp-file-operations").setup() - end - } - } - } } diff --git a/lua/plugins/extras/explorer/nvimtree.lua b/lua/plugins/extras/explorer/nvimtree.lua new file mode 100644 index 0000000..45e0e86 --- /dev/null +++ b/lua/plugins/extras/explorer/nvimtree.lua @@ -0,0 +1,19 @@ +return { + "nvim-tree/nvim-tree.lua", + version = "nightly", + event = "VimEnter", + keys = { + { "e", mode = { "n" }, "NvimTreeToggle", desc = "NvimTree Explorer" }, + }, + config = function() + require("utils.nvimtree").setup() + end, + dependencies = { + { + "antosha417/nvim-lsp-file-operations", + config = function() + require("lsp-file-operations").setup() + end + } + } +} diff --git a/lua/plugins/lsp/lspconfig.lua b/lua/plugins/lsp/lspconfig.lua index 495380a..8466c5c 100644 --- a/lua/plugins/lsp/lspconfig.lua +++ b/lua/plugins/lsp/lspconfig.lua @@ -12,7 +12,7 @@ return { local lspconfig = require("lspconfig") local cmp_nvim_lsp = require("cmp_nvim_lsp") - local keymap = vim.keymap -- for conciseness + local keymap = vim.keymap local opts = { noremap = true, silent = true } local on_attach = function(client, bufnr) @@ -52,9 +52,6 @@ return { opts.desc = "Show documentation for what is under cursor" keymap.set("n", "K", vim.lsp.buf.hover, opts) -- show documentation for what is under cursor - - opts.desc = "Restart LSP" - keymap.set("n", "rs", ":LspRestart", opts) -- mapping to restart lsp if necessary end -- used to enable autocompletion (assign to every lsp server config) diff --git a/lua/utils/cmp.lua b/lua/utils/cmp.lua index bf78d9b..6d621c4 100644 --- a/lua/utils/cmp.lua +++ b/lua/utils/cmp.lua @@ -84,7 +84,6 @@ function M.setup() if luasnip.choice_active() then luasnip.change_choice(1) else - -- Print current time local t = os.date("*t") local time = string.format("%02d:%02d:%02d", t.hour, t.min, t.sec) print(time) @@ -102,19 +101,20 @@ function M.setup() { name = 'nvim_lsp', icon = lsp_symbol, + group_index = 1, max_item_count = 10, entry_filter = function(entry) return cmp.lsp.CompletionItemKind.Snippet ~= entry:get_kind() end }, - { name = 'luasnip', icon = luasnip_symbol, max_item_count = 6 }, - { name = 'treesitter', icon = treesitter_symbol, max_item_count = 6 }, - { name = 'buffer', icon = buffer_symbol, max_item_count = 6 }, - { name = 'rg', icon = rg_symbol, max_item_count = 6 }, - { name = 'tags', icon = tags_symbol, max_item_count = 5 }, - { name = 'path', icon = path_symbol, max_item_count = 4 }, - { name = 'tmux', icon = tmux_symbol, max_item_count = 3 }, - -- { name = 'codeium', icon = codeium_symbol, max_item_count = 3 }, + { name = 'luasnip', icon = luasnip_symbol, group_index = 1, max_item_count = 8 }, + { name = 'treesitter', icon = treesitter_symbol, group_index = 2, max_item_count = 4 }, + { name = 'buffer', icon = buffer_symbol, group_index = 2, max_item_count = 3 }, + { name = 'rg', icon = rg_symbol, group_index = 2, max_item_count = 3 }, + { name = 'tags', icon = tags_symbol, group_index = 2, max_item_count = 2 }, + { name = 'path', icon = path_symbol, group_index = 2, max_item_count = 2 }, + { name = 'tmux', icon = tmux_symbol, group_index = 2, max_item_count = 3 }, + -- { name = 'codeium', icon = codeium_symbol,group_index = 1, max_item_count = 3 }, }, formatting = { fields = { "kind", "abbr", "menu" }, @@ -165,15 +165,19 @@ function M.setup() window = { completion = cmp.config.window.bordered(), documentation = cmp.config.window.bordered(), - experimental = { ghost_text = false, native_menu = false } + experimental = { + ghost_text = { + hl_group = "CmpGhostText", + }, + } }, sorting = { priority_weight = 2, comparators = { + cmp.config.compare.score, cmp.config.compare.recently_used, ---@diagnostic disable-next-line: assign-type-mismatch cmp.config.compare.locality, - cmp.config.compare.score, require "cmp-under-comparator".under, deprioritize_snippet, cmp.config.compare.exact, From aa6db8992d89f1b60e9222ce253754c858aafc07 Mon Sep 17 00:00:00 2001 From: Raju Ghorai Date: Thu, 2 Nov 2023 23:57:00 +0530 Subject: [PATCH 10/23] =?UTF-8?q?=EE=98=95=20Update:=20few=20config=20like?= =?UTF-8?q?=20noti=20and=20treesttter?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lua/plugins/basic.lua | 27 +++++++-------------------- lua/plugins/treesitter.lua | 2 +- 2 files changed, 8 insertions(+), 21 deletions(-) diff --git a/lua/plugins/basic.lua b/lua/plugins/basic.lua index 92f6aed..a374de4 100644 --- a/lua/plugins/basic.lua +++ b/lua/plugins/basic.lua @@ -101,30 +101,17 @@ return { { "rcarriga/nvim-notify", priority = 1000, - event = "VeryLazy", + event = { + "CursorMoved", + "CursorHold", + "InsertEnter", + "CmdlineEnter", + }, config = function() local status, notify = pcall(require, "notify") if (not status) then return end notify.setup({ - stages = "fade_in_slide_out", - render = "compact", - timeout = 1500, - fps = 20, - max_height = function() - return math.floor(vim.o.lines * 0.75) - end, - max_width = function() - return math.floor(vim.o.columns * 0.75) - end, - background_colour = "#000000", - minimum_width = 26, - icons = { - ERROR = "", - WARN = "", - INFO = "", - DEBUG = "", - TRACE = "✎", - } + background_colour = "#000000" }) vim.notify = notify end, diff --git a/lua/plugins/treesitter.lua b/lua/plugins/treesitter.lua index 3938c8b..a9f0234 100644 --- a/lua/plugins/treesitter.lua +++ b/lua/plugins/treesitter.lua @@ -169,7 +169,7 @@ return { event = "BufWinEnter", dependencies = { "nvim-treesitter/nvim-treesitter" }, keys = { - { "j", mode = { "n" }, function() require("treej").toggle() end, desc = "Toggle Split or Join" }, + { "j", mode = { "n" }, function() require("treesj").toggle() end, desc = "Toggle Split or Join" }, { "k", mode = { "n" }, ":ISwap", desc = "Swap" }, }, config = function() From 90470e8d123a568e9464e8e295c3d747a579197f Mon Sep 17 00:00:00 2001 From: Raju Ghorai Date: Fri, 3 Nov 2023 09:39:14 +0530 Subject: [PATCH 11/23] =?UTF-8?q?=F3=B0=A9=90=20update:=20autocmds,=20opti?= =?UTF-8?q?ons=20and=20settings?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lua/config/autocmds.lua | 29 ++++++ lua/config/options.lua | 137 ++++++++++++++++------------ lua/plugins/basic.lua | 22 ----- lua/plugins/extras/explorer/oil.lua | 22 +++++ lua/plugins/extras/rest/rest.lua | 4 + lua/plugins/git.lua | 5 +- lua/utils/cmp.lua | 4 +- 7 files changed, 139 insertions(+), 84 deletions(-) create mode 100644 lua/plugins/extras/explorer/oil.lua diff --git a/lua/config/autocmds.lua b/lua/config/autocmds.lua index 7c48482..3092fd1 100644 --- a/lua/config/autocmds.lua +++ b/lua/config/autocmds.lua @@ -1,3 +1,32 @@ +local augroup = vim.api.nvim_create_augroup -- Create/get autocommand group +local autocmd = vim.api.nvim_create_autocmd -- Create autocommand + + +augroup('MyCustomNeogitEvents', { clear = true }) +autocmd('User', { + pattern = 'NeogitPushComplete', + group = 'MyCustomNeogitEvents', + callback = require('neogit').close, +}) + + +-- Remove whitespace on save +autocmd('BufWritePre', { + pattern = '', + command = ":%s/\\s\\+$//e" +}) + +-- Set indentation to 2 spaces +augroup('setIndent', { clear = true }) +autocmd('Filetype', { + group = 'setIndent', + pattern = { 'xml', 'html', 'xhtml', 'css', 'scss', 'javascript', 'typescript', + 'yaml', 'lua' + }, + command = 'setlocal shiftwidth=2 tabstop=2' +}) + + vim.cmd([[command! Format :lua FormatWithLSP()]]) -- Define a function to trigger LSP formatting diff --git a/lua/config/options.lua b/lua/config/options.lua index 1b47003..52a682d 100644 --- a/lua/config/options.lua +++ b/lua/config/options.lua @@ -1,78 +1,97 @@ -local opt = vim.opt +----------------------------------------------------------- +-- General Neovim options setting +----------------------------------------------------------- + local g = vim.g -local o = vim.o +local opt = vim.opt -------------------------------- ------------- options ---------- -------------------------------- if vim.fn.has("nvim-0.9.0") == 1 then - opt.splitkeep = 'screen' - opt.shortmess:append({ C = true }) + opt.splitkeep = 'screen' + opt.shortmess:append({ C = true }) end -o.hlsearch = true -- Set highlight on search -o.mouse = 'a' -- Enable mouse mode -o.breakindent = true -- Enable break indent -o.undofile = true -- Save undo history -o.ignorecase = true -- Case insensitive searching UNLESS /C or capital in search -o.smartcase = true -- Decrease update time -o.updatetime = 250 -o.termguicolors = true -- Set colorscheme +----------------------------------------------------------- +-- General +----------------------------------------------------------- + +opt.mouse = 'a' -- Enable mouse mode +opt.clipboard = "unnamedplus" -- Copy/paste to system clipboard +opt.swapfile = false -- Don't use swapfile +opt.completeopt = 'menuone,noinsert,noselect' -- Autocomplete options + + -o.foldexpr = "nvim_treesitter#foldexpr()" -o.foldmethod = "expr" +opt.hlsearch = true -- Set highlight on search +opt.breakindent = true -- Enable break indent +opt.undofile = true -- Save undo history +opt.ignorecase = true -- Case insensitive searching UNLESS /C or capital in search +opt.smartcase = true -- Decrease update time +opt.termguicolors = true -- Set colorscheme -o.foldcolumn = '0' -- '0' is not bad -o.foldlevel = 99 -- Using ufo provider need a large value, feel free to decrease the value -o.foldlevelstart = -1 -o.foldenable = true -o.fillchars = [[eob: ,fold: ,foldopen:,foldsep: ,foldclose:]] +opt.foldexpr = "nvim_treesitter#foldexpr()" +opt.foldmethod = "expr" -opt.guifont = 'JetbrainsMono Nerd Font:h13' -opt.laststatus = 3 -- global statusline -opt.showmode = false +opt.foldcolumn = '0' -- '0' is not bad +opt.foldlevel = 99 -- Using ufo provider need a large value, feel free to decrease the value +opt.foldlevelstart = -1 +opt.foldenable = true +opt.fillchars = [[eob: ,fold: ,foldopen:,foldsep: ,foldclose:]] --- opt.clipboard = "unnamedplus" -opt.cursorline = true +opt.guifont = 'JetbrainsMono Nerd Font:h13' +opt.laststatus = 3 -- global statusline +opt.showmode = false + +opt.cursorline = true -- Indenting -opt.expandtab = true -opt.shiftwidth = 2 -opt.smartindent = true -opt.tabstop = 2 -opt.softtabstop = 2 +opt.expandtab = true +opt.shiftwidth = 2 +opt.smartindent = true +opt.tabstop = 2 +opt.softtabstop = 2 -- opt.fillchars = { eob = " " } -opt.fillchars = { - fold = " ", - foldopen = "", - foldclose = "", - foldsep = " ", - diff = "╱", - eob = " ", +opt.fillchars = { + fold = " ", + foldopen = "", + foldclose = "", + foldsep = " ", + diff = "╱", + eob = " ", } -opt.listchars = { - tab = ">>>", - trail = "·", - precedes = "←", - extends = "→", - eol = "↲", - nbsp = "␣", +opt.listchars = { + tab = ">>>", + trail = "·", + precedes = "←", + extends = "→", + eol = "↲", + nbsp = "␣", } -opt.ignorecase = true -opt.smartcase = true -opt.mouse = "a" - -opt.spelllang = { "en" } -opt.scrolloff = 4 -- Lines of context -opt.timeoutlen = 300 -opt.undofile = true -opt.undolevels = 10000 -opt.updatetime = 200 -- Save swap file and trigger CursorHold -opt.wildmode = "longest:full,full" -- Command-line completion mode -opt.winminwidth = 5 -- Minimum window width -opt.wrap = false -- Disable line wrap +opt.ignorecase = true +opt.smartcase = true + +opt.spelllang = { "en" } +opt.scrolloff = 4 -- Lines of context +opt.timeoutlen = 300 +opt.undofile = true +opt.undolevels = 500 +opt.wildmode = "longest:full,full" -- Command-line completion mode +opt.winminwidth = 5 -- Minimum window width +opt.wrap = false -- Disable line wrap + +----------------------------------------------------------- +-- Memory, CPU +----------------------------------------------------------- +opt.hidden = true -- Enable background buffers +opt.history = 100 -- Remember N lines in history +opt.lazyredraw = true -- Faster scrolling +opt.synmaxcol = 240 -- Max column for syntax highlight +opt.updatetime = 250 -- ms to wait for trigger an event + +-- Disable nvim intro +opt.shortmess:append "sI" + -- Numbers diff --git a/lua/plugins/basic.lua b/lua/plugins/basic.lua index a374de4..ab6e808 100644 --- a/lua/plugins/basic.lua +++ b/lua/plugins/basic.lua @@ -15,28 +15,6 @@ return { } end }, - { - "stevearc/oil.nvim", - event = "VimEnter", - dependencies = { "nvim-tree/nvim-web-devicons" }, - keys = { - { "n", mode = { "n" }, "Oil", desc = "Oil Explorer Current" }, - { "N", mode = { "n" }, "Oil .", desc = "Oil Explorer Root" }, - }, - opts = { - default_file_explorer = true, - columns = { - "icon", - "permissions", - "size", - "mtime", - }, - buf_options = { - buflisted = false, - bufhidden = "hide", - }, - }, - }, "jiangmiao/auto-pairs", { "tpope/vim-surround", event = "BufEnter" }, { "tpope/vim-repeat", event = "BufEnter" }, diff --git a/lua/plugins/extras/explorer/oil.lua b/lua/plugins/extras/explorer/oil.lua new file mode 100644 index 0000000..3cba852 --- /dev/null +++ b/lua/plugins/extras/explorer/oil.lua @@ -0,0 +1,22 @@ +return { + "stevearc/oil.nvim", + event = "VimEnter", + dependencies = { "nvim-tree/nvim-web-devicons" }, + keys = { + { "n", mode = { "n" }, "Oil", desc = "Oil Explorer Current" }, + { "N", mode = { "n" }, "Oil .", desc = "Oil Explorer Root" }, + }, + opts = { + default_file_explorer = true, + columns = { + "icon", + "permissions", + "size", + "mtime", + }, + buf_options = { + buflisted = false, + bufhidden = "hide", + }, + }, + } diff --git a/lua/plugins/extras/rest/rest.lua b/lua/plugins/extras/rest/rest.lua index e1db184..00fbb85 100644 --- a/lua/plugins/extras/rest/rest.lua +++ b/lua/plugins/extras/rest/rest.lua @@ -6,6 +6,10 @@ return { }, config = function() local status, restnv = pcall(require, "rest-nvim") + if (not status) then + vim.notify("error loading rest.nvim") + return + end restnv.setup({ result_split_horizontal = false, highlight = { enabled = true, timeout = 150 }, diff --git a/lua/plugins/git.lua b/lua/plugins/git.lua index e7c0679..375e5e1 100644 --- a/lua/plugins/git.lua +++ b/lua/plugins/git.lua @@ -2,6 +2,7 @@ return { { "lewis6991/gitsigns.nvim", event = { "BufRead" }, + keys = { }, config = function() local status, gitsigns = pcall(require, 'gitsigns') if (not status) then return end @@ -79,8 +80,8 @@ return { } }, keys = { - { "l", mode = { "n" }, "Neogit", desc = "Git" }, - { "L", mode = { "n" }, "Neogit commit", desc = "Git" }, + { "l", mode = { "n" }, "Neogit", desc = "NeoGit UI" }, + { "L", mode = { "n" }, "Neogit commit", desc = "NeoGit UI Commmit" }, }, config = function() require('neogit').setup { diff --git a/lua/utils/cmp.lua b/lua/utils/cmp.lua index 6d621c4..9d5f364 100644 --- a/lua/utils/cmp.lua +++ b/lua/utils/cmp.lua @@ -2,18 +2,20 @@ local M = {} local status_cmp, cmp = pcall(require, "cmp") if (not status_cmp) then + vim.notify("error loading cmp") return end local status_luasnip, luasnip = pcall(require, "luasnip") if (not status_luasnip) then + vim.notify("error loading luasnip") return end local types = require("cmp.types") -local lsp_symbol = "" +local lsp_symbol = "✳" local luasnip_symbol = "" local treesitter_symbol = "" local buffer_symbol = "" From db1e045b332af37698d3f330448758df671e647d Mon Sep 17 00:00:00 2001 From: Raju Ghorai Date: Fri, 3 Nov 2023 15:34:02 +0530 Subject: [PATCH 12/23] =?UTF-8?q?=F0=9F=98=86Updates:=20keymaps=20for=20gi?= =?UTF-8?q?tsigns?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lua/config/autocmds.lua | 6 +++ lua/plugins/extras/coding/hover.lua | 17 +++++++ lua/plugins/extras/coding/refactoring.lua | 25 ++++++++++ lua/plugins/extras/lsp/mason.lua | 32 ++++++++++++ lua/plugins/extras/wezterm/wezterm.lua | 4 ++ lua/plugins/git.lua | 10 +++- lua/plugins/lsp/lspconfig.lua | 25 ++++++++++ lua/plugins/lsp/mason.lua | 3 ++ lua/plugins/telescope.lua | 27 ++++++++++- lua/plugins/treesitter.lua | 59 ++++++++++++++--------- lua/utils/cmp.lua | 10 ++-- lua/utils/lualine.lua | 2 +- lua/utils/telescope.lua | 7 ++- 13 files changed, 194 insertions(+), 33 deletions(-) create mode 100644 lua/plugins/extras/coding/hover.lua create mode 100644 lua/plugins/extras/coding/refactoring.lua create mode 100644 lua/plugins/extras/lsp/mason.lua create mode 100644 lua/plugins/extras/wezterm/wezterm.lua diff --git a/lua/config/autocmds.lua b/lua/config/autocmds.lua index 3092fd1..27f7866 100644 --- a/lua/config/autocmds.lua +++ b/lua/config/autocmds.lua @@ -33,3 +33,9 @@ vim.cmd([[command! Format :lua FormatWithLSP()]]) function FormatWithLSP() vim.lsp.buf.format({ async = true }) end + +vim.cmd([[command! LuaEditSnipFunc :lua LuaEditSnipFunc()]]) + +function LuaEditSnipFunc() + require('luasnip.loaders.from_lua').edit_snippet_files() +end diff --git a/lua/plugins/extras/coding/hover.lua b/lua/plugins/extras/coding/hover.lua new file mode 100644 index 0000000..3b10bb9 --- /dev/null +++ b/lua/plugins/extras/coding/hover.lua @@ -0,0 +1,17 @@ +return { + -- hover + { + "lewis6991/hover.nvim", + -- stylua: ignore + keys = { + { "K", function() require("hover").hover() end, desc = "hover.nvim" }, + { "K", function() require("hover").hover() end, desc = "hover.nvim (select)", mode = { "v" } }, + }, + init = function() + -- Require providers + require("hover.providers.lsp") + require("hover.providers.man") + require("hover.providers.dictionary") + end, + }, +} diff --git a/lua/plugins/extras/coding/refactoring.lua b/lua/plugins/extras/coding/refactoring.lua new file mode 100644 index 0000000..2a5761b --- /dev/null +++ b/lua/plugins/extras/coding/refactoring.lua @@ -0,0 +1,25 @@ +return { + { + "ThePrimeagen/refactoring.nvim", + dependencies = { + "nvim-lua/plenary.nvim", + "nvim-treesitter/nvim-treesitter", + "nvim-telescope/telescope.nvim", + }, + lazy = true, + config = function() + require("refactoring").setup({}) + require("telescope").load_extension("refactoring") + end, + keys = { + { + "cr", + function() + require("telescope").extensions.refactoring.refactors() + end, + mode = { "n", "v" }, + desc = "Refactors", + }, + }, + }, +} diff --git a/lua/plugins/extras/lsp/mason.lua b/lua/plugins/extras/lsp/mason.lua new file mode 100644 index 0000000..917fca6 --- /dev/null +++ b/lua/plugins/extras/lsp/mason.lua @@ -0,0 +1,32 @@ +return { + "williamboman/mason.nvim", + dependencies = { + "williamboman/mason-lspconfig.nvim", + "WhoIsSethDaniel/mason-tool-installer.nvim", + }, + config = function() + local mason = require("mason") + local mason_lspconfig = require("mason-lspconfig") + local mason_tool_installer = require("mason-tool-installer") + + mason.setup({ + ui = { + icons = { + package_installed = "✓", + package_pending = "➜", + package_uninstalled = "✗", + }, + }, + }) + + mason_lspconfig.setup({ + ensure_installed = { + "tsserver", + "html", + "cssls", + "lua_ls", + }, + automatic_installation = true, + }) + end, +} diff --git a/lua/plugins/extras/wezterm/wezterm.lua b/lua/plugins/extras/wezterm/wezterm.lua new file mode 100644 index 0000000..09f0890 --- /dev/null +++ b/lua/plugins/extras/wezterm/wezterm.lua @@ -0,0 +1,4 @@ +return { + 'willothy/wezterm.nvim', + config = true +} diff --git a/lua/plugins/git.lua b/lua/plugins/git.lua index 375e5e1..db91f6a 100644 --- a/lua/plugins/git.lua +++ b/lua/plugins/git.lua @@ -2,7 +2,15 @@ return { { "lewis6991/gitsigns.nvim", event = { "BufRead" }, - keys = { }, + keys = { + { "hs", function() require("gitsigns").hunk_stage() end, desc = "Git Hunk Stage", mode = { "n" } }, + { "hr", function() require("gitsigns").hunk_reset() end, desc = "Git Hunk Reset", mode = { "n" } }, + { 'hs', function() require("gitsigns").stage_hunk { vim.fn.line("."), vim.fn.line("v") } end, desc = 'Stage Hunk (Visual)', mode = { 'v' } }, + { 'hr', function() require("gitsigns").reset_hunk { vim.fn.line("."), vim.fn.line("v") } end, desc = 'Reset Hunk (Visual)', mode = { 'v' } }, + { 'hs', function() require("gitsigns").stage_buffer() end, desc = 'Stage Buffer', mode = { 'n' } }, + { 'hu', function() require("gitsigns").undo_stage_hunk() end, desc = 'Undo Stage Hunk', mode = { 'n' } }, + { 'hr', function() require("gitsigns").reset_buffer() end, desc = 'Reset Buffer', mode = { 'n' } }, + }, config = function() local status, gitsigns = pcall(require, 'gitsigns') if (not status) then return end diff --git a/lua/plugins/lsp/lspconfig.lua b/lua/plugins/lsp/lspconfig.lua index 8466c5c..c686a09 100644 --- a/lua/plugins/lsp/lspconfig.lua +++ b/lua/plugins/lsp/lspconfig.lua @@ -32,6 +32,12 @@ return { opts.desc = "Show LSP type definitions" keymap.set("n", "gt", "Telescope lsp_type_definitions", opts) -- show lsp type definitions + opts.desc = "Show lsp symbols of buffer" + keymap.set("n", "gs", "Telescope lsp_document_symbols", opts) -- show lsp type definitions + + opts.desc = "Show lsp symbols of directory" + keymap.set("n", "gS", "Telescope lsp_workspace_symbols", opts) -- show lsp type definitions + opts.desc = "See available code actions" keymap.set({ "n", "v" }, "ca", vim.lsp.buf.code_action, opts) -- see available code actions, in visual mode will apply to selection @@ -156,7 +162,26 @@ return { }, }, }, + + }) + -- configure docker-compose server + lspconfig["docker_compose_language_service"].setup({ + capabilities = capabilities, + on_attach = on_attach, }) + + -- configure docker server + lspconfig["dockerls"].setup({ + capabilities = capabilities, + on_attach = on_attach, + }) + + -- configure yaml server + lspconfig["yamlls"].setup({ + capabilities = capabilities, + on_attach = on_attach, + }) + -- Turn on lsp status information require("fidget").setup() end, diff --git a/lua/plugins/lsp/mason.lua b/lua/plugins/lsp/mason.lua index 917fca6..34ea596 100644 --- a/lua/plugins/lsp/mason.lua +++ b/lua/plugins/lsp/mason.lua @@ -25,6 +25,9 @@ return { "html", "cssls", "lua_ls", + "docker_compose_language_service", + "dockerls", + "yamlls", }, automatic_installation = true, }) diff --git a/lua/plugins/telescope.lua b/lua/plugins/telescope.lua index f21b0e5..82cfa7c 100644 --- a/lua/plugins/telescope.lua +++ b/lua/plugins/telescope.lua @@ -11,6 +11,7 @@ return { run = "make", cond = vim.fn.executable "make" == 1, }, + "nvim-telescope/telescope-live-grep-args.nvim", "nvim-telescope/telescope-symbols.nvim", }, keys = { @@ -54,8 +55,22 @@ return { { "", mode = { "n" }, - function() require("telescope.builtin").buffers() end, - desc = "[/] Fuzzily search in current buffer", + function() + require("telescope.builtin").buffers({ + ignore_current_buffer = true, + sort_mru = true, + sort_lastused = true + }) + end, + desc = "Switch Buffers", + }, + { + "sk", + function() + require("telescope-live-grep-args.shortcuts").grep_word_under_cursor({ postfix = false }) + end, + desc = "Grep keyword under cursor (root dir)", + mode = { "n" }, }, { "/", @@ -63,6 +78,14 @@ return { function() require("utils.telescope").current_buffer_fuzzy_find() end, desc = "[/] Fuzzily search in current buffer", }, + { + "/", + function() + require("telescope-live-grep-args.shortcuts").grep_visual_selection({ postfix = false }) + end, + desc = "Grep (root dir)", + mode = { "v" }, + }, }, config = function() require("utils.telescope").setup() diff --git a/lua/plugins/treesitter.lua b/lua/plugins/treesitter.lua index a9f0234..a3dc2b1 100644 --- a/lua/plugins/treesitter.lua +++ b/lua/plugins/treesitter.lua @@ -6,14 +6,46 @@ return { require("lazy.core.loader").add_to_rtp(plugin) require("nvim-treesitter.query_predicates") end, - cmd = { "TSUpdateSync", "TSUpdate", "TSInstall" }, + cmd = { + "TSUpdateSync", + "TSUpdate", + "TSInstall", + }, dependencies = { - "JoosepAlviste/nvim-ts-context-commentstring", "nvim-treesitter/nvim-treesitter-textobjects", "p00f/nvim-ts-rainbow", "HiPhish/nvim-ts-rainbow2", "windwp/nvim-ts-autotag", - "mizlan/iswap.nvim", + "JoosepAlviste/nvim-ts-context-commentstring", + { + "mizlan/iswap.nvim", + event = "BufWinEnter", + cmd = { + 'ISwap', + 'ISwapWith', + 'ISwapNode', + 'ISwapNodeWith', + }, + keys = { + { "k", mode = { "n" }, ":ISwap", desc = "Swap variables" }, + }, + }, + { + "Wansmer/treesj", + event = "BufWinEnter", + dependencies = { "nvim-treesitter/nvim-treesitter" }, + keys = { + { "j", mode = { "n" }, function() require("treesj").toggle() end, desc = "Toggle Split or Join" }, + }, + config = function() + require('treesj').setup({ + notify = true, + dot_repeat = false, + max_join_length = 500, + use_default_keymaps = false, + }) + end, + }, { "m-demare/hlargs.nvim", config = function() @@ -145,6 +177,7 @@ return { { "lukas-reineke/indent-blankline.nvim", event = "BufWinEnter", + main = "ibl", config = function() require("utils.indent_blankline").setup() @@ -152,7 +185,7 @@ return { }, { "numToStr/Comment.nvim", - event = "BufWinEnter", + event = { "ModeChanged" }, config = function() require("Comment").setup({ pre_hook = require("ts_context_commentstring.integrations.comment_nvim").create_pre_hook() @@ -163,22 +196,4 @@ return { "JoosepAlviste/nvim-ts-context-commentstring" } }, - { - -- Split - "Wansmer/treesj", - event = "BufWinEnter", - dependencies = { "nvim-treesitter/nvim-treesitter" }, - keys = { - { "j", mode = { "n" }, function() require("treesj").toggle() end, desc = "Toggle Split or Join" }, - { "k", mode = { "n" }, ":ISwap", desc = "Swap" }, - }, - config = function() - require('treesj').setup({ - notify = true, - dot_repeat = false, - max_join_length = 500, - use_default_keymaps = false, - }) - end, - }, } diff --git a/lua/utils/cmp.lua b/lua/utils/cmp.lua index 9d5f364..3c2063c 100644 --- a/lua/utils/cmp.lua +++ b/lua/utils/cmp.lua @@ -16,14 +16,14 @@ local types = require("cmp.types") local lsp_symbol = "✳" -local luasnip_symbol = "" +local luasnip_symbol = "⇨" local treesitter_symbol = "" -local buffer_symbol = "" +local buffer_symbol = "󰕸" local tags_symbol = "" local rg_symbol = "" local path_symbol = "" local tmux_symbol = "" -local codeium_symbol = "" +local codeium_symbol = "󰨞" local function deprioritize_snippet(entry1, entry2) if entry1:get_kind() == types.lsp.CompletionItemKind.Snippet then @@ -116,7 +116,7 @@ function M.setup() { name = 'tags', icon = tags_symbol, group_index = 2, max_item_count = 2 }, { name = 'path', icon = path_symbol, group_index = 2, max_item_count = 2 }, { name = 'tmux', icon = tmux_symbol, group_index = 2, max_item_count = 3 }, - -- { name = 'codeium', icon = codeium_symbol,group_index = 1, max_item_count = 3 }, + { name = 'codeium', icon = codeium_symbol,group_index = 1, max_item_count = 3 }, }, formatting = { fields = { "kind", "abbr", "menu" }, @@ -158,7 +158,7 @@ function M.setup() tags = "[Tags]", path = "[Path]", tmux = "[Tmux]", - -- codeium = "[CODEIUM]", + codeium = "[CODEIUM]", })[entry.source.name] return vim_item end, diff --git a/lua/utils/lualine.lua b/lua/utils/lualine.lua index 5e138fb..02fb2dc 100644 --- a/lua/utils/lualine.lua +++ b/lua/utils/lualine.lua @@ -64,7 +64,7 @@ end function M.setup() require("lualine").setup({ options = { - theme = ui.theme, + theme = "catppuccin", section_separators = "", component_separators = "", }, diff --git a/lua/utils/telescope.lua b/lua/utils/telescope.lua index bc27d4f..829e6ef 100644 --- a/lua/utils/telescope.lua +++ b/lua/utils/telescope.lua @@ -69,7 +69,11 @@ function M.setup() }, agrolens = { theme = 'ivy' - } + }, + live_grep_args = { + auto_quoting = true, + }, + }, pickers = { buffers = { @@ -128,5 +132,4 @@ function M.treesitter() } end - return M From 0182ab3c655a9476b1ea2b8822e8ff78672d677d Mon Sep 17 00:00:00 2001 From: Raju Ghorai Date: Fri, 3 Nov 2023 17:24:57 +0530 Subject: [PATCH 13/23] =?UTF-8?q?=EE=98=95=20updated:=20configs=20and=20ke?= =?UTF-8?q?ymaps?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lua/plugins/extras/figlet/figlet.lua | 4 ++++ lua/plugins/extras/wilder/wilder.lua | 24 ++++++++++++++++++++++++ lua/plugins/git.lua | 13 ++++++++++++- 3 files changed, 40 insertions(+), 1 deletion(-) create mode 100644 lua/plugins/extras/figlet/figlet.lua create mode 100644 lua/plugins/extras/wilder/wilder.lua diff --git a/lua/plugins/extras/figlet/figlet.lua b/lua/plugins/extras/figlet/figlet.lua new file mode 100644 index 0000000..feef644 --- /dev/null +++ b/lua/plugins/extras/figlet/figlet.lua @@ -0,0 +1,4 @@ +return { + "pavanbhat1999/figlet.nvim", + requires = "numToStr/Comment.nvim" +} diff --git a/lua/plugins/extras/wilder/wilder.lua b/lua/plugins/extras/wilder/wilder.lua new file mode 100644 index 0000000..020228d --- /dev/null +++ b/lua/plugins/extras/wilder/wilder.lua @@ -0,0 +1,24 @@ +return { + 'gelguy/wilder.nvim', + config = function() + local wilder = require("wilder") + wilder.setup({ + modes = { ":" }, + next_key = "", + previous_key = "", + }) + wilder.set_option('renderer', wilder.popupmenu_renderer( + wilder.popupmenu_palette_theme({ + border = 'rounded', + max_height = '60%', + min_height = 0, + prompt_position = 'top', + reverse = 0, + highlighter = wilder.basic_highlighter(), + left = { ' ', wilder.popupmenu_devicons() }, + right = { ' ', wilder.popupmenu_scrollbar() }, + }) + )) + end, + build = ':UpdateRemotePlugins' +} diff --git a/lua/plugins/git.lua b/lua/plugins/git.lua index db91f6a..5880ac6 100644 --- a/lua/plugins/git.lua +++ b/lua/plugins/git.lua @@ -1,7 +1,12 @@ return { { "lewis6991/gitsigns.nvim", - event = { "BufRead" }, + event = { + "CmdlineEnter", + "InsertEnter", + "CursorHold", + "CursorMoved", + }, keys = { { "hs", function() require("gitsigns").hunk_stage() end, desc = "Git Hunk Stage", mode = { "n" } }, { "hr", function() require("gitsigns").hunk_reset() end, desc = "Git Hunk Reset", mode = { "n" } }, @@ -10,6 +15,12 @@ return { { 'hs', function() require("gitsigns").stage_buffer() end, desc = 'Stage Buffer', mode = { 'n' } }, { 'hu', function() require("gitsigns").undo_stage_hunk() end, desc = 'Undo Stage Hunk', mode = { 'n' } }, { 'hr', function() require("gitsigns").reset_buffer() end, desc = 'Reset Buffer', mode = { 'n' } }, + { 'hp', function() require("gitsigns").preview_hunk() end, desc = 'Preview Hunk', mode = { 'n' } }, + { 'hb', function() require("gitsigns").blame_line() end, desc = 'Blame Line', mode = { 'n' } }, + { 'tb', function() require("gitsigns").toggle_current_line_blame() end, desc = 'Toggle Current Line Blame', mode = { 'n' } }, + { 'hd', function() require("gitsigns").diffthis() end, desc = 'Diff This', mode = { 'v', 'n' } }, + { 'hd', function() require("gitsigns").diffthis("~") end, desc = 'Diff This (Visual)', mode = { 'n' } }, + { 'td', function() require("gitsigns").toggle_deleted() end, desc = 'Toggle Deleted', mode = { 'n' } }, }, config = function() local status, gitsigns = pcall(require, 'gitsigns') From 0f653e8c4efc14d19773ca38b931c0f32b001319 Mon Sep 17 00:00:00 2001 From: Raju Ghorai Date: Sun, 5 Nov 2023 10:56:40 +0530 Subject: [PATCH 14/23] =?UTF-8?q?=F3=B1=96=AB=20Added:=20config=20for=20st?= =?UTF-8?q?atusline?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lua/config/autocmds.lua | 14 +- lua/config/lazy.lua | 4 +- lua/plugins/extras/statusline/galaxyline.lua | 11 + lua/plugins/extras/statusline/lualine.lua | 10 + lua/plugins/statusline.lua | 10 - lua/utils/galaxyline.lua | 484 +++++++++++++++++++ 6 files changed, 515 insertions(+), 18 deletions(-) create mode 100644 lua/plugins/extras/statusline/galaxyline.lua create mode 100644 lua/plugins/extras/statusline/lualine.lua delete mode 100644 lua/plugins/statusline.lua create mode 100644 lua/utils/galaxyline.lua diff --git a/lua/config/autocmds.lua b/lua/config/autocmds.lua index 27f7866..1ee3b17 100644 --- a/lua/config/autocmds.lua +++ b/lua/config/autocmds.lua @@ -2,13 +2,13 @@ local augroup = vim.api.nvim_create_augroup -- Create/get autocommand group local autocmd = vim.api.nvim_create_autocmd -- Create autocommand -augroup('MyCustomNeogitEvents', { clear = true }) -autocmd('User', { - pattern = 'NeogitPushComplete', - group = 'MyCustomNeogitEvents', - callback = require('neogit').close, -}) - +-- augroup('MyCustomNeogitEvents', { clear = true }) +-- autocmd('User', { +-- pattern = 'NeogitPushComplete', +-- group = 'MyCustomNeogitEvents', +-- callback = require('neogit').close, +-- }) +-- -- Remove whitespace on save autocmd('BufWritePre', { diff --git a/lua/config/lazy.lua b/lua/config/lazy.lua index d190e30..bf9fe6c 100644 --- a/lua/config/lazy.lua +++ b/lua/config/lazy.lua @@ -29,7 +29,9 @@ require("lazy").setup({ { import = "plugins" }, { import = "plugins.lsp" }, { import = "plugins.colorschemes" }, - -- { import = "plugins.extras.coding" }, + -- StatusLine Select One + -- { import = "plugins.extras.statusline.lualine" }, + { import = "plugins.extras.statusline.galaxyline" }, -- { import = "plugins.extras.lsp" }, -- { import = "plugins.extras.dashboard" }, }, diff --git a/lua/plugins/extras/statusline/galaxyline.lua b/lua/plugins/extras/statusline/galaxyline.lua new file mode 100644 index 0000000..1f95d54 --- /dev/null +++ b/lua/plugins/extras/statusline/galaxyline.lua @@ -0,0 +1,11 @@ +if true then + return { + 'glepnir/galaxyline.nvim', + event = 'VimEnter', + dependencies = { "kyazdani42/nvim-web-devicons" }, + branch = 'main', + config = function() + require('utils.galaxyline') + end, + } +end diff --git a/lua/plugins/extras/statusline/lualine.lua b/lua/plugins/extras/statusline/lualine.lua new file mode 100644 index 0000000..1a30a9a --- /dev/null +++ b/lua/plugins/extras/statusline/lualine.lua @@ -0,0 +1,10 @@ +if true then + return { + "nvim-lualine/lualine.nvim", + event = "VimEnter", + dependencies = { "kyazdani42/nvim-web-devicons" }, + config = function() + require("utils.lualine").setup() + end, + } +end diff --git a/lua/plugins/statusline.lua b/lua/plugins/statusline.lua deleted file mode 100644 index d9364cf..0000000 --- a/lua/plugins/statusline.lua +++ /dev/null @@ -1,10 +0,0 @@ -return { - "nvim-lualine/lualine.nvim", - event = "VimEnter", - dependencies = { - "kyazdani42/nvim-web-devicons", - }, - config = function() - require("utils.lualine").setup() - end, -} diff --git a/lua/utils/galaxyline.lua b/lua/utils/galaxyline.lua new file mode 100644 index 0000000..7195ded --- /dev/null +++ b/lua/utils/galaxyline.lua @@ -0,0 +1,484 @@ +-- https://github.com/glepnir/galaxyline.nvim/tree/main/lua + +local gl = require("galaxyline") + +-- { == Colors ==> ============================================================ + +local colors = require("galaxyline.theme").default + +if vim.g.colors_name == "tokyonight" then + local palette = require("tokyonight.colors").setup() + colors = { + fg = palette.fg_dark, + bg = palette.bg_highlight, + darkblue = palette.bg_dark, + cyan = palette.cyan, + green = palette.green, + yellow = palette.blue, + orange = palette.orange, + violet = palette.purple, + magenta = palette.magenta, + blue = palette.blue, + red = palette.red, + } +end + +if vim.g.colors_name == "catppuccin-mocha" then + local palette = require("catppuccin.palettes.mocha") + colors = { + fg = palette.text, + bg = palette.base, + darkblue = palette.mantle, + cyan = palette.overlay0, + green = palette.green, + yellow = palette.lavender, + orange = palette.flamingo, + violet = palette.lavender, + magenta = palette.mauve, + blue = palette.mantle, + red = palette.red, + } +end +-- <== } + +-- { == Sections ==> ========================================================== + +local diagnostic = require("galaxyline.provider_diagnostic") + +local conditions = { + gl = require("galaxyline.condition"), + has_file_type = function() + if not vim.bo.filetype or vim.bo.filetype == "" then return false end + return true + end, + ---@param win_width? number + break_width = function(win_width) + win_width = win_width or 50 + if vim.fn.winwidth(0) / 2 > win_width then return true end + return false + end, +} + +local format_icons = { dos = "", mac = "", unix = "" } + +-- Seperators +-- pixels { big = {   }, small = {   } } + +gl.section.left = { + -- Mode ---------------------------------------------------------------------- + { + ModeStartSep = { + provider = function() end, + -- separator = " ", + separator = " ", + separator_highlight = { colors.darkblue, colors.bg }, + }, + }, + { + ViMode = { + icon = function() + local icons = { + n = "󰆾 ", + i = " ", + c = "󰞷 ", + v = "󰆿 ", + V = "󰆿 ", + [""] = "󰆿 ", + C = "󰞷 ", + R = "󰛔 ", + t = " ", + } + return icons[vim.fn.mode()] + end, + provider = function() + -- auto change color according the vim mode + local alias = { + n = "N ", + i = "I ", + c = "C ", + V = "VL", + [""] = "VB", + v = "V ", + C = "C ", + ["r?"] = ":CONFIRM", + rm = "--MORE", + R = "R ", + Rv = "RV", + s = "S ", + S = "S ", + ["r"] = "HIT-ENTER", + [""] = "SELECT", + t = "T ", + ["!"] = "SH", + } + local mode_color = { + n = colors.cyan, + i = colors.red, + v = colors.yellow, + [""] = colors.yellow, + V = colors.yellow, + c = colors.magenta, + no = colors.red, + s = colors.orange, + S = colors.orange, + [""] = colors.orange, + ic = colors.yellow, + R = colors.blue, + Rv = colors.blue, + cv = colors.red, + ce = colors.red, + r = colors.cyan, + rm = colors.cyan, + ["r?"] = colors.cyan, + ["!"] = colors.red, + t = colors.red, + } + local vim_mode = vim.fn.mode() + vim.api.nvim_command("hi GalaxyViMode guifg=" .. mode_color[vim_mode]) + return alias[vim_mode] + end, + highlight = { colors.darkblue, colors.bg }, + separator = " ", + separator_highlight = { colors.darkblue, colors.bg }, + }, + }, + { + ModeEndSep = { + provider = function() end, + separator = "", + separator_highlight = { colors.bg }, + }, + }, + + -- Git ----------------------------------------------------------------------- + { + GitStartSep = { + provider = function() end, + separator = " ", + separator_highlight = { colors.darkblue }, + }, + }, + { + GitIcon = { + provider = function() return "  " end, + condition = conditions.gl.check_git_workspace, + highlight = { colors.orange, colors.darkblue }, + }, + }, + { + GitBranch = { + provider = "GitBranch", + highlight = { colors.fg, colors.darkblue }, + condition = conditions.gl.check_git_workspace, + separator = " ", + separator_highlight = { colors.darkblue, colors.darkblue }, + }, + }, + { + DiffAdd = { + provider = "DiffAdd", + icon = " ", + condition = conditions.break_width, + highlight = { colors.green, colors.darkblue }, + }, + }, + { + DiffModified = { + provider = "DiffModified", + icon = "  ", + condition = conditions.break_width, + highlight = { colors.orange, colors.darkblue }, + }, + }, + { + DiffRemove = { + provider = "DiffRemove", + icon = "  ", + condition = conditions.break_width, + highlight = { colors.red, colors.darkblue }, + }, + }, + { + DiffEndSep = { + provider = function() end, + separator = "", + separator_highlight = { colors.bg, colors.darkblue }, + }, + }, + { + Space = { + provider = function() return " " end, + highlight = { colors.bg, colors.bg }, + }, + }, + + -- File ---------------------------------------------------------------------- + { + FileIcon = { + provider = "FileIcon", + condition = function() + if vim.fn.empty(vim.fn.expand("%:t")) ~= 1 then return true end + return false + end, + highlight = { + require("galaxyline.provider_fileinfo").get_file_icon_color, + colors.bg, + }, + }, + }, + { + BufferType = { + -- provider = "FilePath", + provider = "FileName", + condition = conditions.has_file_type, + highlight = { colors.fg, colors.bg }, + }, + }, + + -- Diagnostics --------------------------------------------------------------- + { + DiagnosticError = { + provider = diagnostic.get_diagnostic_error, + icon = "  ", + highlight = { colors.red, colors.bg }, + }, + }, + { + DiagnosticWarn = { + provider = diagnostic.get_diagnostic_warn, + condition = function() return conditions.break_width(55) end, + icon = "  ", + highlight = { colors.yellow, colors.bg }, + }, + }, + { + DiagnosticInfo = { + provider = diagnostic.get_diagnostic_info, + condition = function() return conditions.break_width(55) end, + highlight = { colors.green, colors.bg }, + icon = "  ", + }, + }, + { + DiagnosticHint = { + provider = diagnostic.get_diagnostic_hint, + condition = function() return conditions.break_width(55) end, + highlight = { colors.blue, colors.bg }, + icon = " 󰌵 ", + }, + }, + { + DarkSepara = { + provider = function() return "" end, + highlight = { colors.bg }, + }, + }, +} + +gl.section.right = { + -- LSP Client ---------------------------------------------------------------- + { + LspStartSep = { + provider = function() return "  " end, + highlight = { colors.yellow, colors.bg }, + separator = "", + separator_highlight = { colors.bg }, + }, + }, + { + GetLspClient = { + provider = "GetLspClient", + condition = function() return conditions.break_width(35) end, + highlight = { colors.fg, colors.bg }, + }, + }, + { + LspEndSep = { + provider = function() return "" end, + highlight = { colors.bg, colors.darkblue }, + separator = " ", + separator_highlight = { colors.bg, colors.bg }, + }, + }, + + -- Position ------------------------------------------------------------------ + { + LineInfo = { + provider = "LineColumn", + condition = conditions.break_width, + highlight = { colors.fg, colors.darkblue }, + separator = "  ", + separator_highlight = { colors.yellow, colors.darkblue }, + }, + }, + { + ScrollBar = { + provider = "ScrollBar", + highlight = { colors.violet, colors.darkblue }, + separator = " ", + separator_highlight = { colors.blue, colors.darkblue }, + }, + }, + { + Percent = { + provider = "LinePercent", + highlight = { colors.fg, colors.darkblue }, + separator = " ", -- " ", --     󰞁 󰆌 + separator_highlight = { colors.blue, colors.darkblue }, + }, + }, + + -- Indentation --------------------------------------------------------------- + { + Indentation = { + provider = function() + local indentation_type = "Tabs:" + if vim.api.nvim_buf_get_option(0, "expandtab") then indentation_type = "Spaces:" end + return indentation_type .. vim.o.ts + end, + condition = conditions.break_width, + highlight = { colors.fg, colors.darkblue }, + separator = "  ", + separator_highlight = { colors.yellow, colors.darkblue }, + }, + }, + + -- File Format --------------------------------------------------------------- + { + FileFormat = { + provider = function() + local fileFormat = string.upper(vim.bo.fileencoding) + return fileFormat + end, + condition = function() return conditions.break_width(55) end, + highlight = { colors.fg, colors.darkblue }, + -- separator = " ", + separator = " " .. format_icons[vim.bo.fileformat] .. " ", + separator_highlight = { colors.yellow, colors.darkblue }, + }, + }, + + { + RightSpace = { + provider = function() return " " end, + highlight = { colors.darkblue, colors.darkblue }, + }, + }, +} + +gl.short_line_list = { + "alpha", + "LuaTree", + "vista", + "dbui", + "startify", + "term", + "nerdtree", + "fugitive", + "fugitiveblame", + "plug", + "NvimTree", + "neo-tree", + "DiffviewFiles", + "Outline", + "neoterm", + "fern", + "toggleterm", + "filetree", + "explorer", +} + +local BufferTypeMap = { + ["alpha"] = "󰍂 Alpha", + ["Mundo"] = "Mundo History", + ["MundoDiff"] = "Mundo Diff", + ["NvimTree"] = " Tree", + ["neo-tree"] = " Tree", + ["fugitive"] = " Fugitive", + ["fugitiveblame"] = " Fugitive Blame", + ["help"] = "󰋗 Help", + ["minimap"] = "Minimap", + ["qf"] = "󰁨 Quick Fix", + ["tabman"] = "Tab Manager", + ["tagbar"] = "Tagbar", + ["FTerm"] = "Terminal", + ["neoterm"] = " NeoTerm", + ["toggleterm"] = " ToggleTerm", + ["git"] = " Git", + ["NeogitStatus"] = " Neogit Status", + ["NeogitPopup"] = " Neogit Popup", + ["NeogitCommitMessage"] = "󰍣 Neogit Commit", + ["DiffviewFiles"] = " Diff View", + ["dapui_scopes"] = "󱁯 Dap Scope", + ["dapui_breakpoints"] = " Dap Breakpoints", + ["dapui_stacks"] = " Dap Stacks", + ["dapui_watches"] = "󰙔 Dap Watch", + ["dap-repl"] = " Dap REPL", + ["Outline"] = " SymbolOutline", + ["fern"] = " Fern FM", + ["filetree"] = " Tree", +} + +gl.section.short_line_left = { + { + ShortLineBlankSpace = { + provider = function() return " " end, + highlight = { colors.bg, colors.bg }, + }, + }, + { + ShortLineLeftBufferName = { + provider = "FileName", + condition = function() + if BufferTypeMap[vim.bo.filetype] then return false end + return true + end, + highlight = { colors.fg, colors.bg }, + }, + }, + { + ShortLineLeftBufferType = { + provider = function() + -- local file_name = vim.fn.expand("%:t") + if vim.bo.filetype == "neo-tree" then return " 󰙅 Neo-tree " end + local mapped_name = BufferTypeMap[vim.bo.filetype] + if mapped_name then return " " .. mapped_name .. " " end + end, + condition = conditions.has_file_type, + highlight = { colors.fg, colors.bg }, + separator = " ", + separator_highlight = { colors.bg, colors.darkblue }, + }, + }, + { + ShortLineLeftWindowNumber = { + provider = function() return vim.api.nvim_win_get_number(vim.api.nvim_get_current_win()) .. " " end, + icon = " ", + highlight = { colors.blue, colors.darkblue }, + separator = "", + separator_highlight = { colors.darkblue, "colors.black" }, + }, + }, +} + +-- { == Load Setup ==> ======================================================== + +gl.galaxyline_augroup() +-- <== } + +-- { == Events ==> ============================================================ + +-- We run into some issues with tint. Toggling it off/on apparently fixes them, while refreshing does not +local tint_ok, tint = pcall(require, "tint") + +local function pseudo_toggle_tint() + if tint_ok then + tint.toggle() + tint.toggle() + end +end +pseudo_toggle_tint() + +local timer = vim.loop.new_timer() + +-- <== } From c3414d39333d770d05ac288fb317df8f19537975 Mon Sep 17 00:00:00 2001 From: Raju Ghorai Date: Sun, 5 Nov 2023 10:58:39 +0530 Subject: [PATCH 15/23] =?UTF-8?q?=EE=AB=9C=20Added:=20config=20for=20lazy,?= =?UTF-8?q?=20basic=20and=20cmp=20plugins?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lua/plugins/basic.lua | 24 +++++++++++++++++++++++- lua/utils/cmp.lua | 19 +++++++++++++++---- lua/utils/indent_blankline.lua | 1 - 3 files changed, 38 insertions(+), 6 deletions(-) diff --git a/lua/plugins/basic.lua b/lua/plugins/basic.lua index ab6e808..fcb76a9 100644 --- a/lua/plugins/basic.lua +++ b/lua/plugins/basic.lua @@ -117,7 +117,29 @@ return { end, desc = "Delete Buffer", }, - { "bD", function() require("mini.bufremove").delete(0, true) end, desc = "Delete Buffer (Force)" }, + { + "bD", + function() + require("mini.bufremove").delete(0, true) + end, + desc = "Delete Buffer (Force)", + }, }, }, + { + 'norcalli/nvim-colorizer.lua', + ft = { + 'lua', + 'css', + 'html', + 'sass', + 'less', + 'typescriptreact', + 'conf', + 'vim', + }, + config = function() + require('colorizer').setup() + end, +} } diff --git a/lua/utils/cmp.lua b/lua/utils/cmp.lua index 3c2063c..0523dd4 100644 --- a/lua/utils/cmp.lua +++ b/lua/utils/cmp.lua @@ -110,13 +110,13 @@ function M.setup() end }, { name = 'luasnip', icon = luasnip_symbol, group_index = 1, max_item_count = 8 }, - { name = 'treesitter', icon = treesitter_symbol, group_index = 2, max_item_count = 4 }, + { name = 'treesitter', icon = treesitter_symbol, group_index = 2, max_item_count = 4, keyword_length = 2 }, { name = 'buffer', icon = buffer_symbol, group_index = 2, max_item_count = 3 }, { name = 'rg', icon = rg_symbol, group_index = 2, max_item_count = 3 }, { name = 'tags', icon = tags_symbol, group_index = 2, max_item_count = 2 }, { name = 'path', icon = path_symbol, group_index = 2, max_item_count = 2 }, { name = 'tmux', icon = tmux_symbol, group_index = 2, max_item_count = 3 }, - { name = 'codeium', icon = codeium_symbol,group_index = 1, max_item_count = 3 }, + { name = 'codeium', icon = codeium_symbol, group_index = 1, max_item_count = 3 }, }, formatting = { fields = { "kind", "abbr", "menu" }, @@ -178,11 +178,22 @@ function M.setup() comparators = { cmp.config.compare.score, cmp.config.compare.recently_used, + cmp.config.compare.exact, + function(entry1, entry2) + local _, entry1_under = entry1.completion_item.label:find "^_+" + local _, entry2_under = entry2.completion_item.label:find "^_+" + entry1_under = entry1_under or 0 + entry2_under = entry2_under or 0 + if entry1_under > entry2_under then + return false + elseif entry1_under < entry2_under then + return true + end + end, + require "cmp-under-comparator".under, ---@diagnostic disable-next-line: assign-type-mismatch cmp.config.compare.locality, - require "cmp-under-comparator".under, deprioritize_snippet, - cmp.config.compare.exact, cmp.config.compare.offset, cmp.config.compare.kind, cmp.config.compare.sort_text, diff --git a/lua/utils/indent_blankline.lua b/lua/utils/indent_blankline.lua index 011a2a3..0e37e9c 100644 --- a/lua/utils/indent_blankline.lua +++ b/lua/utils/indent_blankline.lua @@ -35,4 +35,3 @@ function M.setup() end return M - From 865b2735932166759717cf0d3121ce828cdecfaf Mon Sep 17 00:00:00 2001 From: Raju Ghorai Date: Sun, 5 Nov 2023 12:24:35 +0530 Subject: [PATCH 16/23] =?UTF-8?q?=EE=98=95=20Added:=20config=20colorscheme?= =?UTF-8?q?s?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lua/config/defaults.lua | 24 +++++ lua/config/init.lua | 3 +- lua/config/keymaps.lua | 14 +++ lua/config/lazy.lua | 7 +- lua/plugins/colorschemes/nightfox.lua | 6 ++ lua/plugins/extras/dashboard/alpha.lua | 2 +- lua/plugins/extras/dashboard/bufferline.lua | 3 +- lua/plugins/extras/hacker/hacker.lua | 3 + lua/plugins/extras/lsp/mason.lua | 32 ------- lua/plugins/extras/statusline/galaxyline.lua | 2 +- lua/plugins/extras/statusline/luafancy.lua | 14 +++ lua/plugins/extras/statusline/lualine.lua | 2 +- lua/utils/galaxyline.lua | 4 +- lua/utils/luafancy.lua | 96 ++++++++++++++++++++ lua/utils/lualine.lua | 3 +- 15 files changed, 173 insertions(+), 42 deletions(-) create mode 100644 lua/config/defaults.lua create mode 100644 lua/plugins/colorschemes/nightfox.lua create mode 100644 lua/plugins/extras/hacker/hacker.lua delete mode 100644 lua/plugins/extras/lsp/mason.lua create mode 100644 lua/plugins/extras/statusline/luafancy.lua create mode 100644 lua/utils/luafancy.lua diff --git a/lua/config/defaults.lua b/lua/config/defaults.lua new file mode 100644 index 0000000..5cf857b --- /dev/null +++ b/lua/config/defaults.lua @@ -0,0 +1,24 @@ +local M = {} + +M.config = { + figlet_name = { + [[ __ .__ __ ___________ ____ ]], + [[ | | _|__| ____ | | __\ \ \ / / ]], + [[ | |/ / |/ ___\| |/ // | \ Y / ]], + [[ | <| \ \___| __|_ \____|__ /\___/ ]], + [[ \/ \/ \/ \/ ]], + }, + themes = { + "tokyonight", + "catppuccin", + "kanagawa", + "nightfox", + }, + colorscheme = "catppuccin", +} + +function M.setup() +end + +return M diff --git a/lua/config/init.lua b/lua/config/init.lua index bcb05c4..32784d0 100644 --- a/lua/config/init.lua +++ b/lua/config/init.lua @@ -2,4 +2,5 @@ require("config.options") require("config.lazy") require("config.keymaps") require("config.autocmds") -vim.cmd[[colorscheme catppuccin]] +local color_scheme = require("config.defaults").config.colorscheme +vim.cmd("colorscheme " .. color_scheme) diff --git a/lua/config/keymaps.lua b/lua/config/keymaps.lua index 46ca818..ede17e3 100644 --- a/lua/config/keymaps.lua +++ b/lua/config/keymaps.lua @@ -34,3 +34,17 @@ map("v", "", ":m '<-2gv=gv", { desc = "Move up" }) -- Clear search with map({ "i", "n" }, "", "noh", { desc = "Escape and clear hlsearch" }) + +function load_extra_options() + local function bind_extra_cmd(options) + for optionCount = 1, #options do vim.cmd(options[optionCount]) end + end + local options = { + "filetype plugin on", "filetype indent on", "cabbr Q q", "cabbr Q! q!", + "cabbr W! w!", "cabbr W w", "cabbr WA wa", "cabbr Wa wa", "cabbr Wq wq", + "cabbr WQ wq", "cabbr Qa qa", "cabbr QA qa" + } + bind_extra_cmd(options) +end + +load_extra_options() diff --git a/lua/config/lazy.lua b/lua/config/lazy.lua index bf9fe6c..ccba1c8 100644 --- a/lua/config/lazy.lua +++ b/lua/config/lazy.lua @@ -24,14 +24,19 @@ local opts = { }, } +local color_scheme = require("config.defaults").config.colorscheme + require("lazy").setup({ spec = { { import = "plugins" }, { import = "plugins.lsp" }, - { import = "plugins.colorschemes" }, + -- ColorScheme + { import = "plugins.colorschemes." .. color_scheme }, -- StatusLine Select One -- { import = "plugins.extras.statusline.lualine" }, + -- { import = "plugins.extras.statusline.luafancy" }, { import = "plugins.extras.statusline.galaxyline" }, + -- Added required configs -- { import = "plugins.extras.lsp" }, -- { import = "plugins.extras.dashboard" }, }, diff --git a/lua/plugins/colorschemes/nightfox.lua b/lua/plugins/colorschemes/nightfox.lua new file mode 100644 index 0000000..084eeca --- /dev/null +++ b/lua/plugins/colorschemes/nightfox.lua @@ -0,0 +1,6 @@ +if true then + return { + "EdenEast/nightfox.nvim", + priority = 1000, + } +end diff --git a/lua/plugins/extras/dashboard/alpha.lua b/lua/plugins/extras/dashboard/alpha.lua index 75be2c0..e447a44 100644 --- a/lua/plugins/extras/dashboard/alpha.lua +++ b/lua/plugins/extras/dashboard/alpha.lua @@ -4,7 +4,7 @@ return { config = function() local alpha = require("alpha") local dashboard = require("alpha.themes.dashboard") - -- dashboard.section.header.val = require("config.default").options.figlet_name + dashboard.section.header.val = require("config.defaults").config.figlet_name dashboard.section.buttons.val = { dashboard.button("e", " New File", ":ene startinsert "), diff --git a/lua/plugins/extras/dashboard/bufferline.lua b/lua/plugins/extras/dashboard/bufferline.lua index 3114ba5..937c2f5 100644 --- a/lua/plugins/extras/dashboard/bufferline.lua +++ b/lua/plugins/extras/dashboard/bufferline.lua @@ -39,7 +39,8 @@ return { return true end end, - -- highlight = require("catppuccin.groups.integrations.bufferline").get(), + highlight = (require("config.defaults").config.colorscheme == "catppuccin") and + require("catppuccin.groups.integrations.bufferline").get() or nil, }, }, }, diff --git a/lua/plugins/extras/hacker/hacker.lua b/lua/plugins/extras/hacker/hacker.lua new file mode 100644 index 0000000..833458d --- /dev/null +++ b/lua/plugins/extras/hacker/hacker.lua @@ -0,0 +1,3 @@ +if true then + return { "letieu/hacker.nvim" } +end diff --git a/lua/plugins/extras/lsp/mason.lua b/lua/plugins/extras/lsp/mason.lua deleted file mode 100644 index 917fca6..0000000 --- a/lua/plugins/extras/lsp/mason.lua +++ /dev/null @@ -1,32 +0,0 @@ -return { - "williamboman/mason.nvim", - dependencies = { - "williamboman/mason-lspconfig.nvim", - "WhoIsSethDaniel/mason-tool-installer.nvim", - }, - config = function() - local mason = require("mason") - local mason_lspconfig = require("mason-lspconfig") - local mason_tool_installer = require("mason-tool-installer") - - mason.setup({ - ui = { - icons = { - package_installed = "✓", - package_pending = "➜", - package_uninstalled = "✗", - }, - }, - }) - - mason_lspconfig.setup({ - ensure_installed = { - "tsserver", - "html", - "cssls", - "lua_ls", - }, - automatic_installation = true, - }) - end, -} diff --git a/lua/plugins/extras/statusline/galaxyline.lua b/lua/plugins/extras/statusline/galaxyline.lua index 1f95d54..985fad6 100644 --- a/lua/plugins/extras/statusline/galaxyline.lua +++ b/lua/plugins/extras/statusline/galaxyline.lua @@ -1,7 +1,7 @@ if true then return { 'glepnir/galaxyline.nvim', - event = 'VimEnter', + event = 'UIEnter', dependencies = { "kyazdani42/nvim-web-devicons" }, branch = 'main', config = function() diff --git a/lua/plugins/extras/statusline/luafancy.lua b/lua/plugins/extras/statusline/luafancy.lua new file mode 100644 index 0000000..242ff5c --- /dev/null +++ b/lua/plugins/extras/statusline/luafancy.lua @@ -0,0 +1,14 @@ +if true then + return { + "nvim-lualine/lualine.nvim", + event = "UIEnter", + dependencies = { + "kyazdani42/nvim-web-devicons", + "meuter/lualine-so-fancy.nvim", + }, + config = function() + require("utils.luafancy").setup() + end, + } +end + diff --git a/lua/plugins/extras/statusline/lualine.lua b/lua/plugins/extras/statusline/lualine.lua index 1a30a9a..7665578 100644 --- a/lua/plugins/extras/statusline/lualine.lua +++ b/lua/plugins/extras/statusline/lualine.lua @@ -1,7 +1,7 @@ if true then return { "nvim-lualine/lualine.nvim", - event = "VimEnter", + event = "UIEnter", dependencies = { "kyazdani42/nvim-web-devicons" }, config = function() require("utils.lualine").setup() diff --git a/lua/utils/galaxyline.lua b/lua/utils/galaxyline.lua index 7195ded..b6689f5 100644 --- a/lua/utils/galaxyline.lua +++ b/lua/utils/galaxyline.lua @@ -263,7 +263,7 @@ gl.section.left = { DiagnosticHint = { provider = diagnostic.get_diagnostic_hint, condition = function() return conditions.break_width(55) end, - highlight = { colors.blue, colors.bg }, + highlight = { colors.violet, colors.bg }, icon = " 󰌵 ", }, }, @@ -279,7 +279,7 @@ gl.section.right = { -- LSP Client ---------------------------------------------------------------- { LspStartSep = { - provider = function() return "  " end, + provider = function() return "  " end, highlight = { colors.yellow, colors.bg }, separator = "", separator_highlight = { colors.bg }, diff --git a/lua/utils/luafancy.lua b/lua/utils/luafancy.lua new file mode 100644 index 0000000..0d9aae0 --- /dev/null +++ b/lua/utils/luafancy.lua @@ -0,0 +1,96 @@ +local M = {} + +local function get_words() + if vim.bo.filetype == "md" or vim.bo.filetype == "txt" or vim.bo.filetype == "markdown" then + if vim.fn.wordcount().visual_words == 1 then + return tostring(vim.fn.wordcount().visual_words) .. " word" + elseif not (vim.fn.wordcount().visual_words == nil) then + return tostring(vim.fn.wordcount().visual_words) .. " words" + else + return tostring(vim.fn.wordcount().words) .. " words" + end + else + return "" + end +end + +local function filename() + local file = vim.fn.expand("%:p") + local homedir = vim.loop.os_homedir() + local base_dir = homedir .. "/projects" + local _, index = string.find(file, base_dir, 1, true) + if index then + return vim.fn.fnamemodify(file, ":~:.") + else + return vim.fn.expand("%:t") + end +end + +function M.setup() + require("lualine").setup({ + options = { + theme = require("config.defaults").config.colorscheme, + component_separators = { left = "|", right = "|" }, + section_separators = { left = "", right = "" }, + globalstatus = true, + refresh = { + statusline = 100, + }, + }, + sections = { + lualine_a = { + { "fancy_mode", width = 3 } + }, + lualine_b = { + { "fancy_branch" }, + { "fancy_diff" }, + { "fancy_lsp_servers" }, + { "fancy_diagnostics" }, + }, + lualine_c = { + { + "filename", + file_status = true, + path = 1, + formatter = filename, + symbols = { + modified = '  ', + readonly = '  ', + unnamed = '  ', + newfile = '  ', + }, + }, + }, + lualine_x = { + { "fancy_cwd", substitute_home = true } + }, + lualine_y = { + { "fancy_filetype", ts_icon = "" }, + get_words, + { + require("lazy.status").updates, + cond = require("lazy.status").has_updates, + color = { fg = "#ff9e64" }, + }, + { "fancy_searchcount" }, + { "fancy_macro" }, + { "fancy_location" }, + }, + lualine_z = { "progress" }, + }, + inactive_sections = { + lualine_c = { '%f %y %m' }, + lualine_x = {}, + }, + extensions = { + "fzf", + "fugitive", + "quickfix", + "nvim-tree", + "man", + "lazy" + }, + }) +end + +return M diff --git a/lua/utils/lualine.lua b/lua/utils/lualine.lua index 02fb2dc..a5f86f5 100644 --- a/lua/utils/lualine.lua +++ b/lua/utils/lualine.lua @@ -1,5 +1,4 @@ local M = {} -local ui = "catppuccin" local function getLsps() local lspNames = "[" @@ -64,7 +63,7 @@ end function M.setup() require("lualine").setup({ options = { - theme = "catppuccin", + theme = require("config.defaults").config.colorscheme, section_separators = "", component_separators = "", }, From 1b5f1b5665a4aba74f9915f1fb98f77a761b4e98 Mon Sep 17 00:00:00 2001 From: Raju Ghorai Date: Sun, 5 Nov 2023 17:43:38 +0530 Subject: [PATCH 17/23] =?UTF-8?q?=EE=AB=9C=20Add:=20explorer=20config?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lua/plugins/extras/explorer/nvimtree.lua | 2 +- lua/plugins/extras/explorer/oil.lua | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lua/plugins/extras/explorer/nvimtree.lua b/lua/plugins/extras/explorer/nvimtree.lua index 45e0e86..39e4171 100644 --- a/lua/plugins/extras/explorer/nvimtree.lua +++ b/lua/plugins/extras/explorer/nvimtree.lua @@ -3,7 +3,7 @@ return { version = "nightly", event = "VimEnter", keys = { - { "e", mode = { "n" }, "NvimTreeToggle", desc = "NvimTree Explorer" }, + { "n", mode = { "n" }, "NvimTreeToggle", desc = "NvimTree Explorer" }, }, config = function() require("utils.nvimtree").setup() diff --git a/lua/plugins/extras/explorer/oil.lua b/lua/plugins/extras/explorer/oil.lua index 3cba852..6d73b44 100644 --- a/lua/plugins/extras/explorer/oil.lua +++ b/lua/plugins/extras/explorer/oil.lua @@ -3,8 +3,8 @@ return { event = "VimEnter", dependencies = { "nvim-tree/nvim-web-devicons" }, keys = { - { "n", mode = { "n" }, "Oil", desc = "Oil Explorer Current" }, - { "N", mode = { "n" }, "Oil .", desc = "Oil Explorer Root" }, + { "e", mode = { "n" }, "Oil", desc = "Oil Explorer Current" }, + { "E", mode = { "n" }, "Oil .", desc = "Oil Explorer Root" }, }, opts = { default_file_explorer = true, From 6341c811001ca7cdec3c42abb9f43e4aa887ea01 Mon Sep 17 00:00:00 2001 From: Raju Ghorai Date: Sun, 5 Nov 2023 18:26:42 +0530 Subject: [PATCH 18/23] =?UTF-8?q?=EE=AD=9C=20Updated:=20colorschemes=20and?= =?UTF-8?q?=20lazy=20configs?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lua/config/defaults.lua | 3 +- lua/config/lazy.lua | 9 ++-- lua/plugins/colorschemes/catppuccin.lua | 69 ++++++++++++++++++++++--- lua/plugins/colorschemes/nightfox.lua | 26 ++++++++++ lua/plugins/colorschemes/tokyonight.lua | 26 ++++++---- lua/plugins/telescope.lua | 2 +- 6 files changed, 115 insertions(+), 20 deletions(-) diff --git a/lua/config/defaults.lua b/lua/config/defaults.lua index 5cf857b..95b43cf 100644 --- a/lua/config/defaults.lua +++ b/lua/config/defaults.lua @@ -15,7 +15,8 @@ M.config = { "kanagawa", "nightfox", }, - colorscheme = "catppuccin", + colorscheme = "nightfox", + transparent_background = true } function M.setup() diff --git a/lua/config/lazy.lua b/lua/config/lazy.lua index ccba1c8..407a5a1 100644 --- a/lua/config/lazy.lua +++ b/lua/config/lazy.lua @@ -30,15 +30,18 @@ require("lazy").setup({ spec = { { import = "plugins" }, { import = "plugins.lsp" }, + { import = "plugins.extras.explorer" }, -- ColorScheme { import = "plugins.colorschemes." .. color_scheme }, -- StatusLine Select One -- { import = "plugins.extras.statusline.lualine" }, - -- { import = "plugins.extras.statusline.luafancy" }, - { import = "plugins.extras.statusline.galaxyline" }, + { import = "plugins.extras.statusline.luafancy" }, + -- { import = "plugins.extras.statusline.galaxyline" }, -- Added required configs -- { import = "plugins.extras.lsp" }, - -- { import = "plugins.extras.dashboard" }, + { import = "plugins.extras.dashboard.bufferline" }, + { import = "plugins.extras.wilder" }, + { import = "plugins.extras.figlet" }, }, defaults = { lazy = false, diff --git a/lua/plugins/colorschemes/catppuccin.lua b/lua/plugins/colorschemes/catppuccin.lua index 1584aa9..7b0d3dd 100644 --- a/lua/plugins/colorschemes/catppuccin.lua +++ b/lua/plugins/colorschemes/catppuccin.lua @@ -9,7 +9,37 @@ if true then background = { dark = "mocha", }, - transparent_background = true, + color_overrides = { + mocha = { + rosewater = "#EA6962", + flamingo = "#EA6962", + pink = "#D3869B", + mauve = "#D3869B", + red = "#EA6962", + maroon = "#EA6962", + peach = "#BD6F3E", + yellow = "#D8A657", + green = "#A9B665", + teal = "#89B482", + sky = "#89B482", + sapphire = "#89B482", + blue = "#7DAEA3", + lavender = "#7DAEA3", + text = "#D4BE98", + subtext1 = "#BDAE8B", + subtext0 = "#A69372", + overlay2 = "#8C7A58", + overlay1 = "#735F3F", + overlay0 = "#5A4525", + surface2 = "#4B4F51", + surface1 = "#2A2D2E", + surface0 = "#232728", + base = "#1D2021", + mantle = "#191C1D", + crust = "#151819", + }, + }, + transparent_background = require("config.defaults").config.transparent_background, show_end_of_buffer = false, term_colors = true, dim_inactive = { @@ -20,15 +50,15 @@ if true then styles = { comments = { "italic" }, conditionals = { "italic" }, - loops = { "reverse" }, - functions = { "italic" }, - keywords = {}, + loops = { "bold" }, + functions = { "bold" }, + keywords = { "bold" }, strings = {}, variables = { "italic" }, - numbers = {}, + numbers = { "bold" }, booleans = { "italic" }, properties = {}, - types = {}, + types = { "bold" }, operators = {}, }, integrations = { @@ -59,6 +89,33 @@ if true then }, }, }, + custom_highlights = function(colors) + return { + NormalFloat = { bg = colors.crust }, + FloatBorder = { bg = colors.crust, fg = colors.crust }, + VertSplit = { bg = colors.base, fg = colors.surface0 }, + CursorLineNr = { fg = colors.mauve, style = { "bold" } }, + Pmenu = { bg = colors.crust, fg = "" }, + PmenuSel = { bg = colors.surface0, fg = "" }, + TelescopeSelection = { bg = colors.surface0 }, + TelescopePromptCounter = { fg = colors.mauve, style = { "bold" } }, + TelescopePromptPrefix = { bg = colors.surface0 }, + TelescopePromptNormal = { bg = colors.surface0 }, + TelescopeResultsNormal = { bg = colors.mantle }, + TelescopePreviewNormal = { bg = colors.crust }, + TelescopePromptBorder = { bg = colors.surface0, fg = colors.surface0 }, + TelescopeResultsBorder = { bg = colors.mantle, fg = colors.mantle }, + TelescopePreviewBorder = { bg = colors.crust, fg = colors.crust }, + TelescopePromptTitle = { fg = colors.surface0, bg = colors.surface0 }, + TelescopeResultsTitle = { fg = colors.mantle, bg = colors.mantle }, + TelescopePreviewTitle = { fg = colors.crust, bg = colors.crust }, + IndentBlanklineChar = { fg = colors.surface0 }, + IndentBlanklineContextChar = { fg = colors.surface2 }, + GitSignsChange = { fg = colors.peach }, + NvimTreeIndentMarker = { link = "IndentBlanklineChar" }, + NvimTreeExecFile = { fg = colors.text }, + } + end }) end, } diff --git a/lua/plugins/colorschemes/nightfox.lua b/lua/plugins/colorschemes/nightfox.lua index 084eeca..08f4140 100644 --- a/lua/plugins/colorschemes/nightfox.lua +++ b/lua/plugins/colorschemes/nightfox.lua @@ -2,5 +2,31 @@ if true then return { "EdenEast/nightfox.nvim", priority = 1000, + config = function() + require('nightfox').setup({ + options = { + -- Compiled file's destination location + compile_path = vim.fn.stdpath("cache") .. "/nightfox", + compile_file_suffix = "_compiled", -- Compiled file suffix + transparent = require("config.defaults").config.transparent_background, + terminal_colors = true, -- Set terminal colors (vim.g.terminal_color_*) used in `:terminal` + dim_inactive = false, -- Non focused panes set to alternative background + styles = { -- Style to be applied to different syntax groups + comments = "NONE", -- Value is any valid attr-list value `:help attr-list` + functions = "NONE", + keywords = "NONE", + numbers = "NONE", + strings = "NONE", + types = "NONE", + variables = "NONE", + }, + inverse = { -- Inverse highlight for different types + match_paren = false, + visual = false, + search = false, + }, + }, + }) + end } end diff --git a/lua/plugins/colorschemes/tokyonight.lua b/lua/plugins/colorschemes/tokyonight.lua index a616ff0..174c703 100644 --- a/lua/plugins/colorschemes/tokyonight.lua +++ b/lua/plugins/colorschemes/tokyonight.lua @@ -5,23 +5,31 @@ if true then priority = 1000, config = function() require("tokyonight").setup({ - style = "moon", - light_style = "night", - transparent = true, + style = "night", + light_style = "day", + transparent = require("config.defaults").config.transparent_background, terminal_colors = true, styles = { comments = { italic = true }, keywords = { italic = true }, - functions = { italic = true }, - variables = { italic = true }, + functions = {}, + variables = {}, sidebars = "dark", - floats = "dark", + floats = "transparent", + }, + sidebars = { + "qf", + "help", + "vista_kind", + "terminal", + "spectre_panel", + "startuptime", + "Outline", }, - sidebars = { "qf", "help" }, day_brightness = 0.3, - hide_inactive_statusline = true, + hide_inactive_statusline = false, dim_inactive = true, - lualine_bold = true, + lualine_bold = false, }) end, } diff --git a/lua/plugins/telescope.lua b/lua/plugins/telescope.lua index 82cfa7c..8f6cd69 100644 --- a/lua/plugins/telescope.lua +++ b/lua/plugins/telescope.lua @@ -53,7 +53,7 @@ return { desc = "[S]earch [S]ymbols", }, { - "", + "", mode = { "n" }, function() require("telescope.builtin").buffers({ From 7d0e61237bff38a46b54a13996263b131d066ee5 Mon Sep 17 00:00:00 2001 From: Raju Ghorai Date: Mon, 6 Nov 2023 10:50:56 +0530 Subject: [PATCH 19/23] =?UTF-8?q?=F0=9F=98=86Added:=20Vscode.vim=20in=20lu?= =?UTF-8?q?a?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- init.lua | 131 ++++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 130 insertions(+), 1 deletion(-) diff --git a/init.lua b/init.lua index dbc863e..7e7a0fc 100644 --- a/init.lua +++ b/init.lua @@ -1 +1,130 @@ -require("config") +if vim.g.vscode then + print("VSCode") + -- VSCode + local function split(direction, file) + if direction == 'h' then + vim.fn["VSCodeCall"]('workbench.action.splitEditorDown') + else + vim.fn["VSCodeCall"]('workbench.action.splitEditorRight') + end + if file ~= '' then + vim.fn["VSCodeExtensionNotify"]('open-file', vim.fn["expand"](file), 'all') + end + end + + local function splitNew(direction, file) + local fileToOpen = file == '' and '__vscode_new__' or file + split(direction, fileToOpen) + end + + local function closeOtherEditors() + vim.fn["VSCodeNotify"]('workbench.action.closeEditorsInOtherGroups') + vim.fn["VSCodeNotify"]('workbench.action.closeOtherEditors') + end + + local function manageEditorSize(count, to) + for i = 1, count or 1 do + local action = to == 'increase' and 'workbench.action.increaseViewSize' or 'workbench.action.decreaseViewSize' + vim.fn["VSCodeNotify"](action) + end + end + + vim.cmd("command! -complete=file -nargs=? Split call v:lua.split('h', )") + vim.cmd("command! -complete=file -nargs=? Vsplit call v:lua.split('v', )") + vim.cmd("command! -complete=file -nargs=? New call v:lua.split('h', '__vscode_new__')") + vim.cmd("command! -complete=file -nargs=? Vnew call v:lua.split('v', '__vscode_new__')") + vim.cmd( + "command! -bang Only if == '!' | call v:lua.closeOtherEditors() | else | call VSCodeNotify('workbench.action.joinAllGroups') | endif") + + vim.api.nvim_set_keymap('n', 's', ':call v:lua.split("h")', { noremap = true, silent = true }) + vim.api.nvim_set_keymap('x', 's', ':call v:lua.split("h")', { noremap = true, silent = true }) + + vim.api.nvim_set_keymap('n', 'v', ':call v:lua.split("v")', { noremap = true, silent = true }) + vim.api.nvim_set_keymap('x', 'v', ':call v:lua.split("v")', { noremap = true, silent = true }) + + vim.api.nvim_set_keymap('n', 'n', ':call v:lua.splitNew("h", "__vscode_new__")', + { noremap = true, silent = true }) + vim.api.nvim_set_keymap('x', 'n', ':call v:lua.splitNew("h", "__vscode_new__")', + { noremap = true, silent = true }) + + vim.api.nvim_set_keymap('n', '=', ':call VSCodeNotify("workbench.action.evenEditorWidths")', + { noremap = true, silent = true }) + vim.api.nvim_set_keymap('x', '=', ':call VSCodeNotify("workbench.action.evenEditorWidths")', + { noremap = true, silent = true }) + + vim.api.nvim_set_keymap('n', '>', ':call v:lua.manageEditorSize(v:count, "increase")', + { noremap = true, silent = true }) + vim.api.nvim_set_keymap('x', '>', ':call v:lua.manageEditorSize(v:count, "increase")', + { noremap = true, silent = true }) + vim.api.nvim_set_keymap('n', '+', ':call v:lua.manageEditorSize(v:count, "increase")', + { noremap = true, silent = true }) + vim.api.nvim_set_keymap('x', '+', ':call v:lua.manageEditorSize(v:count, "increase")', + { noremap = true, silent = true }) + vim.api.nvim_set_keymap('n', '<', ':call v:lua.manageEditorSize(v:count, "decrease")', + { noremap = true, silent = true }) + vim.api.nvim_set_keymap('x', '<', ':call v:lua.manageEditorSize(v:count, "decrease")', + { noremap = true, silent = true }) + vim.api.nvim_set_keymap('n', '-', ':call v:lua.manageEditorSize(v:count, "decrease")', + { noremap = true, silent = true }) + vim.api.nvim_set_keymap('x', '-', ':call v:lua.manageEditorSize(v:count, "decrease")', + { noremap = true, silent = true }) + + -- Better Navigation + vim.api.nvim_set_keymap('n', '', ':call VSCodeNotify("workbench.action.navigateDown")', + { noremap = true, silent = true }) + vim.api.nvim_set_keymap('x', '', ':call VSCodeNotify("workbench.action.navigateDown")', + { noremap = true, silent = true }) + vim.api.nvim_set_keymap('n', '', ':call VSCodeNotify("workbench.action.navigateUp")', + { noremap = true, silent = true }) + vim.api.nvim_set_keymap('x', '', ':call VSCodeNotify("workbench.action.navigateUp")', + { noremap = true, silent = true }) + vim.api.nvim_set_keymap('n', '', ':call VSCodeNotify("workbench.action.navigateLeft")', + { noremap = true, silent = true }) + vim.api.nvim_set_keymap('x', '', ':call VSCodeNotify("workbench.action.navigateLeft")', + { noremap = true, silent = true }) + vim.api.nvim_set_keymap('n', '', ':call VSCodeNotify("workbench.action.navigateRight")', + { noremap = true, silent = true }) + vim.api.nvim_set_keymap('x', '', ':call VSCodeNotify("workbench.action.navigateRight")', + { noremap = true, silent = true }) + + -- Bind C-/ to vscode commentary + vim.api.nvim_set_keymap('x', '', ':call Comment()', { noremap = true, silent = true }) + vim.api.nvim_set_keymap('n', '', ':call Comment()', { noremap = true, silent = true }) + + vim.api.nvim_set_keymap('n', '_', ':call VSCodeNotify("workbench.action.toggleEditorWidths")', + { noremap = true, silent = true }) + + vim.api.nvim_set_keymap('n', '', ':call VSCodeNotify("whichkey.show")', { noremap = true, silent = true }) + vim.api.nvim_set_keymap('x', '', ':call VSCodeNotify("whichkey.show")', { noremap = true, silent = true }) + + -- Relative Number + vim.cmd("command! Nu call VSCodeCall('settings.cycle.relativeLineNumbers')") + vim.cmd("autocmd InsertEnter * :Nu") + vim.cmd("autocmd InsertLeave * :Nu") + + -- vim-commentary + vim.api.nvim_set_keymap('x', 'gc', 'VSCodeCommentary', {}) + vim.api.nvim_set_keymap('n', 'gc', 'VSCodeCommentary', {}) + vim.api.nvim_set_keymap('o', 'gc', 'VSCodeCommentary', {}) + vim.api.nvim_set_keymap('n', 'gcc', 'VSCodeCommentaryLine', {}) + + -- Theme Changer + local function setCursorLineNrColorInsert(mode) + if mode == "i" then + vim.fn["VSCodeNotify"]('nvim-theme.nvimColorInsert') + elseif mode == "r" then + vim.fn["VSCodeNotify"]('nvim-theme.nvimColorReplace') + end + end + + vim.cmd("augroup CursorLineNrColorSwap") + vim.cmd("autocmd!") + vim.cmd("autocmd ModeChanged *:[vV\\x16]* call VSCodeNotify('nvim-theme.nvimColorVisual')") + vim.cmd("autocmd ModeChanged *:[R]* call VSCodeNotify('nvim-theme.nvimColorReplace')") + vim.cmd("autocmd InsertEnter * call setCursorLineNrColorInsert(v:insertmode)") + vim.cmd("autocmd InsertLeave * call VSCodeNotify('nvim-theme.nvimColorNormal')") + vim.cmd("autocmd CursorHold * call VSCodeNotify('nvim-theme.nvimColorNormal')") + vim.cmd("augroup END") +else + require("config") +end From 6f2a018c536773d9e18c6ecd0ac22faf31102af8 Mon Sep 17 00:00:00 2001 From: Raju Ghorai Date: Mon, 6 Nov 2023 18:24:48 +0530 Subject: [PATCH 20/23] =?UTF-8?q?=F0=9F=98=8F=20Updated:=20tmux=20config,?= =?UTF-8?q?=20wasp=20config=20and=20added=20gopls?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lua/plugins/basic.lua | 16 ---------------- lua/plugins/extras/tmux/tmux.lua | 18 ++++++++++++++++++ lua/plugins/extras/wasp/wasp.lua | 15 +++++++++++++++ lua/plugins/lsp/lspconfig.lua | 6 ++++++ lua/plugins/lsp/mason.lua | 1 + 5 files changed, 40 insertions(+), 16 deletions(-) create mode 100644 lua/plugins/extras/tmux/tmux.lua create mode 100644 lua/plugins/extras/wasp/wasp.lua diff --git a/lua/plugins/basic.lua b/lua/plugins/basic.lua index fcb76a9..1c7fb10 100644 --- a/lua/plugins/basic.lua +++ b/lua/plugins/basic.lua @@ -1,20 +1,4 @@ return { - { - -- tmux nav for nvim - "alexghergh/nvim-tmux-navigation", - event = "VeryLazy", - config = function() - require "nvim-tmux-navigation".setup { - disable_when_zoomed = true, - keybindings = { - left = "", - down = "", - up = "", - right = "", - }, - } - end - }, "jiangmiao/auto-pairs", { "tpope/vim-surround", event = "BufEnter" }, { "tpope/vim-repeat", event = "BufEnter" }, diff --git a/lua/plugins/extras/tmux/tmux.lua b/lua/plugins/extras/tmux/tmux.lua new file mode 100644 index 0000000..b9f4e0e --- /dev/null +++ b/lua/plugins/extras/tmux/tmux.lua @@ -0,0 +1,18 @@ +-- tmux navigation for nvim +if true then + return { + "alexghergh/nvim-tmux-navigation", + event = "VeryLazy", + config = function() + require "nvim-tmux-navigation".setup { + disable_when_zoomed = true, + keybindings = { + left = "", + down = "", + up = "", + right = "", + }, + } + end + } +end diff --git a/lua/plugins/extras/wasp/wasp.lua b/lua/plugins/extras/wasp/wasp.lua new file mode 100644 index 0000000..e8ca5db --- /dev/null +++ b/lua/plugins/extras/wasp/wasp.lua @@ -0,0 +1,15 @@ +if true then + return { + "LeoRiether/wasp.nvim", + config = function() + require('wasp').setup { + template_path = function() return 'lib/template.' .. vim.fn.expand("%:e") end, + lib = { + finder = 'telescope', -- or 'fzf' + path = 'lib/', + }, + competitive_companion = { file = 'inp' }, + } + end + } +end diff --git a/lua/plugins/lsp/lspconfig.lua b/lua/plugins/lsp/lspconfig.lua index c686a09..8727a27 100644 --- a/lua/plugins/lsp/lspconfig.lua +++ b/lua/plugins/lsp/lspconfig.lua @@ -182,6 +182,12 @@ return { on_attach = on_attach, }) + -- configure golang server + lspconfig["gopls"].setup({ + capabilities = capabilities, + on_attach = on_attach, + }) + -- Turn on lsp status information require("fidget").setup() end, diff --git a/lua/plugins/lsp/mason.lua b/lua/plugins/lsp/mason.lua index 34ea596..ed9fc46 100644 --- a/lua/plugins/lsp/mason.lua +++ b/lua/plugins/lsp/mason.lua @@ -28,6 +28,7 @@ return { "docker_compose_language_service", "dockerls", "yamlls", + "gopls" }, automatic_installation = true, }) From cd16fceafc371fd7533f96162fbcad35caa8a784 Mon Sep 17 00:00:00 2001 From: Raju Ghorai Date: Wed, 8 Nov 2023 00:29:20 +0530 Subject: [PATCH 21/23] =?UTF-8?q?=F0=9F=93=84=20Updated=20files:=20colorsc?= =?UTF-8?q?hemes,=20nightfox,=20wilder=20and=20galaxyline?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lua/config/defaults.lua | 27 ++++++++++++++------------- lua/plugins/colorschemes/nightfox.lua | 1 + lua/plugins/colorschemes/nightowl.lua | 8 ++++++++ lua/plugins/extras/wilder/wilder.lua | 1 + lua/utils/galaxyline.lua | 2 +- 5 files changed, 25 insertions(+), 14 deletions(-) create mode 100644 lua/plugins/colorschemes/nightowl.lua diff --git a/lua/config/defaults.lua b/lua/config/defaults.lua index 95b43cf..8c5e1c5 100644 --- a/lua/config/defaults.lua +++ b/lua/config/defaults.lua @@ -2,20 +2,21 @@ local M = {} M.config = { figlet_name = { - [[ __ .__ __ ___________ ____ ]], - [[ | | _|__| ____ | | __\ \ \ / / ]], - [[ | |/ / |/ ___\| |/ // | \ Y / ]], - [[ | <| \ \___| __|_ \____|__ /\___/ ]], - [[ \/ \/ \/ \/ ]], - }, + [[ __ .__ __ ___________ ____ ]], + [[ | | _|__| ____ | | __\ \ \ / / ]], + [[ | |/ / |/ ___\| |/ // | \ Y / ]], + [[ | <| \ \___| __|_ \____|__ /\___/ ]], + [[ \/ \/ \/ \/ ]], + }, themes = { - "tokyonight", - "catppuccin", - "kanagawa", - "nightfox", - }, - colorscheme = "nightfox", + "tokyonight", + "catppuccin", + "kanagawa", + "nightfox", + "night-owl", + }, + colorscheme = "catppuccin", transparent_background = true } diff --git a/lua/plugins/colorschemes/nightfox.lua b/lua/plugins/colorschemes/nightfox.lua index 08f4140..f86eeef 100644 --- a/lua/plugins/colorschemes/nightfox.lua +++ b/lua/plugins/colorschemes/nightfox.lua @@ -1,6 +1,7 @@ if true then return { "EdenEast/nightfox.nvim", + enabled = true, priority = 1000, config = function() require('nightfox').setup({ diff --git a/lua/plugins/colorschemes/nightowl.lua b/lua/plugins/colorschemes/nightowl.lua new file mode 100644 index 0000000..fba67f0 --- /dev/null +++ b/lua/plugins/colorschemes/nightowl.lua @@ -0,0 +1,8 @@ +if true then + result { + "oxfist/night-owl.nvim", + as = "night-owl", + enabled = true, + priority = 1000, + } +end diff --git a/lua/plugins/extras/wilder/wilder.lua b/lua/plugins/extras/wilder/wilder.lua index 020228d..9b543b0 100644 --- a/lua/plugins/extras/wilder/wilder.lua +++ b/lua/plugins/extras/wilder/wilder.lua @@ -1,5 +1,6 @@ return { 'gelguy/wilder.nvim', + event = "VimEnter", config = function() local wilder = require("wilder") wilder.setup({ diff --git a/lua/utils/galaxyline.lua b/lua/utils/galaxyline.lua index b6689f5..560ddf2 100644 --- a/lua/utils/galaxyline.lua +++ b/lua/utils/galaxyline.lua @@ -333,7 +333,7 @@ gl.section.right = { Indentation = { provider = function() local indentation_type = "Tabs:" - if vim.api.nvim_buf_get_option(0, "expandtab") then indentation_type = "Spaces:" end + if vim.api.nvim_buf_get_option(0, "expandtab") then indentation_type = " Spaces:" end return indentation_type .. vim.o.ts end, condition = conditions.break_width, From 73160817dd75de948330fee93520eedaff8ae9e2 Mon Sep 17 00:00:00 2001 From: Raju Ghorai Date: Wed, 8 Nov 2023 00:38:01 +0530 Subject: [PATCH 22/23] =?UTF-8?q?=F0=9F=91=BAAdded:=20snippet/go.lua?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- snippets/go.lua | 96 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 96 insertions(+) create mode 100644 snippets/go.lua diff --git a/snippets/go.lua b/snippets/go.lua new file mode 100644 index 0000000..8ced541 --- /dev/null +++ b/snippets/go.lua @@ -0,0 +1,96 @@ +local ls = require("luasnip") --{{{ +local s = ls.s +local i = ls.i +local t = ls.t + +local d = ls.dynamic_node +local c = ls.choice_node +local f = ls.function_node +local sn = ls.snippet_node + +local fmt = require("luasnip.extras.fmt").fmt +local rep = require("luasnip.extras").rep + +local snippets, autosnippets = {}, {} --}}} + +local group = vim.api.nvim_create_augroup("Javascript Snippets", { clear = true }) +local file_pattern = "*.js" + +local function cs(trigger, nodes, opts) --{{{ + local snippet = s(trigger, nodes) + local target_table = snippets + + local pattern = file_pattern + local keymaps = {} + + if opts ~= nil then + -- check for custom pattern + if opts.pattern then + pattern = opts.pattern + end + + -- if opts is a string + if type(opts) == "string" then + if opts == "auto" then + target_table = autosnippets + else + table.insert(keymaps, { "i", opts }) + end + end + + -- if opts is a table + if opts ~= nil and type(opts) == "table" then + for _, keymap in ipairs(opts) do + if type(keymap) == "string" then + table.insert(keymaps, { "i", keymap }) + else + table.insert(keymaps, keymap) + end + end + end + + -- set autocmd for each keymap + if opts ~= "auto" then + for _, keymap in ipairs(keymaps) do + vim.api.nvim_create_autocmd("BufEnter", { + pattern = pattern, + group = group, + callback = function() + vim.keymap.set(keymap[1], keymap[2], function() + ls.snip_expand(snippet) + end, { noremap = true, silent = true, buffer = true }) + end, + }) + end + end + end + + table.insert(target_table, snippet) -- insert snippet into appropriate table +end --}}} + +cs( -- Go gin example snippet + "ginexample", + fmt( + [[ + package {} + + import "github.com/gin-gonic/gin" + + func main() {{ + r:= gin.Default(); + r.GET("/", func(ctx *gin.Context) {{ + ctx.String(200, "{}") + }}) + r.Run(":{}") + }} + ]], + { + i(1, "main"), + i(2, "Hello World"), + i(3, "port number"), + } + ) +) + + +return snippets, autosnippets From d04db81c861dab20b4af58c8ca70ef126fd560fc Mon Sep 17 00:00:00 2001 From: Raju Ghorai Date: Wed, 8 Nov 2023 13:27:28 +0530 Subject: [PATCH 23/23] =?UTF-8?q?=EF=91=97=20Adedd:=20go=20snippets/go.lua?= =?UTF-8?q?=20and=20changes=20wilder?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lua/config/lazy.lua | 2 +- lua/plugins/extras/wilder/wilder.lua | 59 ++++++++++++++++++++++------ snippets/go.lua | 20 +++++++++- 3 files changed, 66 insertions(+), 15 deletions(-) diff --git a/lua/config/lazy.lua b/lua/config/lazy.lua index 407a5a1..009de0d 100644 --- a/lua/config/lazy.lua +++ b/lua/config/lazy.lua @@ -47,7 +47,7 @@ require("lazy").setup({ lazy = false, version = false, }, - checker = { enabled = true }, + checker = { enabled = false }, performance = { rtp = { disabled_plugins = { diff --git a/lua/plugins/extras/wilder/wilder.lua b/lua/plugins/extras/wilder/wilder.lua index 9b543b0..ba5c887 100644 --- a/lua/plugins/extras/wilder/wilder.lua +++ b/lua/plugins/extras/wilder/wilder.lua @@ -8,18 +8,53 @@ return { next_key = "", previous_key = "", }) - wilder.set_option('renderer', wilder.popupmenu_renderer( - wilder.popupmenu_palette_theme({ - border = 'rounded', - max_height = '60%', - min_height = 0, - prompt_position = 'top', - reverse = 0, - highlighter = wilder.basic_highlighter(), - left = { ' ', wilder.popupmenu_devicons() }, - right = { ' ', wilder.popupmenu_scrollbar() }, - }) - )) + wilder.set_option('renderer', wilder.renderer_mux({ + [':'] = wilder.popupmenu_renderer(wilder.popupmenu_border_theme({ + highlighter = wilder.basic_highlighter(), + reverse = 0, + border = 'rounded', + left = { ' ', wilder.popupmenu_devicons() }, + right = { ' ', wilder.popupmenu_scrollbar() }, + })), + ['/'] = wilder.wildmenu_renderer({ + highlighter = { + wilder.lua_pcre2_highlighter(), + wilder.lua_fzy_highlighter(), + }, + pumblend = 20, + separator = ' · ', + left = { ' ', wilder.wildmenu_spinner(), ' ' }, + right = { ' ', wilder.wildmenu_index() }, + highlights = { + accent = wilder.make_hl('WilderAccent', 'Pmenu', { { a = 1 }, { a = 1 }, { foreground = '#f4468f' } }), + }, + }), + ['?'] = wilder.wildmenu_renderer({ + highlighter = { + wilder.lua_pcre2_highlighter(), + wilder.lua_fzy_highlighter(), + }, + pumblend = 20, + separator = ' · ', + left = { ' ', wilder.wildmenu_spinner(), ' ' }, + right = { ' ', wilder.wildmenu_index() }, + highlights = { + accent = wilder.make_hl('WilderAccent', 'Pmenu', { { a = 1 }, { a = 1 }, { foreground = '#f4468f' } }), + }, + }), + }), + 'pipeline', { + wilder.branch( + wilder.python_file_finder_pipeline({ + file_command = { 'rg', '--files' }, + dir_command = { 'fd', '-td' }, + filters = { 'fuzzy_filter', 'difflib_sorter' }, + }), + wilder.cmdline_pipeline(), + wilder.python_search_pipeline() + ), + } + ) end, build = ':UpdateRemotePlugins' } diff --git a/snippets/go.lua b/snippets/go.lua index 8ced541..81ee282 100644 --- a/snippets/go.lua +++ b/snippets/go.lua @@ -13,8 +13,8 @@ local rep = require("luasnip.extras").rep local snippets, autosnippets = {}, {} --}}} -local group = vim.api.nvim_create_augroup("Javascript Snippets", { clear = true }) -local file_pattern = "*.js" +local group = vim.api.nvim_create_augroup("GoLang Snippets", { clear = true }) +local file_pattern = "*.go" local function cs(trigger, nodes, opts) --{{{ local snippet = s(trigger, nodes) @@ -92,5 +92,21 @@ cs( -- Go gin example snippet ) ) +cs( + "gorm:sqlite", + fmt([[ + // import "github.com/jinzhu/gorm" + // import _ "github.com/jinzhu/gorm/dialects/sqlite" + db, err := gorm.Open("sqlite3", "{}.db") + if err != nil {{ + panic("Failed to connect database") + }} + ]], + { + i(1, "db_name") + } + ) +) + return snippets, autosnippets