Improved NVIM overall

This commit is contained in:
AfonsoCMSousa
2025-12-17 18:43:36 +00:00
parent 5505642a8e
commit 3ccb1a8c66
3 changed files with 44 additions and 14 deletions
+37
View File
@@ -43,4 +43,41 @@ keymap.set("n", "<C-Down>", ":resize +2<CR>", { desc = "Resize Down" })
keymap.set("n", "<C-Left>", ":vertical resize -2<CR>", { desc = "Resize Left" })
keymap.set("n", "<C-Right>", ":vertical resize +2<CR>", { desc = "Resize Right" })
-- Copy to system clipboard
keymap.set('n', '<leader>y', '"+y')
keymap.set('v', '<leader>y', '"+y')
-- Snippet expansion (using LuaSnip)
-- Function to write a standard C template
local function write_c_template()
local lines = {
"#include <stdio.h>",
"#include <stdlib.h>",
"",
"int main(int argc, char *argv[]) {",
" printf(\"Hello World!\\n\");",
" return 0;",
"}",
}
vim.api.nvim_buf_set_lines(0, 0, -1, false, lines)
end
-- Function to write a standard C++ template
local function write_cpp_template()
local lines = {
"#include <iostream>",
"using namespace std;",
"",
"int main() {",
" cout << \"Hello World!\" << endl;",
" return 0;",
"}",
}
vim.api.nvim_buf_set_lines(0, 0, -1, false, lines)
end
-- Create the commands
vim.api.nvim_create_user_command("C", write_c_template, {})
vim.api.nvim_create_user_command("Cpp", write_cpp_template, {})
+1 -1
View File
@@ -28,7 +28,7 @@ opt.scrolloff = 8 -- Keep 8 lines above/below cursor
opt.colorcolumn = "160" -- Show a line at 160 chars
-- Clipboard
opt.clipboard = "unnamedplus" -- Use system clipboard
-- opt.clipboard = "unnamedplus" -- Use system clipboard
-- Split windows
opt.splitright = true -- Vertical split to the right