Compare commits

..

19 Commits

Author SHA1 Message Date
5691bd9fdc Add vscode settings base 2025-10-14 00:19:03 +02:00
27c2569984 Add capslock autohotkey script 2025-07-09 23:28:06 +02:00
c828dfc2e6 Various small fixes 2024-12-27 00:47:42 +01:00
feb789c989 EXPERIMENTAL - installer changes for other systems 2024-12-24 23:47:24 +01:00
67ffb18e03 Fix for graphical uis 2024-12-18 22:06:43 +01:00
019e8708d3 Add some git plugins 2024-12-09 12:26:50 +01:00
ee10125402 Fix right prompt error redirection 2024-02-21 08:48:39 +01:00
19857722b4 Fix typo 2023-11-13 09:59:32 +01:00
00c1b647ea Remove fish vi-mode. Refactor dependency installation 2023-11-13 09:54:59 +01:00
5b30acf596 Remove key name from ssh config 2023-10-17 09:52:13 +02:00
5f61d1d4cd Comment vim init 2023-10-17 09:48:28 +02:00
9c8892559d Change git default name 2023-10-17 09:48:10 +02:00
4e1ac03bfe Add docker-compose exec alias 2023-10-17 09:47:54 +02:00
497f1b1fa6 Clening of setup script. Add ssh config 2023-10-17 09:47:25 +02:00
2d63016f8a Local fish overrides. Some path enhancements 2023-01-19 11:59:51 +01:00
311d6a678b Various tweaks 2021-11-16 18:21:23 +01:00
24ac06f925 Start updating install script 2021-11-15 20:05:04 +01:00
89eacee8c4 Add tmux config 2021-11-15 20:04:52 +01:00
85c3b5e36b Add pyenv support 2021-11-15 20:04:41 +01:00
15 changed files with 264 additions and 43 deletions

3
.gitignore vendored Normal file
View File

@@ -0,0 +1,3 @@
fish/*
!fish/config.fish
!fish/functions/*

View File

@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# The MIT License (MIT)

View File

@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
HASH="%C(yellow)%h%C(reset)"
RELATIVE_TIME="%C(green)%ar%C(reset)"

28
capslock.ahk Executable file
View File

@@ -0,0 +1,28 @@
#Requires AutoHotkey v2.0
SetCapsLockState "AlwaysOff"
Capslock::
{
Send "{LControl Down}"
KeyWait("CapsLock")
Send "{LControl Up}"
if ( A_PriorKey = "CapsLock" )
{
Send "{Esc}"
}
SetCapsLockState("Off")
}
::..date::
{
Send A_YYYY "-" A_MM "-" A_DD
Send A_EndChar
}
::..time::
{
Send A_Hour ":" A_Min
Send A_EndChar
}

View File

@@ -1,14 +1,34 @@
set -x DOTFILES $HOME/dotfiles
if test -z "$FISH_SETUP_PATH"
set -x PATH $HOME/dotfiles/bin $PATH
set -x PATH . $PATH
set -xp PATH $HOME/.pyenv/bin
set -xp PATH $HOME/.local/bin
set -xp PATH $HOME/dotfiles/bin
set -xp PATH $HOME/bin
set -xp PATH .
set -x FISH_SETUP_PATH
end
set -x LANG sv_SE.UTF-8
set -x LC_ALL sv_SE.UTF-8
set -x EDITOR nvim
alias v vim
set -x EDITOR nvim
alias v nvim
if type -q pyenv
pyenv init --path | source
end
# pyenv virtualenv-init - | source
alias dc="docker compose"
alias dce="docker compose exec"
alias drh="docker run -it --rm -v (pwd):/usr/(pwd) -w /usr/(pwd)"
# Include local config if present
if test -r $DOTFILES/fish/local.fish
source $DOTFILES/fish/local.fish
end

View File

@@ -1,13 +1,13 @@
function fish_right_prompt
set -l ref (git symbolic-ref HEAD ^/dev/null)
set -l ref (git symbolic-ref HEAD 2>/dev/null)
if test -z $ref
return
end
git diff --no-ext-diff --quiet --exit-code ^/dev/null
git diff --no-ext-diff --quiet --exit-code 2>/dev/null
or set -l dirty 'yes'
git diff-index --cached --quiet HEAD -- ^/dev/null
git diff-index --cached --quiet HEAD -- 2>/dev/null
or set -l staged 'yes'
set_color normal
@@ -21,7 +21,7 @@ function fish_right_prompt
set_color green
end
echo -sn (string replace refs/heads/ '' -- $ref)
set_color normal
echo -sn ']'
end
end

View File

@@ -1,6 +1,8 @@
[user]
name = Thomas Lovén
email = thomasloven@gmail.com
[init]
defaultBranch = main
[credential]
helper = cache
[color]

View File

@@ -1,24 +1,45 @@
" Display tab characters, trailing spaces and nbsp
set list
set listchars=tab:→\ ,trail:␣,nbsp:⋅
" Remove unnecessary stuff from bottom of window
set noruler
set laststatus=2
" Nice line numbers
set number
set relativenumber
" Spaces over tabs every day of the week (except in makefiles)
set expandtab
set tabstop=2
set shiftwidth=2
set softtabstop=2
set smartindent
" Window navigation shortcuts
nnoremap <c-h> <c-w>h
nnoremap <c-j> <c-w>j
nnoremap <c-k> <c-w>k
nnoremap <c-l> <c-w>l
" ö for quick command access on Swedish keyboards
nnoremap ö :
" Some navigation shortcuts for Swedish keyboards
nnoremap - `
nmap Å [
nmap å ]
omap Å [
omap å ]
xmap Å [
xmap å ]
noremap ÅÅ [[
noremap åå ]]
nnoremap <space>, <c-^>
nnoremap <tab> %
" Some searching options
set ignorecase
set smartcase
set incsearch
@@ -29,4 +50,9 @@ noremap / /\v
nnoremap * *N
noh
set hidden
set hidden
" Uppercase last word on c-^
inoremap <C-]> <Esc>gUiw`]a
nnoremap <silent> § :NERDTreeToggle<CR>

View File

@@ -1,37 +1,112 @@
#!/bin/bash
#!/usr/bin/env bash
sudo -n apt-get update
sudo -n DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
fish \
neovim
function install_pkg() {
if hash apt-get 2>/dev/null; then
sudo -n apt-get update
sudo -n DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends ${@}
return
fi
USER=`whoami`
sudo -n chsh $USER -s $(which fish)
echo "exec $(which fish) -l" >> ~/.profile
echo "exec $(which fish) -l" >> ~/.bashrc
echo "exec $(which fish) -l" >> ~/.zshrc
if hash nix 2>/dev/null; then
echo "INSTALL ${@} yourself with nix"
return
fi
}
echo "sv_SE.UTF-8 UTF-8" | sudo tee -a /etc/locale.gen
sudo locale-gen
function setup_ssh() {
configfile=~/.ssh/config
if grep -Fxq "# dotfiles installed" ${configfile}; then
return
fi
cat << EOF > ~/.gitconfig
mkdir -p ~/.ssh
touch ${configfile}
chmod 644 ${configfile}
cat << EOF >> ${configfile}
Include ${HOME}/dotfiles/ssh.config
# dotfiles installed
EOF
}
function setup_git() {
configfile=~/.gitconfig
if grep -Fxq "# dotfiles installed" ${configfile}; then
return
fi
cat << EOF > ${configfile}
[include]
path = ${HOME}/dotfiles/git/gitconfig
[core]
excludesfile = ${HOME}/dotfiles/git/gitignore_global
# dotfiles installed
EOF
mkdir -p ~/.ssh
cat << EOF > ~/.ssh/config
Host github.com
User git
Host gitea
HostName git.torpet.thomasloven.com
User git
EOF
chmod 644 ~/.ssh/config
setup_ssh
}
mkdir -p ~/.config/
ln -s ~/dotfiles/fish ~/.config/fish
mkdir -p ~/.config/nvim/
ln -s ~/dotfiles/init.vim ~/.config/nvim/init.vim
function setup_tmux() {
configfile=~/.tmux.conf
if grep -Fxq "# dotfiles installed" ${configfile}; then
return
fi
install_pkg tmux
cat << EOF > ${configfile}
source ${HOME}/dotfiles/tmux/tmux.conf
# dotfiles.installed
EOF
}
function setup_fish() {
install_pkg fish
USER=`whoami`
sudo -n chsh $USER -s $(which fish)
# Force fish shell for devcontainers
echo "exec $(which fish) -l" >> ~/.bashrc
echo "exec $(which fish) -l" >> ~/.zshrc
mkdir -p ~/.config/
ln -s ~/dotfiles/fish ~/.config/fish
}
function setup_nvim() {
install_pkg neovim
mkdir -p ~/.config/nvim/
ln -s ~/dotfiles/init.vim ~/.config/nvim/init.vim
# Install NERDtree plugin
git clone --single-branch https://github.com/preservim/nerdtree.git ~/.config/nvim/pack/vendor/start/nerdtree
git clone --single-branch https://tpope.io/vim/commentary.git ~/.config/nvim/pack/vendor/start/commentary
nvim -u NONE -c "helptags ~/.config/nvim/pack/vendor/start/nerdtree/doc" -c q
nvim -u NONE -c "helptags ~/.config/nvim/pack/vendor/start/commentary/doc" -c q
}
function main() {
install_pkg locales less
if [[ ${REMOTE_CONTAINERS} || ${DEVCONTAINER} ]]; then
echo "sv_SE.UTF-8 UTF-8" | sudo tee -a /etc/locale.gen
sudo locale-gen
fi
setup_fish
setup_ssh
setup_git
if [[ ${REMOTE_CONTAINERS} || ${DEVCONTAINER} ]]; then
echo "INSTALLING IN DEVCONTAINER"
echo "set -x EDITOR code" >> ~/.config/fish/local.fish
else
setup_tmux
setup_nvim
fi
}
main $@

8
ssh.config Normal file
View File

@@ -0,0 +1,8 @@
Host *
AddKeysToAgent yes
VisualHostKey yes
Host github.com
User git
Host gitea
HostName git.thomasloven.com
User git

View File

@@ -1,9 +1,12 @@
#!/bin/bash
#!/usr/bin/env bash
set -e
cd "$(dirname "$0")/.."
docker build . -t dotfiles -f test/Dockerfile --force-rm
docker build . -t dotfiles -f test/Dockerfile.devcontainer --force-rm
docker run --rm -it -v $(pwd):/workspaces/test dotfiles zsh
docker run --rm -it \
-v $(pwd):/workspaces/test \
-v $(dirname $SSH_AUTH_SOCK):$(dirname $SSH_AUTH_SOCK) -e SSH_AUTH_SOCK=$SSH_AUTH_SOCK\
dotfiles zsh
docker rmi dotfiles
docker rmi dotfiles

41
tmux/tmux.conf Normal file
View File

@@ -0,0 +1,41 @@
setw -g mode-keys vi
set -g default-terminal tmux-256color
set-option -g base-index 1
set-option -g prefix C-a
unbind C-b
bind a send-prefix
bind-key C-a last-window
unbind %
bind-key | split-window -h -c "#{pane_current_path}"
bind-key - split-window -v -c "#{pane_current_path}"
bind-key / split-window -h -c "#{pane_current_path}"
bind-key c neww -c "#{pane_current_path}"
bind-key h select-pane -L
bind-key j select-pane -D
bind-key k select-pane -U
bind-key l select-pane -R
bind-key k confirm-before -p "Kill window #w? (y/n)" kill-window
set -g mouse on
unbind Space
bind-key Space next-window
set -sg escape-time 50
set -g status-justify centre
set -g status-bg colour16
set -g status-left-length 100
set -g status-fg colour12
set -g status-left '#[fg=green]#(hostname -s)#[fg=colour12]:#[fg=colour12]#S '
set -g window-status-format '#[fg=colour12]#I:#W '
set -g window-status-current-format '#[fg=red]#I:#W#[fg=green]#F #[fg=colour12]'

13
vscode_settings.json Normal file
View File

@@ -0,0 +1,13 @@
{
"dev.containers.defaultExtensions": [
"spmeesseman.vscode-taskexplorer",
"github.vscode-pull-request-github"
],
"dotfiles.repository": "https://git.thomasloven.com/thomas/vsc-dotfiles.git",
"projectManager.tags": ["Personal", "Work", "cade", "hass"],
"diffEditor.ignoreTrimWhitespace": false,
"editor.formatOnSave": true,
"chat.agent.enabled": false,
"telemetry.feedback.enabled": false,
"telemetry.editStats.enabled": false
}

2
xprofile Normal file
View File

@@ -0,0 +1,2 @@
setxkbmap -option "ctrl:nocaps"
xcape -e 'Control_L=Escape'