Compare commits
15 Commits
311d6a678b
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
| 5691bd9fdc | |||
| 27c2569984 | |||
| c828dfc2e6 | |||
| feb789c989 | |||
| 67ffb18e03 | |||
| 019e8708d3 | |||
| ee10125402 | |||
| 19857722b4 | |||
| 00c1b647ea | |||
| 5b30acf596 | |||
| 5f61d1d4cd | |||
| 9c8892559d | |||
| 4e1ac03bfe | |||
| 497f1b1fa6 | |||
| 2d63016f8a |
3
.gitignore
vendored
Normal file
3
.gitignore
vendored
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
fish/*
|
||||||
|
!fish/config.fish
|
||||||
|
!fish/functions/*
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python3
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
#
|
#
|
||||||
# The MIT License (MIT)
|
# The MIT License (MIT)
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
#!/bin/bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
HASH="%C(yellow)%h%C(reset)"
|
HASH="%C(yellow)%h%C(reset)"
|
||||||
RELATIVE_TIME="%C(green)%ar%C(reset)"
|
RELATIVE_TIME="%C(green)%ar%C(reset)"
|
||||||
|
|||||||
28
capslock.ahk
Executable file
28
capslock.ahk
Executable 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
|
||||||
|
}
|
||||||
@@ -2,7 +2,9 @@ set -x DOTFILES $HOME/dotfiles
|
|||||||
|
|
||||||
if test -z "$FISH_SETUP_PATH"
|
if test -z "$FISH_SETUP_PATH"
|
||||||
set -xp PATH $HOME/.pyenv/bin
|
set -xp PATH $HOME/.pyenv/bin
|
||||||
|
set -xp PATH $HOME/.local/bin
|
||||||
set -xp PATH $HOME/dotfiles/bin
|
set -xp PATH $HOME/dotfiles/bin
|
||||||
|
set -xp PATH $HOME/bin
|
||||||
set -xp PATH .
|
set -xp PATH .
|
||||||
|
|
||||||
set -x FISH_SETUP_PATH
|
set -x FISH_SETUP_PATH
|
||||||
@@ -19,5 +21,14 @@ if type -q pyenv
|
|||||||
end
|
end
|
||||||
# pyenv virtualenv-init - | source
|
# pyenv virtualenv-init - | source
|
||||||
|
|
||||||
alias dc="docker-compose"
|
alias dc="docker compose"
|
||||||
|
alias dce="docker compose exec"
|
||||||
alias drh="docker run -it --rm -v (pwd):/usr/(pwd) -w /usr/(pwd)"
|
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
|
||||||
|
|
||||||
|
|||||||
@@ -1,13 +1,13 @@
|
|||||||
function fish_right_prompt
|
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
|
if test -z $ref
|
||||||
return
|
return
|
||||||
end
|
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'
|
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'
|
or set -l staged 'yes'
|
||||||
|
|
||||||
set_color normal
|
set_color normal
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
[user]
|
[user]
|
||||||
name = Thomas Lovén
|
name = Thomas Lovén
|
||||||
email = thomasloven@gmail.com
|
email = thomasloven@gmail.com
|
||||||
|
[init]
|
||||||
|
defaultBranch = main
|
||||||
[credential]
|
[credential]
|
||||||
helper = cache
|
helper = cache
|
||||||
[color]
|
[color]
|
||||||
|
|||||||
26
init.vim
26
init.vim
@@ -1,24 +1,45 @@
|
|||||||
|
" Display tab characters, trailing spaces and nbsp
|
||||||
set list
|
set list
|
||||||
set listchars=tab:→\ ,trail:␣,nbsp:⋅
|
set listchars=tab:→\ ,trail:␣,nbsp:⋅
|
||||||
|
|
||||||
|
" Remove unnecessary stuff from bottom of window
|
||||||
set noruler
|
set noruler
|
||||||
set laststatus=2
|
set laststatus=2
|
||||||
|
|
||||||
|
" Nice line numbers
|
||||||
set number
|
set number
|
||||||
set relativenumber
|
set relativenumber
|
||||||
|
|
||||||
|
" Spaces over tabs every day of the week (except in makefiles)
|
||||||
set expandtab
|
set expandtab
|
||||||
set tabstop=2
|
set tabstop=2
|
||||||
set shiftwidth=2
|
set shiftwidth=2
|
||||||
set softtabstop=2
|
set softtabstop=2
|
||||||
set smartindent
|
set smartindent
|
||||||
|
|
||||||
|
" Window navigation shortcuts
|
||||||
nnoremap <c-h> <c-w>h
|
nnoremap <c-h> <c-w>h
|
||||||
nnoremap <c-j> <c-w>j
|
nnoremap <c-j> <c-w>j
|
||||||
nnoremap <c-k> <c-w>k
|
nnoremap <c-k> <c-w>k
|
||||||
nnoremap <c-l> <c-w>l
|
nnoremap <c-l> <c-w>l
|
||||||
|
|
||||||
|
" ö for quick command access on Swedish keyboards
|
||||||
nnoremap ö :
|
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 ignorecase
|
||||||
set smartcase
|
set smartcase
|
||||||
set incsearch
|
set incsearch
|
||||||
@@ -30,3 +51,8 @@ nnoremap * *N
|
|||||||
noh
|
noh
|
||||||
|
|
||||||
set hidden
|
set hidden
|
||||||
|
|
||||||
|
" Uppercase last word on c-^
|
||||||
|
inoremap <C-]> <Esc>gUiw`]a
|
||||||
|
|
||||||
|
nnoremap <silent> § :NERDTreeToggle<CR>
|
||||||
|
|||||||
122
install.sh
122
install.sh
@@ -1,64 +1,112 @@
|
|||||||
#!/bin/bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
function install_dependencies() {
|
function install_pkg() {
|
||||||
|
if hash apt-get 2>/dev/null; then
|
||||||
sudo -n apt-get update
|
sudo -n apt-get update
|
||||||
sudo -n DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
|
sudo -n DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends ${@}
|
||||||
fish \
|
return
|
||||||
neovim
|
fi
|
||||||
|
|
||||||
|
if hash nix 2>/dev/null; then
|
||||||
|
echo "INSTALL ${@} yourself with nix"
|
||||||
|
return
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
function setup_ssh() {
|
function setup_ssh() {
|
||||||
|
configfile=~/.ssh/config
|
||||||
|
if grep -Fxq "# dotfiles installed" ${configfile}; then
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
mkdir -p ~/.ssh
|
mkdir -p ~/.ssh
|
||||||
touch ~/.ssh/config
|
touch ${configfile}
|
||||||
chmod 644 ~/.ssh/config
|
chmod 644 ${configfile}
|
||||||
|
cat << EOF >> ${configfile}
|
||||||
|
Include ${HOME}/dotfiles/ssh.config
|
||||||
|
# dotfiles installed
|
||||||
|
EOF
|
||||||
}
|
}
|
||||||
|
|
||||||
function setup_git() {
|
function setup_git() {
|
||||||
cat << EOF > ~/.gitconfig
|
configfile=~/.gitconfig
|
||||||
|
if grep -Fxq "# dotfiles installed" ${configfile}; then
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
|
cat << EOF > ${configfile}
|
||||||
[include]
|
[include]
|
||||||
path = ${HOME}/dotfiles/git/gitconfig
|
path = ${HOME}/dotfiles/git/gitconfig
|
||||||
[core]
|
[core]
|
||||||
excludesfile = ${HOME}/dotfiles/git/gitignore_global
|
excludesfile = ${HOME}/dotfiles/git/gitignore_global
|
||||||
|
# dotfiles installed
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
setup_ssh
|
setup_ssh
|
||||||
cat << EOF >> ~/.ssh/config
|
|
||||||
Host *
|
|
||||||
AddKeysToAgent yes
|
|
||||||
IdentityFile ~/.ssh/thomas_rsa
|
|
||||||
VisualHostKey yes
|
|
||||||
Host github.com
|
|
||||||
User git
|
|
||||||
Host gitea
|
|
||||||
HostName git.thomasloven.com
|
|
||||||
User git
|
|
||||||
EOF
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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`
|
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
|
if [[ ${REMOTE_CONTAINERS} || ${DEVCONTAINER} ]]; then
|
||||||
|
|
||||||
echo "INSTALLING IN DEVCONTAINER"
|
echo "INSTALLING IN DEVCONTAINER"
|
||||||
|
|
||||||
|
echo "set -x EDITOR code" >> ~/.config/fish/local.fish
|
||||||
|
|
||||||
|
else
|
||||||
|
setup_tmux
|
||||||
|
setup_nvim
|
||||||
fi
|
fi
|
||||||
|
|
||||||
install_dependencies
|
}
|
||||||
|
|
||||||
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
|
|
||||||
|
|
||||||
echo "sv_SE.UTF-8 UTF-8" | sudo tee -a /etc/locale.gen
|
|
||||||
sudo locale-gen
|
|
||||||
|
|
||||||
setup_ssh
|
|
||||||
setup_git
|
|
||||||
|
|
||||||
mkdir -p ~/.config/
|
|
||||||
ln -s ~/dotfiles/fish ~/.config/fish
|
|
||||||
mkdir -p ~/.config/nvim/
|
|
||||||
ln -s ~/dotfiles/init.vim ~/.config/nvim/init.vim
|
|
||||||
|
|
||||||
|
main $@
|
||||||
|
|||||||
8
ssh.config
Normal file
8
ssh.config
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
Host *
|
||||||
|
AddKeysToAgent yes
|
||||||
|
VisualHostKey yes
|
||||||
|
Host github.com
|
||||||
|
User git
|
||||||
|
Host gitea
|
||||||
|
HostName git.thomasloven.com
|
||||||
|
User git
|
||||||
@@ -1,9 +1,12 @@
|
|||||||
#!/bin/bash
|
#!/usr/bin/env bash
|
||||||
set -e
|
set -e
|
||||||
cd "$(dirname "$0")/.."
|
cd "$(dirname "$0")/.."
|
||||||
|
|
||||||
docker build . -t dotfiles -f test/Dockerfile.devcontainer --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
|
||||||
|
|||||||
13
vscode_settings.json
Normal file
13
vscode_settings.json
Normal 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
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user