From 9bf3adb7580bf4e01ef2f6154879b033a24e45ef Mon Sep 17 00:00:00 2001 From: Juan Nunez-Iglesias Date: Sat, 20 Jun 2026 10:52:48 +0200 Subject: [PATCH] Add current dotfiles Delete all the fish cruft Add fish config Add cosmic config --- bash/bashrc | 144 ++++++++++++++++++++++ cosmic/custom-shortcuts | 37 ++++++ cosmic/system-actions | 1 + cosmic/xkb_config | 9 ++ fish/config.fish | 31 +++++ fish/fish_plugins | 4 + ghostty/config.ghostty | 17 +++ git/gitconfig | 17 +++ nvim/init.lua | 258 ++++++++++++++++++++++++++++++++++++++++ nvim/lazy-lock.json | 7 ++ 10 files changed, 525 insertions(+) create mode 100644 bash/bashrc create mode 100644 cosmic/custom-shortcuts create mode 100644 cosmic/system-actions create mode 100644 cosmic/xkb_config create mode 100644 fish/config.fish create mode 100644 fish/fish_plugins create mode 100644 ghostty/config.ghostty create mode 100644 git/gitconfig create mode 100644 nvim/init.lua create mode 100644 nvim/lazy-lock.json diff --git a/bash/bashrc b/bash/bashrc new file mode 100644 index 0000000..f417611 --- /dev/null +++ b/bash/bashrc @@ -0,0 +1,144 @@ +# ~/.bashrc: executed by bash(1) for non-login shells. +# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc) +# for examples + +# If not running interactively, don't do anything +case $- in + *i*) ;; + *) return;; +esac + +# don't put duplicate lines or lines starting with space in the history. +# See bash(1) for more options +HISTCONTROL=ignoreboth + +# append to the history file, don't overwrite it +shopt -s histappend + +# for setting history length see HISTSIZE and HISTFILESIZE in bash(1) +HISTSIZE=10000 +HISTFILESIZE=20000 + +# enable searching through history with already-typed string (Matlab style) +bind '"\e[A": history-search-backward' +bind '"\e[B": history-search-forward' + +# check the window size after each command and, if necessary, +# update the values of LINES and COLUMNS. +shopt -s checkwinsize + +# If set, the pattern "**" used in a pathname expansion context will +# match all files and zero or more directories and subdirectories. +#shopt -s globstar + +# make less more friendly for non-text input files, see lesspipe(1) +[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)" + +# set variable identifying the chroot you work in (used in the prompt below) +if [ -z "${debian_chroot:-}" ] && [ -r /etc/debian_chroot ]; then + debian_chroot=$(cat /etc/debian_chroot) +fi + +# set a fancy prompt (non-color, unless we know we "want" color) +case "$TERM" in + xterm-color|*-256color) color_prompt=yes;; +esac + +# uncomment for a colored prompt, if the terminal has the capability; turned +# off by default to not distract the user: the focus in a terminal window +# should be on the output of commands, not on the prompt +#force_color_prompt=yes + +if [ -n "$force_color_prompt" ]; then + if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then + # We have color support; assume it's compliant with Ecma-48 + # (ISO/IEC-6429). (Lack of such support is extremely rare, and such + # a case would tend to support setf rather than setaf.) + color_prompt=yes + else + color_prompt= + fi +fi + +if [ "$color_prompt" = yes ]; then + PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ ' +else + PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ ' +fi +unset color_prompt force_color_prompt + +# If this is an xterm set the title to user@host:dir +case "$TERM" in +xterm*|rxvt*) + PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h: \w\a\]$PS1" + ;; +*) + ;; +esac + +# enable color support of ls and also add handy aliases +if [ -x /usr/bin/dircolors ]; then + test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)" + alias ls='ls --color=auto' + #alias dir='dir --color=auto' + #alias vdir='vdir --color=auto' + + alias grep='grep --color=auto' + alias fgrep='fgrep --color=auto' + alias egrep='egrep --color=auto' +fi + +# colored GCC warnings and errors +#export GCC_COLORS='error=01;31:warning=01;35:note=01;36:caret=01;32:locus=01:quote=01' + +# some more ls aliases +alias ll='ls -alF' +alias la='ls -A' +alias l='ls -CF' + +# Add an "alert" alias for long running commands. Use like so: +# sleep 10; alert +alias alert='notify-send --urgency=low -i "$([ $? = 0 ] && echo terminal || echo error)" "$(history|tail -n1|sed -e '\''s/^\s*[0-9]\+\s*//;s/[;&|]\s*alert$//'\'')"' + +# Alias definitions. +# You may want to put all your additions into a separate file like +# ~/.bash_aliases, instead of adding them here directly. +# See /usr/share/doc/bash-doc/examples in the bash-doc package. + +if [ -f ~/.bash_aliases ]; then + . ~/.bash_aliases +fi + +# enable programmable completion features (you don't need to enable +# this, if it's already enabled in /etc/bash.bashrc and /etc/profile +# sources /etc/bash.bashrc). +if ! shopt -oq posix; then + if [ -f /usr/share/bash-completion/bash_completion ]; then + . /usr/share/bash-completion/bash_completion + elif [ -f /etc/bash_completion ]; then + . /etc/bash_completion + fi +fi + +export PATH=${PATH}:/home/jni/.cargo/bin + +# >>> mamba initialize >>> +# !! Contents within this block are managed by 'micromamba shell init' !! +export MAMBA_EXE='/home/jni/.local/bin/micromamba'; +export MAMBA_ROOT_PREFIX='/home/jni/micromamba'; +__mamba_setup="$("$MAMBA_EXE" shell hook --shell bash --root-prefix "$MAMBA_ROOT_PREFIX" 2> /dev/null)" +if [ $? -eq 0 ]; then + eval "$__mamba_setup" +else + alias micromamba="$MAMBA_EXE" # Fallback on help from micromamba activate +fi +unset __mamba_setup +# <<< mamba initialize <<< + + +alias mu=micromamba + +mu activate all + + +export FJ_HOST=codeberg.org diff --git a/cosmic/custom-shortcuts b/cosmic/custom-shortcuts new file mode 100644 index 0000000..6f14b7c --- /dev/null +++ b/cosmic/custom-shortcuts @@ -0,0 +1,37 @@ +{ + ( + modifiers: [ + Super, + ], + key: "space", + ): System(Launcher), + ( + modifiers: [ + Super, + ], + key: "t", + ): Disable, + ( + modifiers: [ + Super, + ], + key: "e", + ): Resizing(Outwards), + ( + modifiers: [ + Super, + ], + key: "u", + ): Resizing(Inwards), + ( + modifiers: [ + Super, + ], + ): Disable, + ( + modifiers: [ + Super, + ], + key: "Return", + ): System(Terminal), +} \ No newline at end of file diff --git a/cosmic/system-actions b/cosmic/system-actions new file mode 100644 index 0000000..7f375f4 --- /dev/null +++ b/cosmic/system-actions @@ -0,0 +1 @@ +{ Terminal: "/usr/bin/ghostty" } diff --git a/cosmic/xkb_config b/cosmic/xkb_config new file mode 100644 index 0000000..fa4e42e --- /dev/null +++ b/cosmic/xkb_config @@ -0,0 +1,9 @@ +( + rules: "", + model: "", + layout: "us,us", + variant: "dvorak,", + options: Some("lv3:ralt_switch,compose:prsc,caps:escape,altwin:swap_lalt_lwin"), + repeat_delay: 600, + repeat_rate: 25, +) diff --git a/fish/config.fish b/fish/config.fish new file mode 100644 index 0000000..278d540 --- /dev/null +++ b/fish/config.fish @@ -0,0 +1,31 @@ +if status is-interactive + # Commands to run in interactive sessions can go here +end + +# Turn off syntax highlighting +for color in fish_color_command fish_color_comment fish_color_end \ + fish_color_escape fish_color_match fish_color_operator \ + fish_color_param fish_color_quote \ + fish_pager_color_description fish_pager_color_prefix + set $color normal +end + +set fish_color_autosuggestion white +set fish_color_error red + +set fish_pager_color_progress white + +# >>> mamba initialize >>> +# !! Contents within this block are managed by 'micromamba shell init' !! +set -gx MAMBA_EXE "/home/jni/.local/bin/micromamba" +set -gx MAMBA_ROOT_PREFIX "/home/jni/micromamba" +$MAMBA_EXE shell hook --shell fish --root-prefix $MAMBA_ROOT_PREFIX | source +# <<< mamba initialize <<< +micromamba activate all + +alias mu micromamba + +alias pbcopy wl-copy +alias pbpaste wl-paste + +fish_add_path /home/jni/.local/bin diff --git a/fish/fish_plugins b/fish/fish_plugins new file mode 100644 index 0000000..71e8b3e --- /dev/null +++ b/fish/fish_plugins @@ -0,0 +1,4 @@ +jorgebucaran/fisher +vitallium/tokyonight-fish +patrickf1/fzf.fish +ilancosman/tide diff --git a/ghostty/config.ghostty b/ghostty/config.ghostty new file mode 100644 index 0000000..c9ba2a5 --- /dev/null +++ b/ghostty/config.ghostty @@ -0,0 +1,17 @@ +font-family = BlexMono Nerd Font Mono +font-size = 11 + +keybind = super+t=new_tab +keybind = ctrl+shift+t=new_tab +keybind = super+n=new_window +keybind = ctrl+shift+n=new_window +keybind = ctrl+page_down=previous_tab +keybind = super+page_down=previous_tab +keybind = ctrl+page_up=next_tab +keybind = super+page_up=next_tab +keybind = super+c=copy_to_clipboard +keybind = super+v=paste_from_clipboard + +background = #000000 + +background-opacity = 0.92 diff --git a/git/gitconfig b/git/gitconfig new file mode 100644 index 0000000..964db3c --- /dev/null +++ b/git/gitconfig @@ -0,0 +1,17 @@ +[credential "https://github.com"] + helper = + helper = !/usr/bin/gh auth git-credential +[credential "https://gist.github.com"] + helper = + helper = !/usr/bin/gh auth git-credential +[user] + email = jni@fastmail.com + name = Juan Nunez-Iglesias +[core] + editor = vim +[init] + defaultBranch = main +[credential] + helper = libsecret +[url "git@codeberg.org:"] + insteadOf = https://codeberg.org/ diff --git a/nvim/init.lua b/nvim/init.lua new file mode 100644 index 0000000..2304b24 --- /dev/null +++ b/nvim/init.lua @@ -0,0 +1,258 @@ +-- bootstrap lazy.nvim (plugin manager) +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", lazypath, + }) +end +vim.opt.rtp:prepend(lazypath) + +-- plugins +require("lazy").setup({ + { + "nvim-telescope/telescope.nvim", + dependencies = { "nvim-lua/plenary.nvim" }, + }, + { + "j-hui/fidget.nvim", + opts = {}, + }, + { + "toppair/peek.nvim", + event = { "VeryLazy" }, + build = "deno task --quiet build:fast", + config = function() + require("peek").setup({ + app = "webview", + update_on_change = true, + }) + vim.api.nvim_create_user_command("Peek", require("peek").open, {}) + vim.api.nvim_create_user_command("PeekClose", require("peek").close, {}) + end, + }, +}) + +-- Basedpyright config using native vim.lsp.config: +vim.lsp.config('basedpyright', { + cmd = { 'basedpyright-langserver', '--stdio' }, + filetypes = { 'python' }, + root_markers = { 'pyproject.toml', 'setup.py', 'setup.cfg', '.git' }, + settings = { + basedpyright = { + typeCheckingMode = 'recommended', + }, + }, +}) +vim.lsp.enable('basedpyright') + +vim.api.nvim_create_autocmd("LspAttach", { + callback = function(args) + local bufnr = args.buf + + -- gd: open definition in new Ghostty window + vim.keymap.set('n', 'gd', function() + local clients = vim.lsp.get_clients({ bufnr = bufnr }) + if #clients == 0 then + print("No LSP client attached") + return + end + local encoding = clients[1].offset_encoding or 'utf-16' + + local params = vim.lsp.util.make_position_params(0, encoding) + vim.lsp.buf_request(bufnr, 'textDocument/definition', params, function(_, result) + if not result or vim.tbl_isempty(result) then + print("No definition found") + return + end + local location = result[1] + local uri = location.uri or location.targetUri + local range = location.range or location.targetSelectionRange + local filepath = vim.uri_to_fname(uri) + local line = range.start.line + local col = range.start.character + vim.fn.jobstart({ + 'ghostty', '-e', 'nvim', + string.format('+call cursor(%d,%d)', line, col), + filepath + }) + end) + end, { buffer = bufnr, desc = "Go to definition (new window)" }) + + -- gD: go to definition in same window + vim.keymap.set('n', 'gD', vim.lsp.buf.definition, + { buffer = bufnr, desc = "Go to definition (same window)" }) + + vim.keymap.set('n', 'K', vim.lsp.buf.hover, { buffer = bufnr }) + vim.keymap.set('n', 'gr', vim.lsp.buf.references, { buffer = bufnr }) + vim.keymap.set('n', 'rn', vim.lsp.buf.rename, { buffer = bufnr }) + end, +}) + +-- open references in a new window +vim.api.nvim_create_autocmd("FileType", { + pattern = "qf", + callback = function(args) + vim.keymap.set('n', '', function() + local qf_idx = vim.fn.line('.') + local qf_item = vim.fn.getqflist()[qf_idx] + if not qf_item then return end + + local filepath = vim.fn.bufname(qf_item.bufnr) + local line = qf_item.lnum + local col = qf_item.col + + vim.cmd('cclose') + vim.fn.jobstart({ + 'ghostty', '-e', 'nvim', + string.format('+call cursor(%d,%d)', line, col), + filepath + }) + end, { buffer = args.buf, desc = "Open reference in new window", nowait = true }) + end, +}) + +vim.keymap.set('n', 'gr', function() + local clients = vim.lsp.get_clients({ bufnr = bufnr }) + if #clients == 0 then + require("fidget").notify("No LSP client attached", vim.log.levels.WARN) + return + end + local encoding = clients[1].offset_encoding or 'utf-16' + local params = vim.lsp.util.make_position_params(0, encoding) + params.context = { includeDeclaration = true } + + require("fidget").notify("Searching for references...") + + vim.lsp.buf_request(bufnr, 'textDocument/references', params, function(_, result) + if not result or vim.tbl_isempty(result) then + require("fidget").notify("No references found", vim.log.levels.WARN) + return + end + local items = vim.lsp.util.locations_to_items(result, encoding) + vim.fn.setqflist({}, ' ', { title = 'References', items = items }) + vim.cmd('copen') + end) +end, { buffer = bufnr, desc = "Find references (new window on select)" }) + +-- ================== CONFIG ================= -- + +-- automatically spell check markdown and Qmd files +vim.api.nvim_create_autocmd({ 'BufNewFile', 'BufRead' }, { + pattern = { '*.md', '*.markdown', '*.qmd' }, + callback = function() + vim.opt_local.spell = true + vim.opt_local.spelllang = { 'en_gb', 'es' } -- adjust to taste + end, +}) + +-- wrap long lines and show wrapping with underscores +vim.opt.linebreak = true +vim.opt.showbreak = '______' + +vim.opt.tabstop = 4 +vim.opt.shiftwidth = 4 +vim.opt.expandtab = true +vim.opt.autoindent = true + +-- formatoptions: start from default and remove 't' +-- (don't auto-wrap text while typing) +vim.opt.formatoptions:remove('t') +vim.opt.textwidth = 79 + + +-- ignore case while searching, unless variable case in search string +vim.opt.ignorecase = true +vim.opt.smartcase = true +vim.opt.incsearch = true + +-- h/l/~/cursor keys wrap across line boundaries +vim.opt.whichwrap = 'h,l,~,[,]' + +-- % matches <> as well as () [] {} +vim.opt.matchpairs:append('<:>') + +-- g- as alias for g; (jump to older change position) +vim.keymap.set('n', 'g-', 'g;') + +-- gl as alias for opening diagnostic float +vim.keymap.set( + 'n', 'gl', vim.diagnostic.open_float, + { desc = "Show diagnostic message" } +) +-- diagnostics config +vim.diagnostic.config({ + severity_sort = true, -- errors before warnings in lists + signs = false, -- don't use gutters + underline = { + severity = { min = vim.diagnostic.severity.WARN }, + }, + virtual_text = { + severity = { min = vim.diagnostic.severity.ERROR }, + }, +}) + +-- Use the terminal's background color instead of neovim's +vim.api.nvim_set_hl(0, "Normal", { bg = "none" }) +vim.api.nvim_create_autocmd("ColorScheme", { + callback = function() + vim.api.nvim_set_hl(0, "Normal", { bg = "none" }) -- or "#000000" + end, +}) + +-- Force distinct underline colors regardless of colorscheme +vim.api.nvim_create_autocmd("ColorScheme", { + callback = function() + vim.api.nvim_set_hl(0, "DiagnosticUnderlineError", { undercurl = true, sp = "#d16969" }) + vim.api.nvim_set_hl(0, "DiagnosticUnderlineWarn", { undercurl = true, sp = "#d7ba7d" }) + vim.api.nvim_set_hl(0, "DiagnosticUnderlineInfo", { undercurl = true, sp = "#888888" }) + vim.api.nvim_set_hl(0, "DiagnosticUnderlineHint", { undercurl = true, sp = "#888888" }) + end, +}) + +-- jump to last position on reopen +vim.api.nvim_create_autocmd('BufReadPost', { + callback = function() + local mark = vim.api.nvim_buf_get_mark(0, '"') + local line_count = vim.api.nvim_buf_line_count(0) + if mark[1] > 1 and mark[1] <= line_count then + vim.api.nvim_win_set_cursor(0, mark) + end + end, +}) + +-- highlight trailing whitespace +vim.cmd([[ + highlight ExtraWhitespace ctermbg=darkgreen guibg=lightgreen + match ExtraWhitespace /\s\+$/ +]]) + +vim.api.nvim_create_autocmd('BufWinEnter', { + callback = function() vim.cmd('match ExtraWhitespace /\\s\\+$/') end, +}) +vim.api.nvim_create_autocmd('InsertEnter', { + callback = function() vim.cmd('match ExtraWhitespace /\\s\\+\\%#\\@