From 1726018fae65e08ebfb2008769ccc9a8a8e30259 Mon Sep 17 00:00:00 2001 From: Abu Abacus Date: Wed, 1 Jan 2025 16:04:37 +0100 Subject: [PATCH] Font, icons, color-scheme and status-line --- ...nt, icons, color-schema and status-line.md | 105 ++++++++++++++++++ init.lua | 2 + lua/roka/core/plugins.lua | 29 +++++ lua/roka/plug/color.lua | 26 +++++ lua/roka/plug/lualine.lua | 33 ++++++ 5 files changed, 195 insertions(+) create mode 100644 doc/neovim/2 - Font, icons, color-schema and status-line.md create mode 100644 lua/roka/plug/color.lua create mode 100644 lua/roka/plug/lualine.lua diff --git a/doc/neovim/2 - Font, icons, color-schema and status-line.md b/doc/neovim/2 - Font, icons, color-schema and status-line.md new file mode 100644 index 0000000..e47b528 --- /dev/null +++ b/doc/neovim/2 - Font, icons, color-schema and status-line.md @@ -0,0 +1,105 @@ +## 2.1 - Font + +The font we use in neovim is one from the [nerd]() font collection. Those fonts contain special characters used as an icon in NeoVim. "SauceCodePro NF" is a derivation of the "SourceCodePro" font. + +`lua/roka/core/options.lua` +```lua +vim.opt.guifont = { "SauceCodePro NF:h11:#e-subpixelantialias:#h-none" } +``` + +## 2.2 - Icons + +The various icons can be used by many plugins, example _nvim-tree_ or _lualine_. + +`lua/roka/core/plugins.lua` +```lua +return require('packer').startup(function() + -- other plugins... + + use "kyazdani42/nvim-web-devicons" + + -- other plugins... +end) +``` + +## 2.3 - Color-scheme + +`lua/roka/core/plugins.lua` +```lua +return require('packer').startup(function() + -- other plugins... + + use { "bluz71/vim-nightfly-colors", as = "nighfly" } + use { "bluz71/vim-moonfly-colors", as = "moonfly" } + + -- other plugins... +end) +``` +`lua/roka/plug/color.lua` + +`init.lua` +```lua + -- other requires + + require( "roka.plug.color") + + -- other requires +``` + +## 2.4 - LuaLine + +`lua/roka/core/plugins.lua` +```lua +return require('packer').startup(function() + -- other plugins... + + use "nvim-lualine/lualine.nvim" + + -- other plugins... +end) +``` + +`lua/roka/plug/lualine.lua` +```lua +local status, lualine = pcall( require, "lualine") +if not status then + return +end + +local lualine_nightfly = require("lualine.themes.nightfly") + +local new_colors = { + blue = "#65D1FF", + green = "#3EFFDC", + violet = "#FF61EF", + yellow = "#FFDA7B", + black = "#000000", +} + +lualine_nightfly.normal.a.bg = new_colors.blue +lualine_nightfly.insert.a.bg = new_colors.green +lualine_nightfly.visual.a.bg = new_colors.violet + +lualine_nightfly.command = { + a = { + gui = "bold", + bg = new_colors.yellow, + fg = new_colors.black, + }, +} + +lualine.setup({ + options = { + theme = lualine_nightfly + } +}) +``` + +`init.lua` +```lua + -- other requires + + require( "roka.plug.lualine") + + -- other requires +``` diff --git a/init.lua b/init.lua index 27b40dd..ce2b511 100644 --- a/init.lua +++ b/init.lua @@ -3,3 +3,5 @@ require( "roka.core.options") require( "roka.core.keymaps") require( "roka.core.plugins") + +require( "roka.plug.color" ) \ No newline at end of file diff --git a/lua/roka/core/plugins.lua b/lua/roka/core/plugins.lua index 585210b..ce7a676 100644 --- a/lua/roka/core/plugins.lua +++ b/lua/roka/core/plugins.lua @@ -62,6 +62,35 @@ return packer.startup(function(use) use "wbthomason/packer.nvim" + use "lewis6991/impatient.nvim" + + -- ---------------------------------------------------- + -- web devicons used by e.g.: nvim-tree, lualine, ... + -- ---------------------------------------------------- + use "kyazdani42/nvim-web-devicons" + + -- ---------------------------------------------------- + -- colorschemas + -- ---------------------------------------------------- + use { "bluz71/vim-nightfly-colors", as = "nighfly" } + use { "bluz71/vim-moonfly-colors", as = "moonfly" } + + -- ---------------------------------------------------- + -- lualine (status line) + -- ---------------------------------------------------- + use { + "nvim-lualine/lualine.nvim", + + config = function() + require( "roka.plug.lualine") + end + } + + + + + + -- ------------------------------------------------------------------- -- Automatically set up your configuration after cloning packer.nvim. -- Put this at the end after all plugins. diff --git a/lua/roka/plug/color.lua b/lua/roka/plug/color.lua new file mode 100644 index 0000000..5732ce9 --- /dev/null +++ b/lua/roka/plug/color.lua @@ -0,0 +1,26 @@ +local colorscheme = "nightfly" + +local custom_highlight = + vim.api.nvim_create_augroup( "CustomHighlight", {}) + vim.api.nvim_create_autocmd( "ColorScheme", { + pattern = "nightfly", + callback = function() + vim.api.nvim_set_hl( 0, "String", { fg = "#00A000", italic = false }) + vim.api.nvim_set_hl( 0, "Comment", { fg = "#808080", italic = false }) + vim.api.nvim_set_hl( 0, "Function", { fg = "#82aaff", italic = false }) + vim.api.nvim_set_hl( 0, "CursorLineNr", { fg = "#82aaff", italic = false }) + vim.api.nvim_set_hl( 0, "Delimiter", { fg = "#ff0000", italic = false }) + end, + + group = custom_highlight, + }) + +local status, _ = pcall( vim.cmd, "colorscheme " .. colorscheme) + +if not status then + vim.notify( "Colorscheme " .. colorscheme .. " is not found!") + return +end + +vim.cmd [[ set cursorline]] +vim.cmd [[ highlight clear CursorLine]] diff --git a/lua/roka/plug/lualine.lua b/lua/roka/plug/lualine.lua new file mode 100644 index 0000000..c2fca1b --- /dev/null +++ b/lua/roka/plug/lualine.lua @@ -0,0 +1,33 @@ +local status, lualine = pcall( require, "lualine") +if not status then + return +end + +local lualine_nightfly = require("lualine.themes.nightfly") + +local new_colors = { + blue = "#65D1FF", + green = "#3EFFDC", + violet = "#FF61EF", + yellow = "#FFDA7B", + black = "#000000", +} + +lualine_nightfly.normal.a.bg = new_colors.blue +lualine_nightfly.insert.a.bg = new_colors.green +lualine_nightfly.visual.a.bg = new_colors.violet + +lualine_nightfly.command = { + a = { + gui = "bold", + bg = new_colors.yellow, + fg = new_colors.black, + }, +} + +lualine.setup({ + options = { + theme = lualine_nightfly + } +}) +