Improved NVIM overall
This commit is contained in:
parent
5505642a8e
commit
3ccb1a8c66
@ -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
|
||||
|
||||
@ -32,15 +32,6 @@ local servers = {
|
||||
lua_ls = { cmd = { "lua-language-server" } },
|
||||
ts_ls = { cmd = { "typescript-language-server", "--stdio" } },
|
||||
pyright = { cmd = { "pyright-langserver", "--stdio" } },
|
||||
clangd = {
|
||||
cmd = { "clangd" },
|
||||
on_attach = on_attach,
|
||||
capabilities = capabilities,
|
||||
init_options = {
|
||||
clangdFileStatus = true,
|
||||
fallbackFlags = { "-style={UseTab: ForIndentation}" },
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
for name, config in pairs(servers) do
|
||||
@ -51,8 +42,10 @@ for name, config in pairs(servers) do
|
||||
vim.lsp.start(vim.lsp.config[name])
|
||||
end
|
||||
|
||||
require('lspconfig').asm_lsp.setup{
|
||||
cmd = { "asm-lsp" },
|
||||
filetypes = { "asm", "nasm", "gas" },
|
||||
require('lspconfig').asm_lsp.setup {
|
||||
cmd = { "asm-lsp" },
|
||||
filetypes = { "asm", "nasm", "gas" },
|
||||
}
|
||||
require('lspconfig').clangd.setup {
|
||||
cmd = { "clangd", "--std=c++23" },
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user