From 10ccea08ec78cd5e0595bb3bf99cc9588ab8f055 Mon Sep 17 00:00:00 2001 From: David Ponte Date: Sun, 4 May 2025 19:12:56 +0200 Subject: [PATCH] fix: correct command name casing and adjust indentation in C template feat: add Monokai Pro and Monokai Nightasty theme configurations --- ftplugin/c.lua | 15 +++++-- init.lua | 108 ++++++++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 117 insertions(+), 6 deletions(-) diff --git a/ftplugin/c.lua b/ftplugin/c.lua index 7894aabe..9fdf210e 100644 --- a/ftplugin/c.lua +++ b/ftplugin/c.lua @@ -1,6 +1,6 @@ -- local set = vim.opt_local --- Define a custom command ':intmain' that inserts int main() {} template +-- Define a custom command ':IntMain' that inserts int main() {} template vim.api.nvim_create_user_command('IntMain', function() local current_line = vim.api.nvim_win_get_cursor(0)[1] local lines = { @@ -8,12 +8,19 @@ vim.api.nvim_create_user_command('IntMain', function() '', 'int main ()', '{', - ' ', - ' printf();', - ' return 0;', + ' ', + ' printf();', + ' return 0;', '}', } vim.api.nvim_buf_set_lines(0, current_line - 1, current_line - 1, false, lines) -- Position cursor inside the function body vim.api.nvim_win_set_cursor(0, { current_line + 1, 4 }) end, {}) + +vim.api.nvim_create_user_command('Libft', function() + local current_line = vim.api.nvim_win_get_cursor(0)[1] + vim.api.nvim_buf_set_lines(0, current_line - 1, current_line - 1, false, { + '#include "libft.h"', + }) +end, {}) diff --git a/init.lua b/init.lua index 84493aa7..5b89c746 100644 --- a/init.lua +++ b/init.lua @@ -742,7 +742,8 @@ require('lazy').setup({ appearance = { -- 'mono' (default) for 'Nerd Font Mono' or 'normal' for 'Nerd Font' -- Adjusts spacing to ensure icons are aligned - nerd_font_variant = 'mono', + -- nerd_font_variant = 'mono', + nerd_font_variant = 'normal', }, completion = { @@ -773,7 +774,109 @@ require('lazy').setup({ signature = { enabled = true }, }, }, + { + 'loctvl842/monokai-pro.nvim', + opts = { + transparent_background = true, + terminal_colors = true, + devicons = true, -- highlight the icons of `nvim-web-devicons` + styles = { + comment = { italic = true }, + keyword = { italic = true }, -- any other keyword + type = { italic = true }, -- (preferred) int, long, char, etc + storageclass = { italic = true }, -- static, register, volatile, etc + structure = { italic = true }, -- struct, union, enum, etc + parameter = { italic = true }, -- parameter pass in function + annotation = { italic = true }, + tag_attribute = { italic = true }, -- attribute of tag in reactjs + }, + filter = 'pro', -- classic | octagon | pro | machine | ristretto | spectrum + -- Enable this will disable filter option + day_night = { + enable = false, -- turn off by default + day_filter = 'pro', -- classic | octagon | pro | machine | ristretto | spectrum + night_filter = 'spectrum', -- classic | octagon | pro | machine | ristretto | spectrum + }, + inc_search = 'background', -- underline | background + background_clear = { + -- -- "float_win", + -- "toggleterm", + 'telescope', + -- "which-key", + 'renamer', + 'notify', + 'nvim-tree', + 'neo-tree', + 'bufferline', -- better used if background of `neo-tree` or `nvim-tree` is cleared + }, -- "float_win", "toggleterm", "telescope", "which-key", "renamer", "neo-tree", "nvim-tree", "bufferline" + plugins = { + bufferline = { + underline_selected = false, + underline_visible = false, + }, + indent_blankline = { + context_highlight = 'default', -- default | pro + context_start_underline = false, + }, + }, + ---@param cs Colorscheme + ---@param p ColorschemeOptions + ---@param Config MonokaiProOptions + ---@param hp Helper + override = function(cs, p, Config, hp) end, + }, + config = function(_, opts) + require('monokai-pro').setup(opts) + vim.cmd 'colorscheme monokai-pro' + end, + }, + { + + 'polirritmico/monokai-nightasty.nvim', + lazy = false, + priority = 1000, + keys = { + { 'tt', 'MonokaiToggleLight', desc = 'Monokai-Nightasty: Toggle dark/light theme.' }, + }, + ---@module "monokai-nightasty" + ---@type monokai.UserConfig + opts = { + dark_style_background = 'transparent', -- default | dark | transparent | #RRGGBB + light_style_background = 'transparent', -- default | dark | transparent | #RRGGBB + markdown_header_marks = true, + hl_styles = { + keywords = { italic = true }, + comments = { italic = true }, + floats = 'dark', + }, + terminal_colors = function(colors) + return { fg = colors.fg_dark } + end, + on_colors = function(colors) + if vim.o.background == 'light' then + -- Custom colors for light theme + colors.comment = '#2d7e79' + colors.lualine.normal_bg = '#7ebd00' + else + -- Custom colors for dark theme + colors.border = colors.magenta + colors.lualine.normal_bg = colors.green + end + end, + on_highlights = function(highlights, colors) + -- You could add styles like bold, underline, italic + highlights.TelescopeSelection = { bold = true } + highlights.TelescopeBorder = { fg = colors.grey } + highlights['@lsp.type.property.lua'] = { fg = colors.fg } + end, + }, + config = function(_, opts) + vim.opt.cursorline = true -- Highlight line at the cursor position + vim.o.background = 'dark' -- Default to dark theme + require('monokai-nightasty').load(opts) + end, + }, { 'tanvirtin/monokai.nvim', config = function() @@ -791,8 +894,9 @@ require('lazy').setup({ config = function() ---@diagnostic disable-next-line: missing-fields require('tokyonight').setup { + transparent = true, styles = { - -- comments = { italic = false }, -- Disable italics in comments + comments = { italic = true }, -- Disable italics in comments }, }