Add more colorscheme and ability to switch

This commit is contained in:
2026-01-14 21:45:20 +01:00
parent 77050a542f
commit cf1e2e38ed
6 changed files with 82 additions and 28 deletions

View File

@ -1,4 +1,6 @@
{ {
"catppuccin": { "branch": "main", "commit": "beaf41a30c26fd7d6c386d383155cbd65dd554cd" },
"gruvbox.nvim": { "branch": "main", "commit": "a472496e1a4465a2dd574389dcf6cdb29af9bf1b" },
"lazy.nvim": { "branch": "main", "commit": "306a05526ada86a7b30af95c5cc81ffba93fef97" }, "lazy.nvim": { "branch": "main", "commit": "306a05526ada86a7b30af95c5cc81ffba93fef97" },
"nvim-treesitter": { "branch": "main", "commit": "5a7e5638e7d220575b1c22c8a2e099b52231886e" }, "nvim-treesitter": { "branch": "main", "commit": "5a7e5638e7d220575b1c22c8a2e099b52231886e" },
"plenary.nvim": { "branch": "master", "commit": "b9fd5226c2f76c951fc8ed5923d85e4de065e509" }, "plenary.nvim": { "branch": "master", "commit": "b9fd5226c2f76c951fc8ed5923d85e4de065e509" },

View File

@ -1,12 +1,19 @@
local keymap = vim.keymap
-- Save & quit -- Save & quit
vim.keymap.set("n", "<leader>w", ":w<CR>") keymap.set("n", "<leader>w", ":w<CR>")
vim.keymap.set("n", "<leader>q", ":q<CR>") keymap.set("n", "<leader>q", ":q<CR>")
-- Clear search highlight -- Clear search highlight
vim.keymap.set("n", "<leader>h", ":nohlsearch<CR>") keymap.set("n", "<leader>h", ":nohlsearch<CR>")
-- Better window navigation -- Better window navigation
vim.keymap.set("n", "<C-h>", "<C-w>h") keymap.set("n", "<C-h>", "<C-w>h")
vim.keymap.set("n", "<C-j>", "<C-w>j") keymap.set("n", "<C-j>", "<C-w>j")
vim.keymap.set("n", "<C-k>", "<C-w>k") keymap.set("n", "<C-k>", "<C-w>k")
vim.keymap.set("n", "<C-l>", "<C-w>l") keymap.set("n", "<C-l>", "<C-w>l")
-- Colorscheme
local utils = require("utils.colorscheme")
keymap.set("n", "<leader>cs", utils.pick, { desc = "Pick colorscheme" })

View File

@ -18,9 +18,9 @@ vim.opt.rtp:prepend(lazypath)
-- Initialize lazy.nvim -- Initialize lazy.nvim
local plugins = { local plugins = {
require("plugins.tokyonight"), -- theme require("plugins.colorschemes"), -- theme
require("plugins.treesitter"), -- syntax tree
require("plugins.telescope"), -- fuzzy finder require("plugins.telescope"), -- fuzzy finder
require("plugins.treesitter"), -- syntax tree
} }
require("lazy").setup(plugins) require("lazy").setup(plugins)

View File

@ -1,30 +1,32 @@
local opt = vim.opt
-- Line numbers -- Line numbers
vim.opt.number = true opt.number = true
vim.opt.relativenumber = true opt.relativenumber = true
-- Tabs & indentation -- Tabs & indentation
vim.opt.tabstop = 4 -- number of spaces a tab counts for opt.tabstop = 4 -- number of spaces a tab counts for
vim.opt.shiftwidth = 4 -- spaces for each indent opt.shiftwidth = 4 -- spaces for each indent
vim.opt.expandtab = true -- convert tabs to spaces opt.expandtab = true -- convert tabs to spaces
vim.opt.smartindent = true opt.smartindent = true
-- Searching -- Searching
vim.opt.ignorecase = true -- case-insensitive search... opt.ignorecase = true -- case-insensitive search...
vim.opt.smartcase = true -- ...unless you use capitals opt.smartcase = true -- ...unless you use capitals
vim.opt.hlsearch = true opt.hlsearch = true
vim.opt.incsearch = true opt.incsearch = true
-- UI / UX -- UI / UX
vim.opt.termguicolors = true opt.termguicolors = true
vim.opt.cursorline = true opt.cursorline = true
vim.opt.signcolumn = "yes" -- avoid text shifting opt.signcolumn = "yes" -- avoid text shifting
vim.opt.wrap = false -- no line wrapping opt.wrap = false -- no line wrapping
-- Behavior -- Behavior
vim.opt.scrolloff = 8 -- keep lines above/below cursor opt.scrolloff = 8 -- keep lines above/below cursor
vim.opt.sidescrolloff = 8 opt.sidescrolloff = 8
vim.opt.updatetime = 300 -- faster diagnostics opt.updatetime = 300 -- faster diagnostics
vim.opt.timeoutlen = 500 -- faster key sequences opt.timeoutlen = 500 -- faster key sequences
-- Clipboard (use system clipboard) -- Clipboard (use system clipboard)
vim.opt.clipboard = "unnamedplus" opt.clipboard = "unnamedplus"

View File

@ -0,0 +1,22 @@
return {
-- Tokyo Night
{
"folke/tokyonight.nvim",
lazy = true,
},
-- Catppuccin
{
"catppuccin/nvim",
name = "catppuccin",
lazy = false, -- loads immediately
priority = 1000, -- ensure it loads before other plugins
config = function()
vim.cmd.colorscheme("catppuccin")
end,
},
-- Gruvbox
{
"ellisonleao/gruvbox.nvim",
lazy = true,
},
}

21
lua/utils/colorscheme.lua Normal file
View File

@ -0,0 +1,21 @@
local M = {}
-- List of installed colorschemes
M.themes = { "tokyonight", "catppuccin", "gruvbox" }
-- Picker function
function M.pick()
vim.ui.select(M.themes, {
prompt = "Choose Colorscheme:",
}, function(choice)
if choice then
-- Load lazy plugin if needed
pcall(require, choice)
-- Apply the colorscheme
vim.cmd.colorscheme(choice)
end
end)
end
return M