diff --git a/cd-project.nvim.json b/cd-project.nvim.json new file mode 100644 index 0000000..4e80fd3 --- /dev/null +++ b/cd-project.nvim.json @@ -0,0 +1 @@ +[{"name": "pika", "path": "/home/pika"}, {"name": ".config", "path": "/home/pika/.config/"}, {"name": "gitea", "path": "/home/pika/gitea/"}] \ No newline at end of file diff --git a/lua/pika/core/keymaps.lua b/lua/pika/core/keymaps.lua index 8f94dff..d64a927 100644 --- a/lua/pika/core/keymaps.lua +++ b/lua/pika/core/keymaps.lua @@ -71,6 +71,7 @@ map( "CBcabox1", { noremap = true, silent = true, desc = "[c]reate comment [b]ox (centered)" } ) + map( "v", "cB", @@ -91,6 +92,9 @@ map("n", "R", [[:%s/\<\>//gI]]) -- ─< LoremIpsum generator >──────────────────────────────────────────────────────────── map("n", "L", ":LoremIpsum ") +map("n", "cd", ":CdProject", { noremap = true, silent = true, desc = "[c]d into a predefined project" }) +map("n", "cd", ":CdProjectManualAdd", { noremap = true, silent = true, desc = "Add new projects to [cd]" }) + -- window management map("n", "sv", "v", { desc = "Split window vertically" }) -- split window vertically map("n", "sh", "s", { desc = "Split window horizontally" }) -- split window horizontally diff --git a/lua/pika/plugins/bufferline.lua b/lua/pika/plugins/bufferline.lua index 8367fac..f7a90de 100644 --- a/lua/pika/plugins/bufferline.lua +++ b/lua/pika/plugins/bufferline.lua @@ -1,6 +1,6 @@ return { "akinsho/bufferline.nvim", - dependencies = { "nvim-tree/nvim-web-devicons" }, + dependencies = { "echasnovski/mini.icons" }, version = "*", opts = { options = { diff --git a/lua/pika/plugins/cd-project.lua b/lua/pika/plugins/cd-project.lua new file mode 100644 index 0000000..7673e51 --- /dev/null +++ b/lua/pika/plugins/cd-project.lua @@ -0,0 +1,41 @@ +-- using lazy.nvim +return { + "LintaoAmons/cd-project.nvim", + config = function() + require("cd-project").setup({ + -- this json file is acting like a database to update and read the projects in real time. + -- So because it's just a json file, you can edit directly to add more paths you want manually + projects_config_filepath = vim.fs.normalize(vim.fn.stdpath("config") .. "/cd-project.nvim.json"), + -- this controls the behaviour of `CdProjectAdd` command about how to get the project directory + project_dir_pattern = { ".git", ".gitignore", "Cargo.toml", "package.json", "go.mod" }, + choice_format = "both", -- optional, you can switch to "name" or "path" + projects_picker = "vim-ui", -- optional, you can switch to `telescope` + auto_register_project = false, -- optional, toggle on/off the auto add project behaviour + -- do whatever you like by hooks + hooks = { + { + callback = function(dir) + vim.notify("switched to dir: " .. dir) + end, + }, + { + callback = function(_) + vim.cmd("Telescope find_files") + end, + }, + { + callback = function(dir) + vim.notify("switched to dir: " .. dir) + end, -- required, action when trigger the hook + name = "cd hint", -- optional + order = 1, -- optional, the exection order if there're multiple hooks to be trigger at one point + pattern = "cd-project.nvim", -- optional, trigger hook if contains pattern + trigger_point = "DISABLE", -- optional, enum of trigger_points, default to `AFTER_CD` + match_rule = function(dir) -- optional, a function return bool. if have this fields, then pattern will be ignored + return true + end, + }, + }, + }) + end, +} diff --git a/lua/pika/plugins/colorizer.lua b/lua/pika/plugins/colorizer.lua index 33b4b59..0d3dac4 100644 --- a/lua/pika/plugins/colorizer.lua +++ b/lua/pika/plugins/colorizer.lua @@ -1,17 +1,72 @@ return { - { - 'norcalli/nvim-colorizer.lua', - opts = { - 'css', - 'html', - 'php', - 'bash', - 'fish', - 'lua', - 'toml', - html = { - mode = 'foreground', - }, - }, - }, + -- { + -- 'norcalli/nvim-colorizer.lua', + -- opts = { + -- 'css', + -- 'html', + -- 'php', + -- 'bash', + -- 'fish', + -- 'lua', + -- 'toml', + -- html = { + -- mode = 'foreground', + -- }, + -- }, + -- }, + "brenoprata10/nvim-highlight-colors", + opts = { + ---Render style + ---@usage 'background'|'foreground'|'virtual' + render = "background", + + ---Set virtual symbol (requires render to be set to 'virtual') + virtual_symbol = "■", + + ---Set virtual symbol suffix (defaults to '') + virtual_symbol_prefix = "", + + ---Set virtual symbol suffix (defaults to ' ') + virtual_symbol_suffix = " ", + + ---Set virtual symbol position() + ---@usage 'inline'|'eol'|'eow' + ---inline mimics VS Code style + ---eol stands for `end of column` - Recommended to set `virtual_symbol_suffix = ''` when used. + ---eow stands for `end of word` - Recommended to set `virtual_symbol_prefix = ' ' and virtual_symbol_suffix = ''` when used. + virtual_symbol_position = "inline", + + ---Highlight hex colors, e.g. '#FFFFFF' + enable_hex = true, + + ---Highlight short hex colors e.g. '#fff' + enable_short_hex = true, + + ---Highlight rgb colors, e.g. 'rgb(0 0 0)' + enable_rgb = true, + + ---Highlight hsl colors, e.g. 'hsl(150deg 30% 40%)' + enable_hsl = true, + + ---Highlight CSS variables, e.g. 'var(--testing-color)' + enable_var_usage = true, + + ---Highlight named colors, e.g. 'green' + enable_named_colors = true, + + ---Highlight tailwind colors, e.g. 'bg-blue-500' + enable_tailwind = false, + + ---Set custom colors + ---Label must be properly escaped with '%' to adhere to `string.gmatch` + --- :help string.gmatch + custom_colors = { + { label = "%-%-theme%-primary%-color", color = "#0f1219" }, + { label = "%-%-theme%-secondary%-color", color = "#5a5d64" }, + }, + + -- Exclude filetypes or buftypes from highlighting e.g. 'exclude_buftypes = {'text'}' + exclude_filetypes = {}, + exclude_buftypes = {}, + }, } diff --git a/lua/pika/plugins/init.lua b/lua/pika/plugins/init.lua index a885d95..2299bb6 100644 --- a/lua/pika/plugins/init.lua +++ b/lua/pika/plugins/init.lua @@ -1,4 +1,5 @@ return { - "nvim-lua/plenary.nvim", -- lua functions that many plugins use - "christoomey/vim-tmux-navigator", -- tmux & split window navigation + "nvim-lua/plenary.nvim", -- lua functions that many plugins use + "christoomey/vim-tmux-navigator", -- tmux & split window navigation + "dstein64/nvim-scrollview", } diff --git a/lua/pika/plugins/notify.lua b/lua/pika/plugins/notify.lua new file mode 100644 index 0000000..f42c72d --- /dev/null +++ b/lua/pika/plugins/notify.lua @@ -0,0 +1,13 @@ +return { + "rcarriga/nvim-notify", + config = function() + require("notify").setup({ + stages = "fade_in_slide_out", + background_colour = "FloatShadow", + timeout = 2750, + render = "compact", + -- opacity = 75, + }) + vim.notify = require("notify") + end, +} diff --git a/lua/pika/plugins/nvim-cmp.lua b/lua/pika/plugins/nvim-cmp.lua index 37c419e..aff5b5a 100644 --- a/lua/pika/plugins/nvim-cmp.lua +++ b/lua/pika/plugins/nvim-cmp.lua @@ -1,77 +1,77 @@ return { - 'hrsh7th/nvim-cmp', - event = 'InsertEnter', - dependencies = { - 'hrsh7th/cmp-buffer', -- source for text in buffer - 'hrsh7th/cmp-path', -- source for file system paths - { - 'L3MON4D3/LuaSnip', - -- follow latest release. - version = 'v2.*', -- Replace by the latest released major (first number of latest release) - -- install jsregexp (optional!). - build = 'make install_jsregexp', - }, - 'saadparwaiz1/cmp_luasnip', -- for autocompletion - 'rafamadriz/friendly-snippets', -- useful snippets - 'onsails/lspkind.nvim', -- vs-code like pictograms - }, - config = function() - local cmp = require 'cmp' - local luasnip = require 'luasnip' - local lspkind = require 'lspkind' + "hrsh7th/nvim-cmp", + event = "InsertEnter", + dependencies = { + "hrsh7th/cmp-buffer", -- source for text in buffer + "hrsh7th/cmp-path", -- source for file system paths + { + "L3MON4D3/LuaSnip", + -- follow latest release. + version = "v2.*", -- Replace by the latest released major (first number of latest release) + -- install jsregexp (optional!). + build = "make install_jsregexp", + }, + "saadparwaiz1/cmp_luasnip", -- for autocompletion + "rafamadriz/friendly-snippets", -- useful snippets + "onsails/lspkind.nvim", -- vs-code like pictograms + }, + config = function() + local cmp = require("cmp") + local luasnip = require("luasnip") + local lspkind = require("lspkind") - -- loads vscode style snippets from installed plugins (e.g. friendly-snippets) - require('luasnip.loaders.from_vscode').lazy_load() + -- loads vscode style snippets from installed plugins (e.g. friendly-snippets) + require("luasnip.loaders.from_vscode").lazy_load() - cmp.setup { - completion = { - completeopt = 'menu,menuone,preview,noselect', - }, - snippet = { - expand = function(args) - luasnip.lsp_expand(args.body) - end, - }, - mapping = cmp.mapping.preset.insert { - [''] = cmp.mapping.select_prev_item(), -- previous suggestion - [''] = cmp.mapping.select_next_item(), -- next suggestion - [''] = cmp.mapping.scroll_docs(-4), - [''] = cmp.mapping.scroll_docs(4), - [''] = cmp.mapping.complete(), -- show completion suggestions - [''] = cmp.mapping.abort(), -- close completion window - [''] = cmp.mapping.confirm { select = false }, + cmp.setup({ + completion = { + completeopt = "menu,menuone,preview,noselect", + }, + snippet = { + expand = function(args) + luasnip.lsp_expand(args.body) + end, + }, + mapping = cmp.mapping.preset.insert({ + [""] = cmp.mapping.select_prev_item(), -- previous suggestion + [""] = cmp.mapping.select_next_item(), -- next suggestion + [""] = cmp.mapping.scroll_docs(-4), + [""] = cmp.mapping.scroll_docs(4), + [""] = cmp.mapping.complete(), -- show completion suggestions + [""] = cmp.mapping.abort(), -- close completion window + [""] = cmp.mapping.confirm({ select = false }), - -- Tab to complete - [''] = cmp.mapping(function(fallback) - if cmp.visible() then - cmp.confirm { select = true } -- confirm selection - elseif luasnip.expand_or_jumpable() then - luasnip.expand_or_jump() - else - fallback() - end - end, { 'i', 's' }), - }, - -- sources for autocompletion - sources = cmp.config.sources { - { name = 'nvim_lsp' }, - { name = 'luasnip' }, -- snippets - { name = 'buffer' }, -- text within current buffer - { name = 'path' }, -- file system paths - }, - -- configure lspkind for vs-code like pictograms in completion menu - formatting = { - format = lspkind.cmp_format { - mode = 'symbol_text', -- show symbol text with icons - maxwidth = 50, - ellipsis_char = '...', - }, - }, - -- Enable rounded borders - window = { - completion = cmp.config.window.bordered(), - documentation = cmp.config.window.bordered(), - }, - } - end, + -- Tab to complete + [""] = cmp.mapping(function(fallback) + if cmp.visible() then + cmp.confirm({ select = true }) -- confirm selection + elseif luasnip.expand_or_jumpable() then + luasnip.expand_or_jump() + else + fallback() + end + end, { "i", "s" }), + }), + -- sources for autocompletion + sources = cmp.config.sources({ + { name = "nvim_lsp" }, + { name = "luasnip" }, -- snippets + { name = "buffer" }, -- text within current buffer + { name = "path" }, -- file system paths + }), + -- configure lspkind for vs-code like pictograms in completion menu + formatting = { + format = lspkind.cmp_format({ + mode = "symbol_text", -- show symbol text with icons + maxwidth = 130, + ellipsis_char = "...", + }), + }, + -- Enable rounded borders + window = { + completion = cmp.config.window.bordered(), + documentation = cmp.config.window.bordered(), + }, + }) + end, }