Updated scripts

This commit is contained in:
Christoffer Martinsson 2025-05-15 10:54:48 +02:00
parent b40d6c8ea4
commit 284b8adee8
5 changed files with 54 additions and 319 deletions

2
bashrc
View File

@ -50,6 +50,8 @@ alias ls="eza -1 -l --icons=auto --git-repos --git -h -g -o --no-permissions"
alias lsa="eza -1 -l --icons=auto --git-repos --git -h -g -o --no-permissions -a" alias lsa="eza -1 -l --icons=auto --git-repos --git -h -g -o --no-permissions -a"
alias lss="eza -1 -l --icons=auto --git-repos --git -h -g --total-size -o --no-permissions -a" alias lss="eza -1 -l --icons=auto --git-repos --git -h -g --total-size -o --no-permissions -a"
eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"
if [[ ! $TERM =~ linux ]]; then if [[ ! $TERM =~ linux ]]; then
if [[ $TERM =~ tmux ]]; then if [[ $TERM =~ tmux ]]; then
source ~/.fzf.bash source ~/.fzf.bash

View File

@ -1,225 +0,0 @@
---
Language: Cpp
# BasedOnStyle: LLVM
AccessModifierOffset: -2
AlignAfterOpenBracket: Align
AlignArrayOfStructures: None
AlignConsecutiveAssignments:
Enabled: false
AcrossEmptyLines: false
AcrossComments: false
AlignCompound: false
PadOperators: true
AlignConsecutiveBitFields:
Enabled: false
AcrossEmptyLines: false
AcrossComments: false
AlignCompound: false
PadOperators: false
AlignConsecutiveDeclarations:
Enabled: false
AcrossEmptyLines: false
AcrossComments: false
AlignCompound: false
PadOperators: false
AlignConsecutiveMacros:
Enabled: false
AcrossEmptyLines: false
AcrossComments: false
AlignCompound: false
PadOperators: false
AlignEscapedNewlines: Right
AlignOperands: Align
AlignTrailingComments:
Kind: Always
OverEmptyLines: 0
AllowAllArgumentsOnNextLine: true
AllowAllParametersOfDeclarationOnNextLine: true
AllowShortBlocksOnASingleLine: Never
AllowShortCaseLabelsOnASingleLine: false
AllowShortEnumsOnASingleLine: true
AllowShortFunctionsOnASingleLine: All
AllowShortIfStatementsOnASingleLine: WithoutElse
AllowShortLambdasOnASingleLine: All
AllowShortLoopsOnASingleLine: false
AlwaysBreakAfterDefinitionReturnType: None
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: false
AlwaysBreakTemplateDeclarations: MultiLine
AttributeMacros:
- __capability
BinPackArguments: true
BinPackParameters: true
BitFieldColonSpacing: Both
BraceWrapping:
AfterCaseLabel: false
AfterClass: false
AfterControlStatement: Never
AfterEnum: false
AfterExternBlock: false
AfterFunction: false
AfterNamespace: false
AfterObjCDeclaration: false
AfterStruct: false
AfterUnion: false
BeforeCatch: false
BeforeElse: false
BeforeLambdaBody: false
BeforeWhile: false
IndentBraces: false
SplitEmptyFunction: true
SplitEmptyRecord: true
SplitEmptyNamespace: true
BreakAfterAttributes: Never
BreakAfterJavaFieldAnnotations: false
BreakArrays: true
BreakBeforeBinaryOperators: None
BreakBeforeConceptDeclarations: Always
BreakBeforeBraces: Attach
BreakBeforeInlineASMColon: OnlyMultiline
BreakBeforeTernaryOperators: true
BreakConstructorInitializers: BeforeColon
BreakInheritanceList: BeforeColon
BreakStringLiterals: true
ColumnLimit: 140
CommentPragmas: '^ IWYU pragma:'
CompactNamespaces: false
ConstructorInitializerIndentWidth: 4
ContinuationIndentWidth: 4
Cpp11BracedListStyle: true
DerivePointerAlignment: false
DisableFormat: false
EmptyLineAfterAccessModifier: Never
EmptyLineBeforeAccessModifier: LogicalBlock
ExperimentalAutoDetectBinPacking: false
FixNamespaceComments: true
ForEachMacros:
- foreach
- Q_FOREACH
- BOOST_FOREACH
IfMacros:
- KJ_IF_MAYBE
IncludeBlocks: Preserve
IncludeCategories:
- Regex: '^"(llvm|llvm-c|clang|clang-c)/'
Priority: 2
SortPriority: 0
CaseSensitive: false
- Regex: '^(<|"(gtest|gmock|isl|json)/)'
Priority: 3
SortPriority: 0
CaseSensitive: false
- Regex: '.*'
Priority: 1
SortPriority: 0
CaseSensitive: false
IncludeIsMainRegex: '(Test)?$'
IncludeIsMainSourceRegex: ''
IndentAccessModifiers: false
IndentCaseBlocks: false
IndentCaseLabels: false
IndentExternBlock: AfterExternBlock
IndentGotoLabels: true
IndentPPDirectives: None
IndentRequiresClause: true
IndentWidth: 4
IndentWrappedFunctionNames: false
InsertBraces: false
InsertNewlineAtEOF: false
InsertTrailingCommas: None
IntegerLiteralSeparator:
Binary: 0
BinaryMinDigits: 0
Decimal: 0
DecimalMinDigits: 0
Hex: 0
HexMinDigits: 0
JavaScriptQuotes: Leave
JavaScriptWrapImports: true
KeepEmptyLinesAtTheStartOfBlocks: true
LambdaBodyIndentation: Signature
LineEnding: DeriveLF
MacroBlockBegin: ''
MacroBlockEnd: ''
MaxEmptyLinesToKeep: 1
NamespaceIndentation: None
ObjCBinPackProtocolList: Auto
ObjCBlockIndentWidth: 2
ObjCBreakBeforeNestedBlockParam: true
ObjCSpaceAfterProperty: false
ObjCSpaceBeforeProtocolList: true
PackConstructorInitializers: BinPack
PenaltyBreakAssignment: 2
PenaltyBreakBeforeFirstCallParameter: 19
PenaltyBreakComment: 300
PenaltyBreakFirstLessLess: 120
PenaltyBreakOpenParenthesis: 0
PenaltyBreakString: 1000
PenaltyBreakTemplateDeclaration: 10
PenaltyExcessCharacter: 1000000
PenaltyIndentedWhitespace: 0
PenaltyReturnTypeOnItsOwnLine: 60
PointerAlignment: Right
PPIndentWidth: -1
QualifierAlignment: Leave
ReferenceAlignment: Pointer
ReflowComments: true
RemoveBracesLLVM: false
RemoveSemicolon: false
RequiresClausePosition: OwnLine
RequiresExpressionIndentation: OuterScope
SeparateDefinitionBlocks: Leave
ShortNamespaceLines: 1
SortIncludes: CaseSensitive
SortJavaStaticImport: Before
SortUsingDeclarations: LexicographicNumeric
SpaceAfterCStyleCast: false
SpaceAfterLogicalNot: false
SpaceAfterTemplateKeyword: true
SpaceAroundPointerQualifiers: Default
SpaceBeforeAssignmentOperators: true
SpaceBeforeCaseColon: false
SpaceBeforeCpp11BracedList: false
SpaceBeforeCtorInitializerColon: true
SpaceBeforeInheritanceColon: true
SpaceBeforeParens: ControlStatements
SpaceBeforeParensOptions:
AfterControlStatements: true
AfterForeachMacros: true
AfterFunctionDefinitionName: false
AfterFunctionDeclarationName: false
AfterIfMacros: true
AfterOverloadedOperator: false
AfterRequiresInClause: false
AfterRequiresInExpression: false
BeforeNonEmptyParentheses: false
SpaceBeforeRangeBasedForLoopColon: true
SpaceBeforeSquareBrackets: false
SpaceInEmptyBlock: false
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 1
SpacesInAngles: Never
SpacesInConditionalStatement: false
SpacesInContainerLiterals: true
SpacesInCStyleCastParentheses: false
SpacesInLineCommentPrefix:
Minimum: 1
Maximum: -1
SpacesInParentheses: false
SpacesInSquareBrackets: false
Standard: Latest
StatementAttributeLikeMacros:
- Q_EMIT
StatementMacros:
- Q_UNUSED
- QT_REQUIRE_VERSION
TabWidth: 8
UseTab: Never
WhitespaceSensitiveMacros:
- BOOST_PP_STRINGIZE
- CF_SWIFT_NAME
- NS_SWIFT_NAME
- PP_STRINGIZE
- STRINGIZE
...

View File

@ -1,85 +1,45 @@
-------------------------------------------------------------------
-- Settings
-------------------------------------------------------------------
vim.g.mapleader = " " vim.g.mapleader = " "
vim.g.maplocalleader = " " vim.g.maplocalleader = " "
-- vim.g.loaded_netrw = 1
-- vim.g.loaded_netrwPlugin = 1
-- Set to true if you have a Nerd Font installed and selected in the terminal
vim.g.have_nerd_font = true
-- Set highlight on search
vim.o.hlsearch = false vim.o.hlsearch = false
-- Make line numbers default
vim.wo.number = true vim.wo.number = true
-- Enable mouse mode
vim.o.mouse = "a" vim.o.mouse = "a"
-- Enable break indent
vim.o.breakindent = true vim.o.breakindent = true
-- Save undo history
vim.o.undofile = true vim.o.undofile = true
-- Case insensitive searching UNLESS /C or capital in search
vim.o.ignorecase = true vim.o.ignorecase = true
vim.o.smartcase = true vim.o.smartcase = true
-- Keep signcolumn on by default
vim.wo.signcolumn = "yes" vim.wo.signcolumn = "yes"
-- Set completeopt to have a better completion experience
-- vim.o.completeopt = "menuone,noselect,noinsert"
-- Use terminal colors
vim.o.termguicolors = true vim.o.termguicolors = true
-- Tabs
vim.o.shiftwidth = 4 vim.o.shiftwidth = 4
vim.o.smarttab = true vim.o.smarttab = true
vim.o.tabstop = 4 vim.o.tabstop = 4
vim.o.expandtab = true vim.o.expandtab = true
vim.o.softtabstop = 4 vim.o.softtabstop = 4
-- Preview substitutions live, as you type!
vim.o.inccommand = "split" vim.o.inccommand = "split"
-- Show cursor line
vim.o.cursorline = true vim.o.cursorline = true
vim.o.showmatch = true vim.o.showmatch = true
-- Decrease update time
vim.o.updatetime = 250 vim.o.updatetime = 250
-- Decrease mapped sequence wait time
vim.o.timeoutlen = 300 vim.o.timeoutlen = 300
vim.o.pumheight = 10 vim.o.pumheight = 10
vim.o.relativenumber = true vim.o.relativenumber = true
vim.o.scrolloff = 8 vim.o.scrolloff = 8
-- Don't show the mode, since it's already in the status line
vim.o.showmode = false vim.o.showmode = false
vim.o.showtabline = 0 vim.o.showtabline = 0
vim.o.wrap = true vim.o.wrap = true
vim.o.foldmethod = "expr" vim.o.foldmethod = "expr"
vim.o.foldexpr = "nvim_treesitter#foldexpr()" vim.o.foldexpr = "nvim_treesitter#foldexpr()"
vim.o.foldlevelstart = 99 vim.o.foldlevelstart = 99
vim.o.autoread = true
vim.schedule(function() vim.schedule(function()
vim.o.clipboard = "unnamedplus" vim.o.clipboard = "unnamedplus"
end) end)
vim.o.autoread = true
------------------------------------------------------------------- -------------------------------------------------------------------
-- Autocommands -- Autocommands
------------------------------------------------------------------- -------------------------------------------------------------------
-- Autoset current working directory based on closest git repo -- Autoset current working directory based on closest git repo
vim.api.nvim_create_autocmd("BufEnter", { vim.api.nvim_create_autocmd("BufEnter", {
callback = function() callback = function()
@ -90,7 +50,6 @@ vim.api.nvim_create_autocmd("BufEnter", {
end end
end, end,
}) })
-- show cursor line only in active window -- show cursor line only in active window
local cursorLineGrp = vim.api.nvim_create_augroup("CursorLine", { clear = true }) local cursorLineGrp = vim.api.nvim_create_augroup("CursorLine", { clear = true })
vim.api.nvim_create_autocmd( vim.api.nvim_create_autocmd(
@ -109,7 +68,6 @@ vim.api.nvim_create_autocmd(
{ "InsertEnter", "FocusLost" }, { "InsertEnter", "FocusLost" },
{ pattern = "*", command = "set nocursorline", group = cursorLineGrp } { pattern = "*", command = "set nocursorline", group = cursorLineGrp }
) )
-- Auto update on file changes -- Auto update on file changes
vim.api.nvim_create_autocmd({ "BufEnter", "CursorHold", "CursorHoldI", "FocusGained" }, { vim.api.nvim_create_autocmd({ "BufEnter", "CursorHold", "CursorHoldI", "FocusGained" }, {
command = "if mode() != 'c' | checktime | endif", command = "if mode() != 'c' | checktime | endif",
@ -177,48 +135,22 @@ require("lazy").setup({
vim.api.nvim_create_autocmd("LspAttach", { vim.api.nvim_create_autocmd("LspAttach", {
group = vim.api.nvim_create_augroup("kickstart-lsp-attach", { clear = true }), group = vim.api.nvim_create_augroup("kickstart-lsp-attach", { clear = true }),
callback = function(event) callback = function(event)
-- In this case, we create a function that lets us more easily define mappings specific
-- for LSP related items. It sets the mode, buffer and description for us each time.
local map = function(keys, func, desc, mode) local map = function(keys, func, desc, mode)
mode = mode or "n" mode = mode or "n"
vim.keymap.set(mode, keys, func, { buffer = event.buf, desc = "LSP: " .. desc }) vim.keymap.set(mode, keys, func, { buffer = event.buf, desc = "LSP: " .. desc })
end end
-- Rename the variable under your cursor.
-- Most Language Servers support renaming across files, etc.
map("grn", vim.lsp.buf.rename, "[R]e[n]ame") map("grn", vim.lsp.buf.rename, "[R]e[n]ame")
-- Execute a code action, usually your cursor needs to be on top of an error
-- or a suggestion from your LSP for this to activate.
map("gra", vim.lsp.buf.code_action, "[G]oto Code [A]ction", { "n", "x" }) map("gra", vim.lsp.buf.code_action, "[G]oto Code [A]ction", { "n", "x" })
-- Find references for the word under your cursor.
map("grr", require("fzf-lua").lsp_references, "[G]oto [R]eferences") map("grr", require("fzf-lua").lsp_references, "[G]oto [R]eferences")
-- Jump to the implementation of the word under your cursor.
-- Useful when your language has ways of declaring types without an actual implementation.
map("gri", require("fzf-lua").lsp_implementations, "[G]oto [I]mplementation") map("gri", require("fzf-lua").lsp_implementations, "[G]oto [I]mplementation")
-- Jump to the definition of the word under your cursor.
-- This is where a variable was first declared, or where a function is defined, etc.
-- To jump back, press <C-t>.
map("grd", require("fzf-lua").lsp_definitions, "[G]oto [D]efinition") map("grd", require("fzf-lua").lsp_definitions, "[G]oto [D]efinition")
-- WARN: This is not Goto Definition, this is Goto Declaration. -- WARN: This is not Goto Definition, this is Goto Declaration.
-- For example, in C this would take you to the header. -- For example, in C this would take you to the header.
map("grD", vim.lsp.buf.declaration, "[G]oto [D]eclaration") map("grD", vim.lsp.buf.declaration, "[G]oto [D]eclaration")
-- Fuzzy find all the symbols in your current document.
-- Symbols are things like variables, functions, types, etc.
map("gO", require("fzf-lua").lsp_document_symbols, "Open Document Symbols") map("gO", require("fzf-lua").lsp_document_symbols, "Open Document Symbols")
-- Fuzzy find all the symbols in your current workspace.
-- Similar to document symbols, except searches over your entire project.
map("gW", require("fzf-lua").lsp_live_workspace_symbols, "Open Workspace Symbols") map("gW", require("fzf-lua").lsp_live_workspace_symbols, "Open Workspace Symbols")
-- Jump to the type of the word under your cursor.
-- Useful when you're not sure what type a variable is and you want to see
-- the definition of its *type*, not where it was *defined*.
map("grt", require("fzf-lua").lsp_typedefs, "[G]oto [T]ype Definition") map("grt", require("fzf-lua").lsp_typedefs, "[G]oto [T]ype Definition")
-- This function resolves a difference between neovim nightly (version 0.11) and stable (version 0.10) -- This function resolves a difference between neovim nightly (version 0.11) and stable (version 0.10)
@ -349,15 +281,29 @@ require("lazy").setup({
opts = { opts = {
formatters_by_ft = { formatters_by_ft = {
lua = { "stylua" }, lua = { "stylua" },
-- Conform will run multiple formatters sequentially python = { "isort", "black", timeout_ms = 3000 },
python = { "black" },
-- You can customize some of the format options for the filetype (:help conform.format)
rust = { "rustfmt", lsp_format = "fallback" }, rust = { "rustfmt", lsp_format = "fallback" },
-- Conform will run the first available formatter c = { "clang_format" },
javascript = { "prettier", stop_after_first = true }, cpp = { "clang_format" },
javascript = { "prettier" },
typescript = { "prettier" },
javascriptreact = { "prettier" },
typescriptreact = { "prettier" },
css = { "prettier" },
html = { "prettier" },
json = { "prettier" },
yaml = { "prettier" },
markdown = { "prettier" },
},
formatters = {
clang_format = {
prepend_args = { "--style={BasedOnStyle: LLVM, IndentWidth: 4, TabWidth: 4, UseTab: Never}" },
},
shfmt = {
prepend_args = { "-i", "4" },
},
}, },
format_on_save = { format_on_save = {
-- These options will be passed to conform.format()
timeout_ms = 500, timeout_ms = 500,
lsp_format = "fallback", lsp_format = "fallback",
}, },
@ -374,9 +320,6 @@ require("lazy").setup({
"L3MON4D3/LuaSnip", "L3MON4D3/LuaSnip",
version = "2.*", version = "2.*",
build = (function() build = (function()
-- Build Step is needed for regex support in snippets.
-- This step is not supported in many windows environments.
-- Remove the below condition to re-enable on windows.
if vim.fn.has("win32") == 1 or vim.fn.executable("make") == 0 then if vim.fn.has("win32") == 1 or vim.fn.executable("make") == 0 then
return return
end end
@ -399,8 +342,6 @@ require("lazy").setup({
}, },
completion = { completion = {
-- By default, you may press `<c-space>` to show the documentation.
-- Optionally, set `auto_show = true` to show the documentation after a delay.
documentation = { auto_show = false, auto_show_delay_ms = 500 }, documentation = { auto_show = false, auto_show_delay_ms = 500 },
}, },
@ -412,10 +353,7 @@ require("lazy").setup({
}, },
snippets = { preset = "luasnip" }, snippets = { preset = "luasnip" },
fuzzy = { implementation = "prefer_rust_with_warning" }, fuzzy = { implementation = "prefer_rust_with_warning" },
-- Shows a signature help window while you type arguments for a function
signature = { enabled = true }, signature = { enabled = true },
}, },
}, },
@ -443,9 +381,6 @@ require("lazy").setup({
auto_install = true, auto_install = true,
highlight = { highlight = {
enable = true, enable = true,
-- Some languages depend on vim's regex highlighting system (such as Ruby) for indent rules.
-- If you are experiencing weird indenting issues, add the language to
-- the list of additional_vim_regex_highlighting and disabled languages for indent.
additional_vim_regex_highlighting = { "ruby" }, additional_vim_regex_highlighting = { "ruby" },
}, },
indent = { enable = true, disable = { "ruby" } }, indent = { enable = true, disable = { "ruby" } },

View File

@ -252,7 +252,6 @@ if [ "${ROLES[TERMINAL]}" == "yes" ]; then
mkdir -p ~/.local/bin mkdir -p ~/.local/bin
ln -sf ~/linuxbox/tmux.conf ~/.tmux.conf ln -sf ~/linuxbox/tmux.conf ~/.tmux.conf
ln -sf ~/linuxbox/clang-format ~/.clang-format
ln -sf ~/linuxbox/luacheckrc ~/.luacheckrc ln -sf ~/linuxbox/luacheckrc ~/.luacheckrc
ln -sf ~/linuxbox/config/starship.toml ~/.config/starship.toml ln -sf ~/linuxbox/config/starship.toml ~/.config/starship.toml
ln -sf ~/linuxbox/config/nvim/init.lua ~/.config/nvim/init.lua ln -sf ~/linuxbox/config/nvim/init.lua ~/.config/nvim/init.lua

View File

@ -1,5 +1,6 @@
#!/bin/bash #!/bin/bash
set -e set -e
sudo -v
if [ -f /etc/os-release ]; then if [ -f /etc/os-release ]; then
. /etc/os-release . /etc/os-release
@ -73,6 +74,21 @@ fi
printf -- '\033[33m Installing system packages\n\033[37m' printf -- '\033[33m Installing system packages\n\033[37m'
sudo apt install -y gawk imagemagick gpg ninja-build gettext cmake unzip curl build-essential libssl-dev libffi-dev file tmux libudev-dev pkg-config locales btop ncdu ranger sudo apt install -y gawk imagemagick gpg ninja-build gettext cmake unzip curl build-essential libssl-dev libffi-dev file tmux libudev-dev pkg-config locales btop ncdu ranger
# Install brew
printf -- '\033[33m Installing Homebrew\n\033[37m'
sudo apt-get install -y -qq build-essential curl file git
export NONINTERACTIVE=1
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
BREW_PREFIX="/home/linuxbrew/.linuxbrew"
if [ -d "$BREW_PREFIX" ]; then
eval "$("$BREW_PREFIX"/bin/brew shellenv)"
else
echo "[!] Homebrew install failed or brew not found at expected location."
exit 1
fi
brew --version >/dev/null && echo "[✓] Homebrew installed successfully."
# Setup locals # Setup locals
printf -- '\033[33m Setup locals\n\033[37m' printf -- '\033[33m Setup locals\n\033[37m'
sudo locale-gen "en_US.UTF-8" sudo locale-gen "en_US.UTF-8"
@ -271,6 +287,18 @@ cargo install zoxide --locked
printf -- '\033[33m Installing starship\n\033[37m' printf -- '\033[33m Installing starship\n\033[37m'
cargo install starship --locked cargo install starship --locked
# Install LSP servers
printf -- '\033[33m Installing LSP servers\n\033[37m'
rustup component add rust-analyzer clippy rustfmt
sudo npm i -g bash-language-server pyright
sudo npm install --save-dev prettier
sudo apt install -y shfmt clangd clang-format
pipx install black
pipx install isort
pipx install mdformat
brew install lua-language-server marksman
cargo install stylua
# *** Desktop applications *** # *** Desktop applications ***
if [ "$WSL" == "no" ]; then if [ "$WSL" == "no" ]; then
printf -- '\033[32m *** Desktop applications ***\n\033[37m' printf -- '\033[32m *** Desktop applications ***\n\033[37m'
@ -378,10 +406,6 @@ fi
printf -- '\033[33m Symlinking tmux config\n\033[37m' printf -- '\033[33m Symlinking tmux config\n\033[37m'
ln -sf ~/linuxbox/tmux.conf ~/.tmux.conf ln -sf ~/linuxbox/tmux.conf ~/.tmux.conf
# Symlink clang-format config
printf -- '\033[33m Symlinking clang-format config\n\033[37m'
ln -sf ~/linuxbox/clang-format ~/.clang-format
# Symlink lazygit config # Symlink lazygit config
printf -- '\033[33m Symlinking lazygit config\n\033[37m' printf -- '\033[33m Symlinking lazygit config\n\033[37m'
mkdir -p ~/.config/lazygit mkdir -p ~/.config/lazygit