This commit is contained in:
sam 2024-11-18 21:49:33 +13:00
parent a48044c38d
commit af0a29b20d
2 changed files with 92 additions and 5 deletions

25
clang/.clang-format Normal file
View file

@ -0,0 +1,25 @@
BasedOnStyle: WebKit
IndentWidth: 4
TabWidth: 4
UseTab: Never
AlignConsecutiveDeclarations: false
AlignConsecutiveAssignments: false
AlignTrailingComments: true
ColumnLimit: 105
BreakBeforeBraces: Attach
AllowShortIfStatementsOnASingleLine: false
AllowShortLoopsOnASingleLine: false
AllowShortFunctionsOnASingleLine: false
AllowShortLambdasOnASingleLine: false
PointerAlignment: Left
SpaceBeforeParens: Never
SpacesInParentheses: false
SpacesInConditionalStatement: false
SpacesInContainerLiterals: false
SpaceAfterCStyleCast: false
SpaceBeforeCpp11BracedList: false
SpaceBeforeSquareBrackets: false
SpacesBeforeTrailingComments: 2
PenaltyBreakAssignment: 1000
NamespaceIndentation: All

View file

@ -7,6 +7,9 @@ vim.opt.shiftwidth = 4
vim.opt.smarttab = true
vim.opt.autoindent = true
vim.opt.mouse = "a"
vim.opt.undofile = true
vim.opt.ignorecase = true
vim.opt.smartcase = true
vim.cmd("colorscheme habamax")
@ -24,7 +27,19 @@ local plugins = {
}
local servers = {
clangd = {}
clangd = { cmd = { "clangd", "-header-insertion=never" } },
gopls = {},
nim_langserver = {},
rust_analyzer = {},
cssls = {
cmd = { "vscode-css-language-server", "--stdio" }
},
html = {
cmd = { "vscode-html-language-server", "--stdio" }
},
jsonls = {
cmd = { "vscode-json-language-server", "--stdio" }
}
}
-- Install plugin manager
@ -37,12 +52,11 @@ if not vim.loop.fs_stat(mini_path) then
vim.cmd("packadd mini.nvim | helptags ALL")
end
require("mini.deps").setup({ path = { package = path_package } })
require("mini.sessions").setup({
autoread = true,
autowrite = true
})
-- mini.completion is missing snippet support so waiting for that, once added can get rid of cmp
-- require("mini.completion").setup()
-- <C-_> is Ctrl+/
local comment_keybind = "<C-_>"
@ -110,3 +124,51 @@ vim.keymap.set({ "i", "s" }, "<S-Tab>", function()
return "<S-Tab>"
end
end, { expr = true })
vim.keymap.set({ "n" }, "gd", function()
vim.lsp.buf.definition()
end)
vim.keymap.set({ "n" }, "<space>a", function()
vim.lsp.buf.code_action()
end)
vim.keymap.set({ "n" }, "<space>e", function()
vim.diagnostic.open_float()
end)
-- Session saving and restoring
local session_file = vim.fn.stdpath("data") .. "/sessions/" .. vim.fn.fnamemodify(vim.fn.getcwd(), ':t') .. "/session.vim"
vim.api.nvim_create_autocmd("VimLeavePre", {
pattern = "*",
callback = function()
vim.fn.mkdir(vim.fn.fnamemodify(session_file, ":h"), "p")
vim.cmd("mksession! " .. session_file)
vim.v.this_session = session_file
end,
})
vim.api.nvim_create_autocmd("VimEnter", {
nested = true,
once = true,
callback = function()
if vim.fn.filereadable(session_file) == 1 and #vim.fn.argv() == 0 then
vim.cmd("silent! %bwipeout!")
vim.cmd("silent! source " .. session_file)
vim.v.this_session = session_file
end
end
})
vim.api.nvim_create_autocmd("FileType", {
pattern = { "c", "lua", "md", "vim" },
callback = function()
vim.treesitter.start()
end
})
vim.api.nvim_create_autocmd("BufWritePre", {
callback = function()
vim.lsp.buf.format({ async = false })
end
})