From b721d8c3cb1bb865c2c09ffa9c70364f9ac02bcd Mon Sep 17 00:00:00 2001 From: Aydin Mercan Date: Sat, 30 Sep 2023 10:25:00 +0300 Subject: [PATCH] initial migration --- .bashrc | 31 +++ .clang-format | 127 +++++++++++ .config/environment.d/10-xdg.conf | 4 + .config/environment.d/11-system.conf | 3 + .config/environment.d/20-toolset.conf | 32 +++ .config/environment.d/21-lang.conf | 37 +++ .config/environment.d/30-layout.conf | 1 + .config/environment.d/99-path.conf | 1 + .config/gdb/gdbearlyinit | 1 + .config/gdb/gdbinit | 8 + .config/git/config | 46 ++++ .config/nvim/filetype.lua | 15 ++ .config/nvim/init.lua | 3 + .config/nvim/lua/intangible/keymap.lua | 31 +++ .config/nvim/lua/intangible/options.lua | 60 +++++ .config/nvim/lua/intangible/packages.lua | 275 +++++++++++++++++++++++ .config/sway/config | 198 ++++++++++++++++ .config/user-dirs.dirs | 15 ++ .config/waybar/config | 70 ++++++ .editorconfig | 65 ++++++ .local/bin/dotctl | 44 ++++ .local/share/cargo/config.toml | 14 ++ .profile | 14 ++ 23 files changed, 1095 insertions(+) create mode 100644 .bashrc create mode 100644 .clang-format create mode 100644 .config/environment.d/10-xdg.conf create mode 100644 .config/environment.d/11-system.conf create mode 100644 .config/environment.d/20-toolset.conf create mode 100644 .config/environment.d/21-lang.conf create mode 100644 .config/environment.d/30-layout.conf create mode 100644 .config/environment.d/99-path.conf create mode 100644 .config/gdb/gdbearlyinit create mode 100644 .config/gdb/gdbinit create mode 100644 .config/git/config create mode 100644 .config/nvim/filetype.lua create mode 100644 .config/nvim/init.lua create mode 100644 .config/nvim/lua/intangible/keymap.lua create mode 100644 .config/nvim/lua/intangible/options.lua create mode 100644 .config/nvim/lua/intangible/packages.lua create mode 100644 .config/sway/config create mode 100644 .config/user-dirs.dirs create mode 100644 .config/waybar/config create mode 100644 .editorconfig create mode 100755 .local/bin/dotctl create mode 100644 .local/share/cargo/config.toml create mode 100644 .profile diff --git a/.bashrc b/.bashrc new file mode 100644 index 0000000..af1c053 --- /dev/null +++ b/.bashrc @@ -0,0 +1,31 @@ +# ~/.bashrc + +# If not running interactively, don't do anything +[[ $- != *i* ]] && return + +[ -r "$CARGO_HOME/env" ] && . "$CARGO_HOME/env" +[ -r /usr/share/bash-completion/bash_completion ] && . /usr/share/bash-completion/bash_completion +[ -r /usr/share/clang/bash-autocomplete.sh ] && . /usr/share/clang/bash-autocomplete.sh + +set -o vi +stty -ixon + +shopt -s autocd +shopt -s globstar +shopt -s checkwinsize + +alias x509inspect='openssl x509 -text -noout -in' + +qinfo() { + curl https://cht.sh/$1 +} + +weather() { + curl wttr.in/$1 +} + +__git_ps1='git rev-parse --abbrev-ref HEAD 2>/dev/null||printf ""' + +export PS1="\[\033[38;5;98m\]\h\[$(tput sgr0)\]\[\033[38;5;15m\]@\[$(tput sgr0)\]\[\033[38;5;206m\]\u\[$(tput sgr0)\]\[\033[38;5;15m\] \[$(tput sgr0)\]\[\033[38;5;228m\]\A\[$(tput sgr0)\]\[\033[38;5;15m\] [\[$(tput sgr0)\]\[\033[38;5;156m\]\W\[$(tput sgr0)\] \$(${__git_ps1})\[\033[38;5;15m\]]\n\[$(tput sgr0)\]\[\033[38;5;195m\]\\$\[$(tput sgr0)\]\[\033[38;5;15m\] \[$(tput sgr0)\]" + +eval "$(direnv hook bash)" diff --git a/.clang-format b/.clang-format new file mode 100644 index 0000000..80e05d0 --- /dev/null +++ b/.clang-format @@ -0,0 +1,127 @@ + +--- +BasedOnStyle: LLVM +ColumnLimit: 120 +--- +Language: Cpp + +AccessModifierOffset: -8 +AlignAfterOpenBracket: Align +AlignConsecutiveAssignments: true +AlignConsecutiveDeclarations: false +AlignConsecutiveMacros: true +AlignEscapedNewlines: Left +AlignOperands: false +AlignTrailingComments: false +AllowAllArgumentsOnNextLine: false +AllowAllParametersOfDeclarationOnNextLine: false +AllowShortBlocksOnASingleLine: Never +AllowShortCaseLabelsOnASingleLine: false +AllowShortFunctionsOnASingleLine: Inline +AllowShortIfStatementsOnASingleLine: false +AllowShortLoopsOnASingleLine: true +AlwaysBreakAfterReturnType: None +AlwaysBreakBeforeMultilineStrings: false +AlwaysBreakTemplateDeclarations: true +BinPackArguments: false +BinPackParameters: false +BreakBeforeBinaryOperators: All +BreakBeforeBraces: Custom +#BreakAfterAttributes: Leave +BraceWrapping: + AfterCaseLabel: false + AfterClass: true + AfterEnum: false + AfterStruct: false + AfterFunction: true + AfterNamespace: false + AfterUnion: false + AfterExternBlock: false + BeforeCatch: false + BeforeElse: false + BeforeLambdaBody: false + BeforeWhile: false + IndentBraces: false + SplitEmptyFunction: true + SplitEmptyRecord: false + SplitEmptyNamespace: false +BreakBeforeInheritanceComma: false +BreakBeforeTernaryOperators: true +BreakConstructorInitializers: AfterColon +BreakConstructorInitializersBeforeComma: false +BreakStringLiterals: true +CompactNamespaces: true +ConstructorInitializerAllOnOneLineOrOnePerLine: false +ConstructorInitializerIndentWidth: 4 +ContinuationIndentWidth: 4 +Cpp11BracedListStyle: true +DerivePointerAlignment: false +FixNamespaceComments: true +IndentWidth: 8 +TabWidth: 8 +UseTab: AlignWithSpaces +ForEachMacros: + - foreach + - Q_FOREACH + - BOOST_FOREACH + - io_uring_for_each_cqe +IncludeBlocks: Regroup +IncludeCategories: + - Regex: '^"(llvm|llvm-c|clang|clang-c)/' + Priority: 2 + - Regex: '^(<|"(gtest|gmock|isl|json)/)' + Priority: 1 + - Regex: '.*' + Priority: 3 +IncludeIsMainRegex: '(Test)?$' +IndentCaseLabels: false +IndentGotoLabels: false +IndentPPDirectives: None +#IndentAccessModifiers: false +IndentWrappedFunctionNames: false +KeepEmptyLinesAtTheStartOfBlocks: false +MaxEmptyLinesToKeep: 1 +NamespaceIndentation: All +PenaltyBreakAssignment: 2 +PenaltyBreakBeforeFirstCallParameter: 19 +PenaltyBreakComment: 300 +PenaltyBreakFirstLessLess: 120 +PenaltyBreakString: 1000 +PenaltyExcessCharacter: 1000000 +PenaltyReturnTypeOnItsOwnLine: 60 +PointerAlignment: Right +ReflowComments: false +SortIncludes: true +SortUsingDeclarations: true +SpaceAfterCStyleCast: true +SpaceAfterLogicalNot: false +SpaceAfterTemplateKeyword: false +SpaceBeforeAssignmentOperators: true +SpaceBeforeParens: ControlStatements +SpaceInEmptyParentheses: false +SpacesBeforeTrailingComments: 1 +SpacesInAngles: false +SpacesInCStyleCastParentheses: false +SpacesInContainerLiterals: false +SpacesInParentheses: false +SpacesInSquareBrackets: false +Standard: c++20 +... +--- +Language: Java + +AllowShortFunctionsOnASingleLine: None +BreakAfterJavaFieldAnnotations: true +ColumnLimit: 120 +IndentWidth: 4 +JavaImportGroups: ['java', 'javax'] +TabWidth: 4 +UseTab: Never +... +--- +Language: CSharp +BasedOnStyle: Microsoft +IndentWidth: 4 +TabWidth: 4 +UseTab: Never +... diff --git a/.config/environment.d/10-xdg.conf b/.config/environment.d/10-xdg.conf new file mode 100644 index 0000000..049a392 --- /dev/null +++ b/.config/environment.d/10-xdg.conf @@ -0,0 +1,4 @@ +XDG_BIN_HOME=$HOME/.local/bin +XDG_CACHE_HOME=$HOME/.cache +XDG_CONFIG_HOME=$HOME/.config +XDG_DATA_HOME=$HOME/.local/share diff --git a/.config/environment.d/11-system.conf b/.config/environment.d/11-system.conf new file mode 100644 index 0000000..cdcd52d --- /dev/null +++ b/.config/environment.d/11-system.conf @@ -0,0 +1,3 @@ +EDITOR=nvim +FZF_DEFAULT_COMMAND="fd -H --type f" +MANPAGES="sh -c 'col -bx | bat -l man -p'" diff --git a/.config/environment.d/20-toolset.conf b/.config/environment.d/20-toolset.conf new file mode 100644 index 0000000..1985fd2 --- /dev/null +++ b/.config/environment.d/20-toolset.conf @@ -0,0 +1,32 @@ +# [ Fly ] +FLYCTL_INSTALL=$HOME/.fly + +## [ SQLITE ] +SQLITE_HISTORY=$XDG_CACHE_HOME/sqlite_history + +## [ PostgreSQL ] +PGPASSFILE=$XDG_CONFIG_HOME/pg/pgpass +PGSERVICEFILE=$XDG_CONFIG_HOME/pg/pg_service.conf +PG_COLOR=always +PSQLRC=$XDG_CONFIG_HOME/pg/psqlrc +PSQL_HISTORY=$XDG_CACHE_HOME/pg/psql_history + +## [ Crypto ] +GNUPGHOME=$XDG_DATA_HOME/gnupg +MINISIGN_CONFIG_DIR=$XDG_DATA_HOME/minisign + +## [ History ] +HISTFILE=$HOME/.history +HISTTIMEFORMAT='[%F %T]' +LESSHISTFILE=- + +## [ Dotfiles ] +DOTFILEDIR=$XDG_DATA_HOME/dotfiles +DOTFILEBRANCH=lainpad + +## [ Atuin ] +ATUIN_NOBIND="true" + +## [ Wezterm ] +WEZTERM_SHELL_SKIP_ALL=1 +WEZTERM_SHELL_SKIP_SEMANTIC_ZONES=1 diff --git a/.config/environment.d/21-lang.conf b/.config/environment.d/21-lang.conf new file mode 100644 index 0000000..a6fc9f7 --- /dev/null +++ b/.config/environment.d/21-lang.conf @@ -0,0 +1,37 @@ +## [ C and C++ ] +CC=clang +CXX=clang++ +AR=llvm-ar +CC_LD=lld +CXX_LD=lld + +## [ Rust ] +RUSTUP_HOME=$XDG_DATA_HOME/rustup +CARGO_HOME=$XDG_DATA_HOME/cargo + +## [ Clojure ] +LEIN_HOME=$XDG_DATA_HOME/lein + +## [ Go ] +GOPATH=$XDG_DATA_HOME/go + +## [ Haskell ] +CABAL_CONFIG=$XDG_CONFIG_HOME/cabal/config +CABAL_DIR=$XDG_CACHE_HOME/cabal +GHCUP_USE_XDG_DIRS=1 +STACK_ROOT=$XDG_DATA_HOME/stack + +## [ Julia ] +JULIA_DEPOT_PATH=$XDG_DATA_HOME/julia:$JULIA_DEPOT_PATH + +## [ Elixir ] +MIX_XDG=1 + +## [ Sage ] +DOT_SAGE=$XDG_DATA_HOME/sage + +## [ Javascript ] +npm_config_prefix=$HOME/.local + +## [ Misc ] +PKG_CONFIG_PATH=/usr/local/lib/pkgconfig diff --git a/.config/environment.d/30-layout.conf b/.config/environment.d/30-layout.conf new file mode 100644 index 0000000..8fc9ca3 --- /dev/null +++ b/.config/environment.d/30-layout.conf @@ -0,0 +1 @@ +XKB_DEFAULT_OPTIONS=caps:swapescape diff --git a/.config/environment.d/99-path.conf b/.config/environment.d/99-path.conf new file mode 100644 index 0000000..9c59e7b --- /dev/null +++ b/.config/environment.d/99-path.conf @@ -0,0 +1 @@ +PATH=${FLYCTL_INSTALL}/bin:${GOPATH}/bin:${HOME}/.local/bin:${PATH} diff --git a/.config/gdb/gdbearlyinit b/.config/gdb/gdbearlyinit new file mode 100644 index 0000000..b73aa96 --- /dev/null +++ b/.config/gdb/gdbearlyinit @@ -0,0 +1 @@ +set startup-quietly on diff --git a/.config/gdb/gdbinit b/.config/gdb/gdbinit new file mode 100644 index 0000000..de82e79 --- /dev/null +++ b/.config/gdb/gdbinit @@ -0,0 +1,8 @@ +set confirm off +set pagination off +set print pretty on +set verbose off +set prompt \001\033[38;5;206m\002gdb> \001\033[0m\002 +#set prompt \001\033[1;93m\002gdb> \001\033[0m\002 +set disassembly-flavor intel +#set debuginfod enabled on diff --git a/.config/git/config b/.config/git/config new file mode 100644 index 0000000..c74375b --- /dev/null +++ b/.config/git/config @@ -0,0 +1,46 @@ +[user] + name = Aydin Mercan + email = aydin@mercan.dev + signingkey = "~/.ssh/git" + +[core] + editor = nvim + +# Despite being under the gpg setting all signing is through ssh +[gpg] + format = ssh + +[commit] + gpgsign = true + +[push] + gpgsign = if-asked + +[tag] + gpgsign = true + +[merge] + conflictstyle = diff3 + +[color] + status = true + branch = true + interactive = true + diff = true + ui = true + +[advice] + addEmptyPathspec = false + addIgnoredFile = false + +[log] + showSignature = true + +[init] + defaultBranch = "main" + +[alias] + sls = diff --name-only --cached + sdiff = diff --staged + adog = log --all --decorate --oneline --graph + scdiff = diff --staged --check diff --git a/.config/nvim/filetype.lua b/.config/nvim/filetype.lua new file mode 100644 index 0000000..b6d8a62 --- /dev/null +++ b/.config/nvim/filetype.lua @@ -0,0 +1,15 @@ +vim.filetype.add({ + extension = { + ll = "llvm", + v = "verilog", + }, + filename = { + [".clang-format"] = "yaml", + ["APKBUILD"] = "sh", + ["Justfile"] = "make", + ["sbclrc"] = "lisp", + }, + pattern = { + ["(Container|Docker)file.*"] = "dockerfile", + }, +}) diff --git a/.config/nvim/init.lua b/.config/nvim/init.lua new file mode 100644 index 0000000..4417dfd --- /dev/null +++ b/.config/nvim/init.lua @@ -0,0 +1,3 @@ +require 'intangible.keymap' +require 'intangible.options' +require 'intangible.packages' -- last diff --git a/.config/nvim/lua/intangible/keymap.lua b/.config/nvim/lua/intangible/keymap.lua new file mode 100644 index 0000000..4242158 --- /dev/null +++ b/.config/nvim/lua/intangible/keymap.lua @@ -0,0 +1,31 @@ +-- Saner nagivation and search +vim.g.mapleader = ' ' + +-- +vim.api.nvim_set_keymap('n', 'j', 'gj', { noremap = true, silent = true }) +vim.api.nvim_set_keymap('n', 'k', 'gk', { noremap = true, silent = true }) + +-- Tab Control +vim.api.nvim_set_keymap('n', 'tn', ':tabnew', { noremap = true, silent = true }) +vim.api.nvim_set_keymap('n', 'tq', ':tabclose', { noremap = true, silent = true }) +vim.api.nvim_set_keymap('n', '', 'gT', { noremap = true, silent = true }) +vim.api.nvim_set_keymap('n', '', 'gt', { noremap = true, silent = true }) + +-- Split control via C leader +vim.api.nvim_set_keymap('n', 'tv', ':vsplit', { noremap = true, silent = true }) +vim.api.nvim_set_keymap('n', 'th', ':split', { noremap = true, silent = true }) +vim.api.nvim_set_keymap('n', '', '', { noremap = true, silent = true }) +vim.api.nvim_set_keymap('n', '', '', { noremap = true, silent = true }) +vim.api.nvim_set_keymap('n', '', '', { noremap = true, silent = true }) +vim.api.nvim_set_keymap('n', '', '', { noremap = true, silent = true }) + +-- Clear search highlight +vim.api.nvim_set_keymap('n', '', ':nohlsearch', { noremap = true, silent = true }) +vim.api.nvim_set_keymap('n', '', ':nohlsearch', { noremap = true, silent = true }) + +-- Q as a macro quickloader +vim.api.nvim_set_keymap('n', 'Q', '@q', { noremap = true, silent = true }) + +-- I don't want F1 to search +vim.api.nvim_set_keymap('n', '', '', { noremap = true, silent = true }) +vim.api.nvim_set_keymap('i', '', '', { noremap = true, silent = true }) diff --git a/.config/nvim/lua/intangible/options.lua b/.config/nvim/lua/intangible/options.lua new file mode 100644 index 0000000..5ab879c --- /dev/null +++ b/.config/nvim/lua/intangible/options.lua @@ -0,0 +1,60 @@ +-- Appearence +vim.o.background = 'dark' +vim.o.guifont = 'Symbols Nerd Font:h12' +vim.o.magic = true +vim.o.showmode = false +vim.o.termguicolors = true +vim.o.title = true +vim.wo.number = true +vim.wo.signcolumn = 'number' + +-- Better completion +vim.o.completeopt = 'menuone,noinsert,noselect' +vim.o.shortmess = vim.o.shortmess .. 'c' + +-- Colorful +vim.cmd [[ set termguicolors ]] + +-- Trust plugin handling +vim.cmd [[ syntax enable ]] +vim.cmd [[ filetype plugin indent on ]] + +-- Large undo size +vim.bo.undofile = true +vim.o.undofile = true +vim.o.undolevels = 1000 +vim.o.undoreload = 1000 + +-- Sane encoding and binary handling +vim.o.bomb = true +vim.o.binary = true +vim.o.encoding = 'utf-8' +vim.o.fileencoding = 'utf-8' +vim.o.fileencodings = 'utf-8' + +-- Mouse +vim.o.mouse = 'ni' + +-- Default Indentation +vim.bo.expandtab = true +vim.bo.shiftwidth = 4 +vim.bo.tabstop = 4 +vim.o.expandtab = true +vim.o.shiftwidth = 4 +vim.o.tabstop = 4 + +-- Grep +vim.o.grepprg = 'rg --vimgrep --no-heading --smart-case' + +-- Deactivate some unused builtins. +vim.g.loaded_tutor_mode_plugin = 0 + +-- Misc. +vim.fn.matchadd('TSDanger', [[\s\+$]]) +vim.g.asmsyntax = "nasm" +vim.g.tex_flavor = "latex" +vim.o.autoindent = true +vim.o.clipboard = "unnamedplus" +vim.o.copyindent = true +vim.o.lazyredraw = true +vim.o.virtualedit = "block" diff --git a/.config/nvim/lua/intangible/packages.lua b/.config/nvim/lua/intangible/packages.lua new file mode 100644 index 0000000..923565a --- /dev/null +++ b/.config/nvim/lua/intangible/packages.lua @@ -0,0 +1,275 @@ +-- Bootstrap lazy.nvim +local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" +if not vim.loop.fs_stat(lazypath) then + vim.fn.system({ + "git", + "clone", + "--filter=blob:none", + "https://github.com/folke/lazy.nvim.git", + "--branch=stable", -- latest stable release + lazypath, + }) +end + +vim.opt.rtp:prepend(lazypath) + +return require('lazy').setup({ + {'nvim-lua/completion-nvim'}, + + { + 'neovim/nvim-lspconfig', + lazy = true, + config = function() + local lsp = require('lspconfig') + lsp.pyright.setup{} + lsp.gopls.setup{} + lsp.clangd.setup{ + default_config = { + root_dir = [[ + root_pattern( + '.git', + 'compile_commands.json', + ) + ]], + } + } + end + }, + + { + 'folke/tokyonight.nvim', + config = function() + require('tokyonight').setup({ + style = "night", + }) + + vim.cmd [[ colorscheme tokyonight ]] + end, + }, + + { + 'nvim-lualine/lualine.nvim', + dependencies = {'kyazdani42/nvim-web-devicons', lazy = true}, + config = function() + require('lualine').setup { + options = { + theme = 'tokyonight', + section_separators = '', + component_separators = ' ', + } + } + end + }, + + { + 'nvim-telescope/telescope.nvim', + dependencies = {{'nvim-lua/popup.nvim'}, {'nvim-lua/plenary.nvim'}}, + + keys = { + {'', ':Telescope fd', mode = 'n', noremap = true, silent = true}, + }, + + config = function() + local actions = require('telescope.actions') + + require('telescope').setup { + defaults = { + mappings = { + i = { + [""] = actions.close + }, + }, + } + } + end, + }, + + + { + 'mhartington/formatter.nvim', + + keys = { + {'', ':Format', mode = 'n', noremap = true, silent = true}, + }, + + config = function() + require('formatter').setup({ + filetype = { + rust = { + function() + return { + exe = 'rustfmt', + args = {'--emit=stdout', '--edition=2021'}, + stdin = true, + } + end + }, + + python = { + function() + return { + exe = 'black', + args = {'-q', '-'}, + stdin = true, + } + end + }, + + cpp = { + function() + return { + exe = "clang-format", + args = {"--assume-filename", vim.api.nvim_buf_get_name(0)}, + stdin = true, + cwd = vim.fn.expand('%:p:h') -- Run clang-format in cwd of the file. + } + end + }, + + c = { + function() + return { + exe = "clang-format", + args = {"--assume-filename", vim.api.nvim_buf_get_name(0)}, + stdin = true, + cwd = vim.fn.expand('%:p:h') -- Run clang-format in cwd of the file. + } + end + }, + + go = { + function() + return { + exe = "gofmt", + stdin = true, + } + end + }, + + json = { + function() + return { + exe = "jq", + args = {".", "-M"}, + stdin = true, + } + end + }, + + elixir = { + function() + return { + exe = "mix", + args = {"format", "-"}, + stdin = true + } + end + }, + + zig = { + function() + return { + exe = "zig", + args = {"fmt", "--stdin"}, + stdin = true, + } + end + }, + + ["*"] = { + require('formatter.filetypes.any').remove_trailing_whitespace + } + } + }) + end + }, + + { + 'nvim-treesitter/nvim-treesitter', + config = function() + require('nvim-treesitter.configs').setup { + highlight = { + enable = true, + additional_vim_regex_highlighting = false, + }, + incremental_selection = { + enable = true, + }, + indent = { + enable = true, + disable = { 'c', 'cpp', 'java', 'python', 'toml' }, + }, + ignore_install = { 'v' }, + ensure_installed = { + 'bibtex', + 'c', + 'clojure', + 'cmake', + 'comment', + 'commonlisp', + 'cpp', + 'dockerfile', + 'dot', + 'eex', + 'elixir', + 'erlang', + 'git_config', + 'git_rebase', + 'gitattributes', + 'gitcommit', + 'gitignore', + 'go', + 'gomod', + 'gosum', + 'gowork', + 'haskell', + 'heex', + 'hjson', + 'http', + 'ini', + 'java', + 'jq', + 'json', + 'json5', + 'jsonnet', + 'julia', + 'latex', + 'llvm', + 'lua', + 'luadoc', + 'luap', + 'make', + 'markdown', + 'markdown_inline', + 'meson', + 'ocaml', + 'ocaml_interface', + 'proto', + 'python', + 'r', + 'racket', + 'regex', + 'rust', + 'scala', + 'scheme', + 'sql', + 'ssh_config', + 'starlark', + 'toml', + 'verilog', + 'vim', + 'vimdoc', + 'yaml', + 'zig', + }, + } + + vim.api.nvim_exec([[ + set foldmethod=expr + set foldexpr=nvim_treesitter#foldexpr() + set foldlevel=9999 + ]], false) + end + }, + +}) diff --git a/.config/sway/config b/.config/sway/config new file mode 100644 index 0000000..44d8fcd --- /dev/null +++ b/.config/sway/config @@ -0,0 +1,198 @@ +# Default config for sway +# +# Copy this to ~/.config/sway/config and edit it to your liking. +# +# Read `man 5 sway` for a complete reference. + +### Variables +# +# Logo key. Use Mod1 for Alt. +set $mod Mod4 +# Home row direction keys, like vim +set $left h +set $down j +set $up k +set $right l +# Your preferred terminal emulator +set $term foot +# Your preferred application launcher +# Note: pass the final command to swaymsg so that the resulting window can be opened +# on the original workspace that the command was run on. + +exec mako +smart_borders on + +default_border pixel 5 + +### Output configuration +# +# Default wallpaper (more resolutions are available in /usr/share/backgrounds/sway/) + +output eDP-1 pos 0 0 res 1920x1080 + +output * bg ~/media/lain_wallpaper.jpg fill + +input * { + xkb_layout us,tr + xkb_options caps:swapescape +} + +### Key bindings +# +# Basics: +# + # Start a terminal + bindsym $mod+Return exec $term + + # Kill focused window + bindsym $mod+Shift+c kill + + + bindsym $mod+w exec firefox + bindsym $mod+Shift+w exec flatpak run com.google.Chrome + # Start your launcher + bindsym $mod+p exec wofi -i --show run + bindsym $mod+Shift+p exec wofi -i --show drun + + # Drag floating windows by holding down $mod and left mouse button. + # Resize them with right mouse button + $mod. + # Despite the name, also works for non-floating windows. + # Change normal to inverse to use left mouse button for resizing and right + # mouse button for dragging. + floating_modifier $mod normal + + # Reload the configuration file + bindsym $mod+Shift+r reload + + # Exit sway (logs you out of your Wayland session) + bindsym $mod+Shift+e exec swaynag -t warning -m 'You pressed the exit shortcut. Do you really want to exit sway? This will end your Wayland session.' -B 'Yes, exit sway' 'swaymsg exit' + + bindsym XF86AudioRaiseVolume exec pactl set-sink-volume @DEFAULT_SINK@ +5% + bindsym XF86AudioLowerVolume exec pactl set-sink-volume @DEFAULT_SINK@ -5% + bindsym XF86AudioMute exec pactl set-sink-mute @DEFAULT_SINK@ toggle + bindsym XF86AudioMicMute exec pactl set-source-mute @DEFAULT_SOURCE@ toggle + bindsym XF86MonBrightnessDown exec brightnessctl set 5%- + bindsym XF86MonBrightnessUp exec brightnessctl set 5%+ + bindsym XF86Display exec swaylock +# +# Moving around: +# + # Move your focus around + bindsym $mod+$left focus left + bindsym $mod+$down focus down + bindsym $mod+$up focus up + bindsym $mod+$right focus right + # Or use $mod+[up|down|left|right] + bindsym $mod+Left focus left + bindsym $mod+Down focus down + bindsym $mod+Up focus up + bindsym $mod+Right focus right + + # Move the focused window with the same, but add Shift + bindsym $mod+Shift+$left move left + bindsym $mod+Shift+$down move down + bindsym $mod+Shift+$up move up + bindsym $mod+Shift+$right move right + # Ditto, with arrow keys + bindsym $mod+Shift+Left move left + bindsym $mod+Shift+Down move down + bindsym $mod+Shift+Up move up + bindsym $mod+Shift+Right move right +# +# Workspaces: +# + # Switch to workspace + bindsym $mod+1 workspace number 1 + bindsym $mod+2 workspace number 2 + bindsym $mod+3 workspace number 3 + bindsym $mod+4 workspace number 4 + bindsym $mod+5 workspace number 5 + bindsym $mod+6 workspace number 6 + bindsym $mod+7 workspace number 7 + bindsym $mod+8 workspace number 8 + bindsym $mod+9 workspace number 9 + bindsym $mod+0 workspace number 10 + # Move focused container to workspace + bindsym $mod+Shift+1 move container to workspace number 1 + bindsym $mod+Shift+2 move container to workspace number 2 + bindsym $mod+Shift+3 move container to workspace number 3 + bindsym $mod+Shift+4 move container to workspace number 4 + bindsym $mod+Shift+5 move container to workspace number 5 + bindsym $mod+Shift+6 move container to workspace number 6 + bindsym $mod+Shift+7 move container to workspace number 7 + bindsym $mod+Shift+8 move container to workspace number 8 + bindsym $mod+Shift+9 move container to workspace number 9 + bindsym $mod+Shift+0 move container to workspace number 10 + # Note: workspaces can have any name you want, not just numbers. + # We just use 1-10 as the default. +# +# Layout stuff: +# + # You can "split" the current object of your focus with + # $mod+b or $mod+v, for horizontal and vertical splits + # respectively. + bindsym $mod+b splith + bindsym $mod+v splitv + + # Switch the current container between different layout styles + bindsym $mod+s layout stacking + #bindsym $mod+w layout tabbed + bindsym $mod+e layout toggle split + + # Make the current focus fullscreen + bindsym $mod+f fullscreen + + # Toggle the current focus between tiling and floating mode + bindsym $mod+Shift+space floating toggle + + # Swap focus between the tiling area and the floating area + bindsym $mod+space focus mode_toggle + + # Move focus to the parent container + bindsym $mod+a focus parent +# +# Scratchpad: +# + # Sway has a "scratchpad", which is a bag of holding for windows. + # You can send windows there and get them back later. + + # Move the currently focused window to the scratchpad + bindsym $mod+Shift+grave move scratchpad + + # Show the next scratchpad window or hide the focused scratchpad window. + # If there are multiple scratchpad windows, this command cycles through them. + bindsym $mod+grave scratchpad show +# +# Resizing containers: +# +mode "resize" { + # left will shrink the containers width + # right will grow the containers width + # up will shrink the containers height + # down will grow the containers height + bindsym $left resize shrink width 10px + bindsym $down resize grow height 10px + bindsym $up resize shrink height 10px + bindsym $right resize grow width 10px + + # Ditto, with arrow keys + bindsym Left resize shrink width 10px + bindsym Down resize grow height 10px + bindsym Up resize shrink height 10px + bindsym Right resize grow width 10px + + # Return to default mode + bindsym Return mode "default" + bindsym Escape mode "default" +} +bindsym $mod+r mode "resize" + +# +# Status Bar: +# +# Read `man 5 sway-bar` for more information about this section. +bar { + swaybar_command waybar +} + +include /etc/sway/config.d/* diff --git a/.config/user-dirs.dirs b/.config/user-dirs.dirs new file mode 100644 index 0000000..ad14430 --- /dev/null +++ b/.config/user-dirs.dirs @@ -0,0 +1,15 @@ +# This file is written by xdg-user-dirs-update +# If you want to change or add directories, just edit the line you're +# interested in. All local changes will be retained on the next run. +# Format is XDG_xxx_DIR="$HOME/yyy", where yyy is a shell-escaped +# homedir-relative path, or XDG_xxx_DIR="/yyy", where /yyy is an +# absolute path. No other format is supported. +# +XDG_DESKTOP_DIR="$HOME/" +XDG_DOWNLOAD_DIR="$HOME/downloads" +XDG_TEMPLATES_DIR="$HOME/" +XDG_DOCUMENTS_DIR="$HOME/docs" +XDG_MUSIC_DIR="$HOME/music" +XDG_PICTURES_DIR="$HOME/media" +XDG_VIDEOS_DIR="$HOME/media" +XDG_PUBLICSHARE_DIR="$HOME/downloads" diff --git a/.config/waybar/config b/.config/waybar/config new file mode 100644 index 0000000..7c95f6b --- /dev/null +++ b/.config/waybar/config @@ -0,0 +1,70 @@ +{ + "height": 35, // Waybar height (to be removed for auto height) + "spacing": 4, // Gaps between modules (4px) + + "modules-left": ["sway/workspaces"], + "modules-center": ["sway/window"], + "modules-right": ["wireplumber", "network", "backlight", "keyboard-state", "sway/language", "battery", "clock", "tray"], + + "sway/window": { + "format": "{title}", + "max-length": 120 + }, + + "keyboard-state": { + "numlock": true, + "capslock": true, + "format": "{name} {icon}", + "format-icons": { + "locked": "", + "unlocked": "" + } + }, + + "sway/mode": { + "format": "{}" + }, + + "sway/language": { + "format": "{}", + "on-click": "swaymsg input type:keyboard xkb_switch_layout next", + }, + + "backlight": { + // "device": "acpi_video1", + "format": "{percent}% {icon}", + "format-icons": ["", "", "", "", "", "", "", "", ""] + }, + + "battery": { + "states": { + // "good": 95, + "warning": 30, + "critical": 15 + }, + "format": "{capacity}% {icon}", + "format-charging": "{capacity}% ", + "format-plugged": "{capacity}% ", + "format-alt": "{time} {icon}", + // "format-good": "", // An empty format will hide the module + // "format-full": "", + "format-icons": ["", "", "", "", ""] + }, + + "network": { + // "interface": "wlp2*", // (Optional) To force the use of this interface + "format-wifi": "{essid} ({signalStrength}%) ", + "format-ethernet": "󰈀 {ipaddr}/{cidr} ", + "tooltip-format": "{ifname} via {gwaddr} ", + "format-linked": "{ifname} (No IP) ", + "format-disconnected": "Disconnected ⚠", + "format-alt": "{ifname}: {ipaddr}/{cidr}" + }, + + "wireplumber": { + "format": "{volume}% {icon}", + "format-muted": "󰝟", + "format-icons": ["", "", ""] + } +} + diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..8bfd15a --- /dev/null +++ b/.editorconfig @@ -0,0 +1,65 @@ +root = true + +[*.{c,cpp,cc,h,hpp,hh}] +end_of_line = lf +insert_final_newline = true +charset = utf-8 +trim_trailing_whitespace = true +indent_style = tab +indent_size = 8 + +[*.rs] +end_of_line = lf +insert_final_newline = true +charset = utf-8 +trim_trailing_whitespace = true +indent_style = space +indent_size = 4 + +[meson.build] +end_of_line = lf +insert_final_newline = true +charset = utf-8 +trim_trailing_whitespace = true +indent_style = space +indent_size = 4 + +[{go.{mod,work},*.go}] +end_of_line = lf +insert_final_newline = true +charset = utf-8 +trim_trailing_whitespace = true +indent_style = tab +indent_size = 8 + +[*.nix] +end_of_line = lf +insert_final_newline = true +charset = utf-8 +trim_trailing_whitespace = true +indent_style = space +indent_size = 2 + +[*.{lisp,el,edn,clj}] +end_of_line = lf +insert_final_newline = true +charset = utf-8 +trim_trailing_whitespace = true +indent_style = space +indent_size = 2 + +[*.html] +end_of_line = lf +insert_final_newline = true +charset = utf-8 +trim_trailing_whitespace = true +indent_style = space +indent_size = 4 + +[APKBUILD] +end_of_line = lf +insert_final_newline = true +charset = utf-8 +trim_trailing_whitespace = true +indent_style = tab +indent_size = 8 diff --git a/.local/bin/dotctl b/.local/bin/dotctl new file mode 100755 index 0000000..2760c6b --- /dev/null +++ b/.local/bin/dotctl @@ -0,0 +1,44 @@ +#!/usr/bin/env bash + +[ -z "$DOTCTLCMD" ] && DOTCTLCMD="git --git-dir=$DOTFILEDIR --work-tree=$HOME" + +case $1 in + ls) echo "==> ${DOTFILEBRANCH:=main} <==" + $DOTCTLCMD ls-tree --full-tree -r --name-only $DOTFILEBRANCH + echo "==> staging <==" + $DOTCTLCMD diff --name-only --cached + ;; + sync) + $DOTCTLCMD add -A ~/. + echo "==> staging <==" + $DOTCTLCMD diff --name-only --cached + ;; + add) $DOTCTLCMD add -f ${@:2} ;; + amend) $DOTCTLCMD commit --amend --no-edit ${@:2} ;; + autocheckout) $DOTCTLCMD checkout ${DOTFILEBRANCH:-main} ${@:2} ;; + cmd) $DOTCTLCMD ${@:2} ;; + commit) $DOTCTLCMD commit ${@:2} ;; + diff) $DOTCTLCMD diff --staged ${@:2} ;; + log) $DOTCTLCMD log ${@:2} ;; + pull) $DOTCTLCMD pull ${@:2} ;; + push) $DOTCTLCMD push -u origin ${DOTFILEBRANCH:-main} ;; + rm) $DOTCTLCMD rm --cached -r -f ${@:2};; + sdiff) $DOTCTLCMD diff --staged ${@:2} ;; + *) echo "dotctl - stupid bare git repo wrapper for dotfiles" + echo "Setup:" + echo " * cerate a bare repo, specify the remote repo and set its path to DOTFILEDIR" + echo " * specify a branch as DOTFILEBRANCH or use main by default" + echo "Usage: dotctl [OPTION] ([ARGUMENT])" + echo "Options:" + echo " add [FILE]: add FILE to the repository" + echo " amend: amend changes to an existing commit" + echo " commit: commit changes" + echo " diff: show diff of staged changes" + echo " log: same as normal log" + echo " ls: list files staging and used branch" + echo " push: push to DOTFILEBRANCH (default: main, currently: ${DOTFILEBRANCH:-main})" + echo " rm [FILE]: remove FILE from tracking only" + echo " sdiff: diff staged changed" + echo " sync: add all changes in tracked files" + ;; +esac diff --git a/.local/share/cargo/config.toml b/.local/share/cargo/config.toml new file mode 100644 index 0000000..b21616c --- /dev/null +++ b/.local/share/cargo/config.toml @@ -0,0 +1,14 @@ +[alias] +a = "audit" +b = "build" +bb = "build --release" +c = "clippy" +d = "doc" +dd = "doc --release" +do = "doc --open" +ddo = "doc --release --open" +o = "outdated" +r = "run" +rr = "run --release" +t = "nextest run" +u = "update" diff --git a/.profile b/.profile new file mode 100644 index 0000000..f82d8ea --- /dev/null +++ b/.profile @@ -0,0 +1,14 @@ +if [[ -n $BASH ]]; then + set -a + for f in ~/.config/environment.d/*.conf; do + source $f + done + set +a +fi + +[[ -f ~/.bashrc ]] && . ~/.bashrc + +if [[ -z $WAYLAND_DISPLAY ]] && [[ $(tty) = "/dev/tty1" ]]; then + export SSH_AUTH_SOCK="$XDG_RUNTIME_DIR/gcr/ssh" + exec sway +fi