Adds window resizing keymaps and Monokai theme

Implements keymaps for window resizing and maximizing, providing more flexibility in window management.

Also, includes Monokai theme with classic palette as a user option.

Adds cpp to ensure_installed languages for treesitter.

Add C LSP in Mason Plugin

Added after folder to make sure comment string isn't altered by other plugins
pull/1658/head
David Ponte 3 months ago
parent 53a4625326
commit 5153613b3b

@ -0,0 +1,5 @@
local set = vim.opt_local
set.shiftwidth = 4
set.tabstop = 4
set.commentstring = '/* %s */'

@ -0,0 +1,19 @@
-- local set = vim.opt_local
-- 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 = {
'#include <stdio.h>',
'',
'int main ()',
'{',
' ',
' 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, {})

@ -51,12 +51,29 @@ vim.g.have_nerd_font = false
require 'options'
-- [[ Basic Keymaps ]]
-- See `:help vim.keymap.set()`
-- `:help vim.keymap.set()`
-- Clear highlights on search when pressing <Esc> in normal mode
-- See `:help hlsearch`
vim.keymap.set('n', '<Esc>', '<cmd>nohlsearch<CR>')
-- Resize window
-- Leader+<: Decrease window width
vim.keymap.set('n', '<leader><', '<cmd>vertical resize -5<CR>', { silent = true, desc = 'Decrease window width' })
-- Leader+>: Increase window width
vim.keymap.set('n', '<leader>>', '<cmd>vertical resize +5<CR>', { silent = true, desc = 'Increase window width' })
-- Alternative keys for larger adjustments
vim.keymap.set('n', '<leader>[', '<cmd>vertical resize -10<CR>', { silent = true, desc = 'Decrease window width more' })
vim.keymap.set('n', '<leader>]', '<cmd>vertical resize +10<CR>', { silent = true, desc = 'Increase window width more' })
-- Leader+=: Equal width for all windows
vim.keymap.set('n', '<leader>=', '<C-w>=', { silent = true, desc = 'Equal size all windows' })
-- Leader+|: Maximize current window width
vim.keymap.set('n', '<leader>|', '<C-w>|', { silent = true, desc = 'Maximize window width' })
-- Diagnostic keymaps
vim.keymap.set('n', '<leader>q', vim.diagnostic.setloclist, { desc = 'Open diagnostic [Q]uickfix list' })
@ -342,13 +359,6 @@ require('lazy').setup({
end, { desc = '[S]earch [N]eovim files' })
end,
},
-- {
-- 'nvim-tree/nvim-tree.lua',
-- dependencies = { 'nvim-tree/nvim-web-devicons' }, -- Optional, for file icons
-- config = function()
-- require('nvim-tree').setup {}
-- end,
-- },
-- LSP Plugins
{
@ -764,6 +774,13 @@ require('lazy').setup({
},
},
{
'tanvirtin/monokai.nvim',
config = function()
-- pcall(vim.cmd, [[colorscheme monokai]])
require('monokai').setup { palette = require('monokai').classic }
end,
},
{ -- You can easily change to a different colorscheme.
-- Change the name of the colorscheme plugin below, and then
-- change the command in the config to whatever the name of that colorscheme is.
@ -775,7 +792,7 @@ require('lazy').setup({
---@diagnostic disable-next-line: missing-fields
require('tokyonight').setup {
styles = {
comments = { italic = false }, -- Disable italics in comments
-- comments = { italic = false }, -- Disable italics in comments
},
}
@ -785,13 +802,6 @@ require('lazy').setup({
vim.cmd.colorscheme 'tokyonight-night'
end,
},
{
'tanvirtin/monokai.nvim',
config = function()
-- pcall(vim.cmd, [[colorscheme monokai]])
require('monokai').setup { palette = require('monokai').classic }
end,
},
-- Highlight todo, notes, etc in comments
{ 'folke/todo-comments.nvim', event = 'VimEnter', dependencies = { 'nvim-lua/plenary.nvim' }, opts = { signs = false } },
@ -842,6 +852,7 @@ require('lazy').setup({
ensure_installed = {
'bash',
'c',
'cpp',
'diff',
'html',
'lua',

Loading…
Cancel
Save