Improved NVIM overall
This commit is contained in:
@@ -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, {})
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user