Compare commits

...
Sign in to create a new pull request.

64 commits

Author SHA1 Message Date
f9e0d94412 ssh: conf.d: Update git-submodule for ssh config 2025-05-28 10:06:27 +02:00
476507e577 ssh: conf.d: Update git-submodule for ssh config 2024-12-28 11:19:03 +01:00
cd5171d7bd ssh: conf.d: Update git-submodule for ssh config 2024-08-06 21:43:28 +02:00
cdc6811415 gitconfig: add diff algorithm for sops-encrypted files 2024-01-24 17:17:55 +01:00
a118ced017 zshrc: Enable usage of additional local configuration 2023-11-16 22:51:52 +01:00
07e06558b6 config: nvim: update github-nvim-theme settings 2023-05-16 13:49:02 +02:00
Thomas Preisner
bf09d09da0 Xresources: add oxygen 2023-05-11 09:14:17 +02:00
e359380b15 config: nvim: configure cmp-path to disable trailing slashes 2023-03-30 23:10:31 +02:00
b56aecc78d config: nvim: require explicit selection to confirm completed itme 2023-03-30 23:08:18 +02:00
355ae60ac3 config: nvim: wildignore -= ".d" to allow completion of respectively suffixed directories 2023-03-30 20:48:34 +02:00
99f0c2df2d zsh: cleanup ignored-patterns for vim 2023-03-30 20:46:15 +02:00
dad208c7ba show failed login attempts for i3lock 2023-03-30 20:24:35 +02:00
7a52f633f4 zsh: split matcher into smaller matchers to fix matching
Starting with zsh version 5.9, the completion behavior changed slightly
(potentially due to the changed behavior of zstyle). As a result, The
matching was broken for directories with the same prefix followed by a
minus and further text (e.g. test-cut, test-bar).
2023-03-30 20:13:15 +02:00
53f83393dc config: nvim: nvim-cmp: consider all buffers as completion sources 2022-10-29 19:14:15 +02:00
0bcdd60bb3 config: nvim: cleanup wildignore 2022-10-29 19:12:54 +02:00
05f3e283db config: nvim: add telescope as fuzzy finder 2022-10-17 20:16:19 +02:00
d7def752af config: nvim: use 'rounded' border for packer and nvim-cmp 2022-10-17 20:03:28 +02:00
2c72b7c8dd config: nvim: add linter/formatter support 2022-10-17 20:03:12 +02:00
c058fa22ea config: nvim: add LSP support together with mason package manager 2022-10-17 20:03:12 +02:00
ab5cceddab config: nvim: use colorscheme dark_colorblind from github-nvim-theme
The currently used colorscheme 'vim-dichromatic' is missing support for
various neovim plugins.
2022-10-16 22:54:10 +02:00
2b78050f5f config: nvim: redefine leader key to space 2022-10-16 22:54:10 +02:00
f113cff6c2 config: nvim: add basic autocompletion and snippet collection 2022-10-16 22:54:10 +02:00
6863d4c2eb config: nvim: rewrite config in lua and use packer as plugin manager 2022-10-16 22:54:02 +02:00
07be5a4e7a separate vim config from nvim config again and simplify it
Separating vim's config from neovim's config simplifies the deployment
of lua for neovim's configuration. At the same time, clean up current
neovim config by removing all outdated options and options with equal or
even better defaults. Furthermore, the 'old' vim configuration should be
kept as-is to ensure compability with older systems if needed.
2022-10-14 23:30:30 +02:00
0819e4e95b ssh: conf.d: update git-submodule for ssh config 2022-09-21 17:10:35 +02:00
13f5ecd846 zsh: display some info about vcs in current directory 2022-09-18 18:01:32 +02:00
cfa621b864 config: nvim: general: remove old completion menu option
In preparation for neovim completion.
2022-09-18 17:04:28 +02:00
26d8a6b5b4 xinitrc: start automount-daemon udiskie if available 2022-09-18 17:04:25 +02:00
42274c8131 xinitrc: add output scaling on cipbuero4 2022-09-18 17:04:25 +02:00
39fe0e50bb config: i3: rename workspace '10' to 'A'
Switching to workspace '1' causes to also move workspace '10'.
2022-09-17 21:14:18 +02:00
7a178f24df config: i3status: display actual battery percentage 2022-09-06 15:11:35 +02:00
53cb41bbc5 config: i3: add blueman-applet and signal-desktop to "autostart" 2022-08-27 23:42:26 +02:00
913e7ff722 Xresources: use Source Code Pro on beryllium 2022-08-27 23:40:02 +02:00
e4ada8d5cd xinitrc: update regex for university hostnames 2022-08-27 21:16:24 +02:00
e9ca0baa3b gitconfig: add diff algorithm for ansible vaults 2022-08-27 21:05:28 +02:00
4b0e69c0a5 config: i3: specify fonts to be used for window titles and bar 2022-08-27 21:04:19 +02:00
d4022aecee remove occurences of old hostnames and replace with current hostnames
warthog (old macbook) does not exist anymore and falcon has been renamed
to beryllium
2022-08-27 20:59:41 +02:00
a4762ca7a2 config: nvim: add basic language server protocol support 2022-03-24 13:16:15 +01:00
3b83281feb config: i3: add keybinding for flameshot as screenshot tool 2022-03-22 15:48:30 +01:00
343219cfe2 config: i3: replace urxvt with alacritty
Seems to be faster and triggers less graphical glitches in conjunction
with gdb (examine).
2022-03-22 15:47:18 +01:00
3b9be5de6f xinitrc: set solid color as background color as fallback 2022-03-22 15:35:46 +01:00
b31a9fd908 .gitignore: ignore zsh cache 2022-03-22 15:34:09 +01:00
21af73483b zsh: aliases.zsh: add alias for better ip addr-output 2022-03-22 15:29:59 +01:00
c638a59499 zsh: completion.zsh: extend vim ignored-pattern to neovim 2022-03-22 15:24:58 +01:00
aaff09b15f gitconfig: use neovim as default editor 2022-03-18 18:00:08 +01:00
02d988ff04 gitignore: ignore (n)vim-plugins 2022-03-18 17:58:36 +01:00
3be7d5aec4 config: nvim: add vim-plug, vim-dichromatic and nvim-colorizer 2022-03-18 17:45:47 +01:00
8a3be75d1f config: nvim: general: move warning columns and make them less intrusive 2022-03-18 13:20:51 +01:00
62a306326d config: nvim: general: remove old config for pathogen 2022-03-18 13:19:34 +01:00
4a7a665edb zsh: use nvim instead of vim when available 2021-09-22 16:19:40 +02:00
d13d72ec80 config: nvim: split config into multiple files 2021-09-22 16:19:37 +02:00
846c204094 config: nvim: rework basic configuration 2021-09-22 16:18:15 +02:00
ef82f3b11f vimrc: transition to nvim 2021-09-22 16:18:10 +02:00
e4f4f8baf7 Xresources: make blue slightly brighter 2021-08-22 23:31:21 +02:00
76a42b6920 zsh: prompt.zsh: make entries with excessize permissions more readable 2021-08-22 23:28:07 +02:00
2fd4278bb6 gnupg: gpg-agent.conf: add pinentry-program 2021-08-22 23:27:11 +02:00
b730cf54fc config: i3status: add memory status 2021-08-22 23:27:11 +02:00
30275628ff setup.sh: add symlink for external ssh config 2021-08-22 23:27:11 +02:00
6c05cf1a98 ssh: config: externalize host configuration
Even though it may not be critical to have usernames, hostnames and the
respective ssh ports out in the open as they usually aren't secret, it
should still be avoided.
2021-04-24 14:33:53 +02:00
479ccc33f8 config: i3: make microphone mute binding use default_source 2021-04-08 23:43:18 +02:00
635f678ecb config: i3: make call to passmenu more generic (compatibility arch <-> debian) 2021-04-08 23:42:53 +02:00
d87a5138ee gitconfig: change default branch to "main" 2021-03-23 15:03:54 +01:00
f81ec0f6b3 config: i3: use brightnessctl 2021-01-22 13:32:53 +01:00
33ed56559d gitignore: ignore zsh history file 2021-01-22 12:56:17 +01:00
36 changed files with 932 additions and 217 deletions

3
.gitignore vendored Normal file
View file

@ -0,0 +1,3 @@
zsh/zsh_history
zsh/cache
config/nvim/plugin

3
.gitmodules vendored Normal file
View file

@ -0,0 +1,3 @@
[submodule "ssh/conf.d"]
path = ssh/conf.d
url = git@git.preisner.eu:preisi/ssh-config.git

View file

@ -1,5 +1,11 @@
URxvt.font: xft:Monospace:size=9:antialias=true
URxvt.boldFont: xft:Monospace:style=bold:size=9:antialias=true
! beryllium is arch-based with easy access to source code pro, let's use it
#if defined(SRVR_beryllium) || defined(SRVR_oxygen)
URxvt.font: xft:Source Code Pro:size=9:antialias=true
URxvt.boldFont: xft:Source Code Pro:style=bold:size=9:antialias=true
#else
URxvt.font: xft:Monospace:size=9:antialias=true
URxvt.boldFont: xft:Monospace:style=bold:size=9:antialias=true
#endif
URxvt.foreground: white
URxvt.background: black
URxvt.letterSpace: -1
@ -15,7 +21,7 @@ URxvt.shading: 20
URxvt.iso14755: false
URxvt.iso14755_52: false
#if defined(SRVR_falcon) || defined(SRVR_warthog) || defined(SRVR_cipbuero4)
#if defined(SRVR_beryllium) || defined(SRVR_cipbuero4) || defined(SRVR_oxygen)
Xft.dpi: 192
#endif
@ -49,7 +55,7 @@ Xft.rgba: rgb
*.color11: #fffd00
! blue
*.color4: #0026ff
*.color4: #0086ff
*.color12: #8470ff
!*.color12: #0000ff

View file

@ -16,8 +16,7 @@ monitor = sys.argv[1] if len(sys.argv) >= 2 else 0
(x, y, monitor_w, monitor_h) = hc.monitor_rect(monitor)
HiDPIHosts = set()
HiDPIHosts.add('falcon')
HiDPIHosts.add('warthog')
HiDPIHosts.add('beryllium')
HiDPIHosts.add('cipbuero4')
HiDPI = os.uname().nodename in HiDPIHosts

View file

@ -72,7 +72,7 @@ case "$HOSTNAME" in
;;
esac
if [ "$HOSTNAME" = warthog ] || [ "$HOSTNAME" = falcon ]; then
if [ "$HOSTNAME" = beryllium ]; then
hc keybind $Mod-d spawn /usr/bin/dmenu_run_hlwm -fn "Monospace-9"
hc keybind XF86MonBrightnessDown spawn xbacklight -4
hc keybind XF86MonBrightnessUp spawn xbacklight +4

View file

@ -11,7 +11,7 @@ fi
x=${geometry[0]}
y=${geometry[1]}
panel_width=${geometry[2]}
if [ "$HOSTNAME" = warthog ]; then
if [ "$HOSTNAME" = beryllium ]; then
panel_height=30
font="-*-fixed-medium-*-*-*-26-*-*-*-*-*-*-*"
iconpath=${HOME}/.config/herbstluftwm/icons_large
@ -90,7 +90,7 @@ function cpu() {
# BATTERY
function battery() {
if [ "$HOSTNAME" != warthog ]; then
if [ "$HOSTNAME" != beryllium ]; then
return
fi

View file

@ -6,7 +6,7 @@ set $mod Mod4
# Font for window titles. Will also be used by the bar unless a different font
# is used in the bar {} block below.
font pango:monospace 8
font pango:DejaVu Sans, FontAwesome 7
# This font is widely installed, provides lots of unicode glyphs, right-to-left
# text rendering and scalability on retina/hidpi displays (thanks to pango).
@ -24,7 +24,7 @@ floating_modifier $mod
# start a terminal
#bindsym $mod+Return exec i3-sensible-terminal
bindsym $mod+Return exec urxvt
bindsym $mod+Return exec alacritty
bindsym $mod+b exec chromium
@ -89,7 +89,10 @@ bindsym $mod+a focus parent
#bindsym $mod+d focus child
# custom bind for pass dmenu wrapper
bindsym $mod+p exec ~/bin/passmenu --type
bindsym $mod+p exec passmenu --type
# custom bind for flameshot screenshot tool
bindsym $mod+Shift+s exec flameshot gui
# do not focus container behind mouse
focus_follows_mouse no
@ -105,7 +108,7 @@ set $ws6 "6"
set $ws7 "7"
set $ws8 "8"
set $ws9 "9"
set $ws10 "10"
set $ws10 "A"
# switch to workspace
bindsym $mod+1 [workspace=$ws1] move workspace to output current, workspace $ws1
@ -136,7 +139,7 @@ bindsym $mod+Alt+c reload
# restart i3 inplace (preserves your layout/session, can be used to upgrade i3)
bindsym $mod+Shift+r restart
# exit i3 (logs you out of your X session)
bindsym $mod+q exec i3lock
bindsym $mod+q exec i3lock --nofork --show-failed-attempts
bindsym $mod+Shift+q exit
# resize window (you can also use the mouse for that)
@ -170,19 +173,21 @@ bindsym $mod+r mode "resize"
bindsym XF86AudioMute exec "pactl set-sink-mute @DEFAULT_SINK@ toggle"
bindsym XF86AudioLowerVolume exec "pactl set-sink-mute @DEFAULT_SINK@ false && pactl set-sink-volume @DEFAULT_SINK@ '-5%'"
bindsym XF86AudioRaiseVolume exec "pactl set-sink-mute @DEFAULT_SINK@ false && pactl set-sink-volume @DEFAULT_SINK@ '+5%'"
bindsym XF86AudioMicMute exec "pactl set-source-mute 1 toggle"
bindsym XF86AudioMicMute exec "pactl set-source-mute @DEFAULT_SOURCE@ toggle"
bindsym XF86MonBrightnessDown exec "xbacklight -4"
bindsym XF86MonBrightnessUp exec "xbacklight +4"
bindsym XF86MonBrightnessDown exec "brightnessctl set 4%-"
bindsym XF86MonBrightnessUp exec "brightnessctl set 4%+"
# Start i3bar to display a workspace bar (plus the system information i3status
# finds out, if available)
bar {
position top
status_command i3status
font pango:DejaVu Sans, FontAwesome 8
font pango:DejaVu Sans, FontAwesome 7
}
exec --no-startup-id redshift
exec --no-startup-id nm-applet
exec --no-startup-id dunst
exec --no-startup-id blueman-applet
exec --no-startup-id signal-desktop --start-in-tray

View file

@ -11,11 +11,15 @@ general {
interval = 5
}
order += "memory"
order += "cpu_temperature 0"
order += "cpu_usage"
order += "battery all"
order += "tztime local"
memory {
format = " %percentage_used"
}
cpu_temperature 0 {
format = " %degrees°C"
@ -33,6 +37,7 @@ battery all {
status_unk = " UNK"
status_full = " FULL"
low_threshold = 10
last_full_capacity = true
}
tztime local {

3
config/nvim/init.lua Normal file
View file

@ -0,0 +1,3 @@
require('general')
require('keybindings')
require('plugins')

View file

@ -0,0 +1,81 @@
-- reduce boilerplate by defining some shortcuts
local opt = vim.opt
local cmd = vim.cmd
local autocmd = vim.api.nvim_create_autocmd
--------------------
-- General
--------------------
opt.mouse = 'n' -- enable mouse support in normal mode
opt.clipboard = 'unnamedplus' -- copy/paste to and from system clipboard
opt.wildmode = 'list:longest,full'
opt.wildignorecase = true
-- ignore C/C++ objects and other build files
opt.wildignore = '*.o,*.so,*.out'
-- ignore java classes
opt.wildignore:append '*.class'
-- ignore python cache files
opt.wildignore:append '*.pyc'
-- ignore tex-related build files
opt.wildignore:append '*.aux,*.bcf,*.lof,*.lol,*.lot,*.rubbercache,*.toc,*.pdf'
opt.fileformats = 'unix,dos' -- use identical lineendings for all platforms
opt.secure = true -- disable autocmd for security reasons
--------------------
-- Tabs
--------------------
opt.tabstop = 4 -- 1 tab == N spaces
opt.shiftwidth = 4 -- shift N spaces when pressing tab
opt.smartindent = true -- take syntax into account for applying indentation
--------------------
-- Search
--------------------
opt.ignorecase = true -- ignore capitalization on search
opt.smartcase = true -- ignore capitalication unless word contains a capital
opt.iskeyword:append '-' -- treat hyphenated words as a single word
--------------------
-- Neovim UI
--------------------
opt.number = true -- line numbers
opt.ruler = true -- cursor position in statusbar
opt.showtabline = 2 -- always show vim tabs
opt.showcmd = true -- display currently typed command
opt.termguicolors = true -- enable 24-bit RGB color
-- highlight line at which the cursor is positioned
opt.cursorline = true
cmd 'highlight CursorLine term=bold cterm=bold'
cmd 'highlight CursorLineNR term=bold cterm=bold ctermbg=darkgrey'
-- display warning column at 81 and 121
opt.colorcolumn = '81,121'
cmd 'highlight ColorColumn ctermbg=235 guibg=#2d2d2d'
opt.splitright = true -- horizontal split to the right
opt.splitbelow = true -- vertical split to the bottom
-- define characters to display when using 'set list'
opt.listchars = 'tab:→ ,trail:∙,eol:¬,extends:,precedes:,nbsp:␣'
--------------------
-- Performance
--------------------
opt.hidden = true -- allow buffers with changes to be hidden
opt.updatetime = 300 -- delay (in ms) to wait before triggering event
opt.timeoutlen = 500 -- time (in ms) to wait for event to complete
opt.history = 10000 -- remember N lines of history
--------------------
-- Misc
--------------------
-- remove redundant whitespaces on save
autocmd('BufWritePre', {
pattern = '*',
command = ':%s/\\s\\+$//e'
})

View file

@ -0,0 +1,8 @@
local map = require('utils').map -- import map
-- redefine leader key
vim.g.mapleader = ' '
-- allow switching between buffers using tab and Shift-tab
map('n', '<TAB>', ':bnext<CR>')
map('n', '<S-TAB>', ':bprevious<CR>')

173
config/nvim/lua/plugins.lua Normal file
View file

@ -0,0 +1,173 @@
--------------------
-- Packer Bootstrap
--------------------
local packer_installed, _ = pcall(require, 'packer')
local packer_bootstrap = false
if (not packer_installed) then
-- ask user whether packer should be bootstrapped
packer_bootstrap = require('utils').prompt(
'Plugin manager packer not found. Install it now?',
'Bootstrapping packer now...',
'Skipping setup of packer and plugins.')
if (not packer_bootstrap) then
return
end
-- perform actual bootstrap
local fn = vim.fn
local install_path = fn.stdpath('data') .. '/site/pack/packer/start/packer.nvim'
fn.system({'git', 'clone', '--depth', '1', 'https://github.com/wbthomason/packer.nvim', install_path})
vim.cmd('packadd packer.nvim')
end
-- helper function to be used `config` parameter of packer's use to externalize
-- plugin configuration, expects the name of the config file
function load_config(name)
return string.format('require("plugins/%s")', name)
end
return require('packer').startup({
function(use)
use 'wbthomason/packer.nvim'
--------------------
-- Visuals
--------------------
use { -- colorblind-friendly colorscheme
'projekt0n/github-nvim-theme',
config = load_config('github-nvim-theme'),
}
use { -- color highlighter
'norcalli/nvim-colorizer.lua',
config = function() require('colorizer').setup() end,
}
--------------------
-- Package Manager
--------------------
use { -- portable package manager
'williamboman/mason.nvim',
config = load_config('mason'),
}
use { -- update helper for mason
'WhoIsSethDaniel/mason-tool-installer.nvim',
after = { 'mason.nvim' },
config = function() require('mason-tool-installer').setup({}) end,
}
--------------------
-- LSP Setup
--------------------
use { -- compatibility layer between mason and lspconfig + autoinstaller
'williamboman/mason-lspconfig.nvim',
after = { 'mason.nvim' },
requires = {
'neovim/nvim-lspconfig',
},
}
use { -- configuration layer for neovim LSP client
'neovim/nvim-lspconfig',
after = {
'mason-lspconfig.nvim',
'cmp-nvim-lsp',
},
config = load_config('lspconfig'),
}
--------------------
-- Linter/Formatter
--------------------
use { -- linter and formatter manager
'jose-elias-alvarez/null-ls.nvim',
after = {
'mason.nvim',
'plenary.nvim',
},
requires = { 'nvim-lua/plenary.nvim' },
}
use { -- compatibility layer between mason and null-ls
'jayp0521/mason-null-ls.nvim',
after = { 'null-ls.nvim' },
config = load_config('null-ls')
}
--------------------
-- Snippets
--------------------
use { -- snippet engine
'L3MON4D3/LuaSnip',
requires = {
'saadparwaiz1/cmp_luasnip',
'rafamadriz/friendly-snippets',
},
}
use { -- various snippets
'rafamadriz/friendly-snippets',
after = { 'LuaSnip' },
config = load_config('friendly-snippets'),
}
--------------------
-- Completion
--------------------
use { -- nvim-cmp source for nvim-lsp
'hrsh7th/cmp-nvim-lsp',
requires = { 'hrsh7th/nvim-cmp' },
}
use { -- nvim-cmp source for LuaSnip
'saadparwaiz1/cmp_luasnip',
requires = { 'hrsh7th/nvim-cmp' },
after = { 'LuaSnip' },
}
use { -- nvim-cmp source for buffer words
'hrsh7th/cmp-buffer',
requires = { 'hrsh7th/nvim-cmp' },
}
use { -- nvim-cmp source for filesystem paths
'hrsh7th/cmp-path',
requires = { 'hrsh7th/nvim-cmp' },
}
use { -- nvim-cmp source for vim's cmdline
'hrsh7th/cmp-cmdline',
requires = { 'hrsh7th/nvim-cmp' },
}
use { -- completion engine
'hrsh7th/nvim-cmp',
after = {
'cmp-nvim-lsp',
'cmp-buffer',
'cmp-path',
'cmp-cmdline',
'cmp_luasnip'
},
config = load_config('nvim-cmp'),
}
--------------------
-- Misc Utilities
--------------------
use { -- fuzzy finder
'nvim-telescope/telescope.nvim',
config = load_config('telescope'),
requires = {'nvim-lua/plenary.nvim'},
}
-- Automatically set up your configuration after cloning packer.nvim
-- Put this at the end after all plugins
if packer_bootstrap then
require('packer').sync()
end
end,
config = {
display = {
open_fn = function()
return require('packer.util').float({ border = 'rounded' })
end,
},
profile = {
enable = true,
threshold = 1, -- the amount in ms that a plugins load time must be over for it to be included in the profile
},
},
})

View file

@ -0,0 +1 @@
require('luasnip.loaders.from_vscode').lazy_load()

View file

@ -0,0 +1,7 @@
require('github-theme').setup({
options = {
transparent = true,
},
})
vim.cmd.colorscheme('github_dark_colorblind')

View file

@ -0,0 +1,24 @@
local map = require('utils').map -- import map
require('mason-lspconfig').setup()
require('mason-lspconfig').setup_handlers({
function(server_name) -- default handler
-- prepare nvim-cmp source
local capabilities = require('cmp_nvim_lsp').default_capabilities()
require('lspconfig')[server_name].setup({
-- announce nvim-cmp-lsp capabilities to each lsp server
capabilities = capabilities
})
end
})
-- lsp keybindings
map('n', 'gd', '<cmd>lua vim.lsp.buf.definition()<CR>')
map('n', 'gD', '<cmd>lua vim.lsp.buf.declaration()<CR>')
map('n', 'K', '<cmd>lua vim.lsp.buf.hover()<CR>')
map('n', 'gi', '<cmd>lua vim.lsp.buf.implementation()<CR>')
map('n', 'gr', '<cmd>lua vim.lsp.buf.references()<CR>')
map('n', '<C-k>', '<cmd>lua vim.lsp.buf.signature_help()<CR>')
map('n', '<leader>rn', '<cmd>lua vim.lsp.buf.rename()<CR>')
map('n', '<leader>ca', '<cmd>lua vim.lsp.buf.code_action()<CR>')
map('n', '<leader>f', '<cmd>lua vim.lsp.buf.type_definition({ async = true })<CR>')

View file

@ -0,0 +1,9 @@
require('mason').setup({
ui = {
icons = {
package_installed = '',
package_pending = '',
package_uninstalled = '',
},
},
})

View file

@ -0,0 +1,2 @@
require('null-ls').setup()
require('mason-null-ls').setup()

View file

@ -0,0 +1,78 @@
vim.opt.completeopt = 'menu,menuone,noselect'
local cmp = require('cmp')
cmp.setup({
snippet = {
expand = function(args)
require('luasnip').lsp_expand(args.body)
end,
},
formatting = {
format = function(entry, vim_item)
vim_item.menu = ({
nvim_lsp = '[LSP]',
buffer = '[Buffer]',
luasnip = '[Snippet]',
})[entry.source.name]
return vim_item
end,
},
window = {
completion = cmp.config.window.bordered({ border = 'rounded' }),
documentation = cmp.config.window.bordered({ border = 'rounded' }),
},
mapping = cmp.mapping.preset.insert({
['<C-b>'] = cmp.mapping.scroll_docs(-4),
['<C-f>'] = cmp.mapping.scroll_docs(4),
['<C-Space>'] = cmp.mapping.complete(),
['<C-e>'] = cmp.mapping.abort(),
['<CR>'] = cmp.mapping.confirm({ select = false }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items.
}),
sources = cmp.config.sources({
{ name = 'nvim_lsp', keyword_length = 3 },
{ name = 'luasnip', keyword_length = 2 },
}, {
{
name = 'buffer',
keyword_length = 3,
option = {
get_bufnrs = function()
return vim.api.nvim_list_bufs()
end,
},
},
})
})
-- configure completion for specific filetype
cmp.setup.filetype('gitcommit', {
sources = cmp.config.sources({
{ name = 'buffer' },
}),
})
-- use buffer source for `/` and `?` (if you enabled `native_menu`, this won't
-- work anymore)
cmp.setup.cmdline({ '/', '?' }, {
mapping = cmp.mapping.preset.cmdline(),
sources = {
{ name = 'buffer' }
},
})
-- use cmdline & path source for ':' (if you enabled `native_menu`, this won't
-- work anymore).
cmp.setup.cmdline(':', {
mapping = cmp.mapping.preset.cmdline(),
sources = cmp.config.sources({
{
name = 'path',
option = {
trailing_slash = false,
label_trailing_slash = false,
}
}
}, {
{ name = 'cmdline' }
}),
})

View file

@ -0,0 +1,7 @@
local map = require('utils').map -- import map
-- telescope keybindings
map('n', 'ff', '<cmd>Telescope find_files<CR>')
map('n', 'fg', '<cmd>Telescope live_grep<CR>')
map('n', 'fb', '<cmd>Telescope buffers<CR>')
map('n', 'fh', '<cmd>Telescope help_tags<CR>')

30
config/nvim/lua/utils.lua Normal file
View file

@ -0,0 +1,30 @@
local M = {}
-- keybinding mapper
function M.map(mode, lhs, rhs, opts)
local options = { noremap = true, silent = true }
if opts then
options = vim.tbl_extend('force', options, opts)
end
vim.api.nvim_set_keymap(mode, lhs, rhs, options)
end
-- simple prompt
function M.prompt(msg, accept_msg, deny_msg)
local answer = vim.fn.input(msg .. ' (YES/no) ')
while(true) do
-- clear vim cmdline before printing anything
vim.cmd('mode')
if answer == 'YES' then
print(accept_msg)
return true
elseif string.lower(answer) == 'no' then
print(deny_msg)
return false
end
-- re-request user input
answer = vim.fn.input('Please retry: ' .. msg .. ' (YES/no) ')
end
end
return M

View file

@ -2,7 +2,7 @@
email = mail@tpreisner.de
name = Thomas Preisner
[core]
editor = vim
editor = nvim
[commit]
verbose = true
[alias]
@ -20,3 +20,9 @@
s = status
st = status
t = tag
[init]
defaultBranch = main
[diff "ansible-vault"]
textconv = "ansible-vault view"
[diff "sopsdiffer"]
textconv = "sops --config /dev/null --decrypt"

View file

@ -4,3 +4,5 @@ default-cache-ttl 600
max-cache-ttl 3600
grab
pinentry-program /usr/bin/pinentry-gnome3

View file

@ -48,7 +48,15 @@ if installed vim; then
echo "Setting up vim:"
link vimrc ~/.vimrc
#link vim ~/.vim
link vim ~/.vim
echo
fi
if installed nvim; then
echo "Setting up nvim:"
mkdir -p ~/.config
link config/nvim ~/.config/nvim
echo
fi
@ -83,6 +91,7 @@ if installed ssh; then
mkdir -p ~/.ssh
link ssh/config ~/.ssh/config
link ssh/conf.d ~/.ssh/conf.d
echo
fi

1
ssh/conf.d Submodule

@ -0,0 +1 @@
Subproject commit e322403a55ca26a907da9e92a50316a14cf87898

View file

@ -3,44 +3,10 @@
Host *
AddKeysToAgent confirm
Host 0?? 0???
HostName faui%h.informatik.uni-erlangen.de
ForwardAgent yes
# Include external config if available
Include conf.d/*
Host faui0? faui0?? faui0???
HostName %h.informatik.uni-erlangen.de
ForwardAgent yes
Host man? man?? big?
HostName faui49%h.informatik.uni-erlangen.de
ProxyJump ty28wuqu@i4lab1.informatik.uni-erlangen.de
Match Host faui*
User ty28wuqu
Host ircbox
HostName ircbox.informatik.uni-erlangen.de
User ty28wuqu
Host irc
HostName tpreisner.de
User weechat
Host server
HostName tpreisner.de
User root
Host steep
Hostname steep.cs.fau.de
User preisi
Port 17
Host pi
HostName wg.tpreisner.de
# dynamic ip behind hostname would cause warnings
CheckHostIP no
# use if they havent been defined yet:
# Use if they havent been defined yet:
Host *
Compression yes
ForwardAgent no

161
vim/colors/dichromatic.vim Normal file
View file

@ -0,0 +1,161 @@
" dichromatic.vim -- Vim color scheme.
" Author: Romain Lafourcade (romainlafourcade@gmail.com)
" Webpage: https://raw.githubusercontent.com/romainl/vim-dichromatic/master/colors/dichromatic.vim
" Description: A 'dark' colorscheme for color blind vimmers. But not only.
hi clear
if exists("syntax_on")
syntax reset
endif
let colors_name = "dichromatic"
if ($TERM =~ '256' || &t_Co >= 256) || has("gui_running")
hi Normal ctermbg=232 ctermfg=252 cterm=NONE guibg=#080808 guifg=#D0D0D0 gui=NONE
hi NonText ctermbg=NONE ctermfg=240 cterm=NONE guibg=NONE guifg=#585858 gui=NONE
hi Comment ctermbg=NONE ctermfg=244 cterm=NONE guibg=NONE guifg=#808080 gui=NONE
hi Constant ctermbg=NONE ctermfg=168 cterm=NONE guibg=NONE guifg=#D75F87 gui=NONE
hi Error ctermbg=15 ctermfg=89 cterm=reverse guibg=#FFFFFF guifg=#87005F gui=reverse
hi Identifier ctermbg=NONE ctermfg=133 cterm=NONE guibg=NONE guifg=#AF5FAF gui=NONE
hi Ignore ctermbg=NONE ctermfg=NONE cterm=NONE guibg=NONE guifg=NONE gui=NONE
hi PreProc ctermbg=NONE ctermfg=186 cterm=NONE guibg=NONE guifg=#DFDF87 gui=NONE
hi Special ctermbg=NONE ctermfg=15 cterm=NONE guibg=NONE guifg=#FFFFFF gui=NONE
hi Statement ctermbg=NONE ctermfg=133 cterm=NONE guibg=NONE guifg=#AF5FAF gui=NONE
hi String ctermbg=NONE ctermfg=142 cterm=NONE guibg=NONE guifg=#AFAF00 gui=NONE
hi Todo ctermbg=NONE ctermfg=NONE cterm=reverse guibg=NONE guifg=NONE gui=reverse
hi Type ctermbg=NONE ctermfg=116 cterm=NONE guibg=NONE guifg=#87D7D7 gui=NONE
hi Underlined ctermbg=NONE ctermfg=NONE cterm=underline guibg=NONE guifg=NONE gui=underline
hi Number ctermbg=NONE ctermfg=168 cterm=NONE guibg=NONE guifg=#D75F87 gui=NONE
hi StatusLine ctermbg=15 ctermfg=240 cterm=NONE guibg=#FFFFFF guifg=#585858 gui=NONE
hi StatusLineNC ctermbg=240 ctermfg=15 cterm=NONE guibg=#585858 guifg=#FFFFFF gui=NONE
hi VertSplit ctermbg=240 ctermfg=240 cterm=NONE guibg=#585858 guifg=#585858 gui=NONE
hi TabLine ctermbg=240 ctermfg=15 cterm=NONE guibg=#585858 guifg=#FFFFFF gui=NONE
hi TabLineFill ctermbg=240 ctermfg=240 cterm=NONE guibg=#585858 guifg=#585858 gui=NONE
hi TabLineSel ctermbg=15 ctermfg=240 cterm=NONE guibg=#FFFFFF guifg=#585858 gui=NONE
hi Title ctermbg=NONE ctermfg=72 cterm=NONE guibg=NONE guifg=#5FAF87 gui=NONE
hi LineNr ctermbg=NONE ctermfg=116 cterm=NONE guibg=NONE guifg=#87D7D7 gui=NONE
hi Cursor ctermbg=15 ctermfg=232 cterm=NONE guibg=#FFFFFF guifg=#080808 gui=NONE
hi CursorColumn ctermbg=89 ctermfg=NONE cterm=NONE guibg=#87005F guifg=NONE gui=NONE
hi CursorLine ctermbg=236 ctermfg=NONE cterm=NONE guibg=#303030 guifg=NONE gui=NONE
hi CursorLineNr ctermbg=236 ctermfg=NONE cterm=NONE guibg=#303030 guifg=NONE gui=NONE
hi helpLeadBlank ctermbg=NONE ctermfg=NONE cterm=NONE guibg=NONE guifg=NONE gui=NONE
hi helpNormal ctermbg=NONE ctermfg=NONE cterm=NONE guibg=NONE guifg=NONE gui=NONE
hi Visual ctermbg=116 ctermfg=232 cterm=NONE guibg=#87D7D7 guifg=#080808 gui=NONE
hi VisualNOS ctermbg=133 ctermfg=232 cterm=NONE guibg=#AF5FAF guifg=#080808 gui=NONE
hi Pmenu ctermbg=186 ctermfg=232 cterm=NONE guibg=#DFDF87 guifg=#080808 gui=NONE
hi PmenuSbar ctermbg=142 ctermfg=186 cterm=NONE guibg=#AFAF00 guifg=#DFDF87 gui=NONE
hi PmenuSel ctermbg=133 ctermfg=232 cterm=NONE guibg=#AF5FAF guifg=#080808 gui=NONE
hi PmenuThumb ctermbg=133 ctermfg=133 cterm=NONE guibg=#AF5FAF guifg=#AF5FAF gui=NONE
hi FoldColumn ctermbg=NONE ctermfg=72 cterm=NONE guibg=NONE guifg=#5FAF87 gui=NONE
hi Folded ctermbg=NONE ctermfg=248 cterm=NONE guibg=NONE guifg=#A8A8A8 gui=NONE
hi WildMenu ctermbg=53 ctermfg=15 cterm=NONE guibg=#00005F guifg=#FFFFFF gui=NONE
hi SpecialKey ctermbg=NONE ctermfg=186 cterm=NONE guibg=NONE guifg=#DFDF87 gui=NONE
hi DiffAdd ctermbg=232 ctermfg=111 cterm=reverse guibg=#080808 guifg=#87afff gui=reverse
hi DiffChange ctermbg=232 ctermfg=188 cterm=reverse guibg=#080808 guifg=#dfdfdf gui=reverse
hi DiffDelete ctermbg=232 ctermfg=222 cterm=reverse guibg=#080808 guifg=#ffdf87 gui=reverse
hi DiffText ctermbg=232 ctermfg=145 cterm=reverse guibg=#080808 guifg=#afafaf gui=reverse
hi IncSearch ctermbg=232 ctermfg=133 cterm=reverse guibg=#080808 guifg=#AF5FAF gui=reverse
hi Search ctermbg=186 ctermfg=232 cterm=NONE guibg=#DFDF87 guifg=#080808 gui=NONE
hi Directory ctermbg=NONE ctermfg=72 cterm=NONE guibg=NONE guifg=#5FAF87 gui=NONE
hi MatchParen ctermbg=240 ctermfg=186 cterm=NONE guibg=#585858 guifg=#DFDF87 gui=NONE
hi SpellBad ctermbg=89 ctermfg=232 cterm=NONE guibg=#87005F guifg=#080808 gui=NONE guisp=#87005F
hi SpellCap ctermbg=72 ctermfg=232 cterm=NONE guibg=#5FAF87 guifg=#080808 gui=NONE guisp=#5FAF87
hi SpellLocal ctermbg=142 ctermfg=232 cterm=NONE guibg=#AFAF00 guifg=#080808 gui=NONE guisp=#AFAF00
hi SpellRare ctermbg=133 ctermfg=232 cterm=NONE guibg=#AF5FAF guifg=#080808 gui=NONE guisp=#AF5FAF
hi ColorColumn ctermbg=133 ctermfg=NONE cterm=NONE guibg=#AF5FAF guifg=NONE gui=NONE
hi signColumn ctermbg=NONE ctermfg=186 cterm=NONE guibg=NONE guifg=#DFDF87 gui=NONE
hi ErrorMsg ctermbg=89 ctermfg=15 cterm=NONE guibg=#87005F guifg=#FFFFFF gui=NONE
hi ModeMsg ctermbg=142 ctermfg=232 cterm=NONE guibg=#AFAF00 guifg=#080808 gui=NONE
hi MoreMsg ctermbg=NONE ctermfg=142 cterm=NONE guibg=NONE guifg=#AFAF00 gui=NONE
hi Question ctermbg=NONE ctermfg=72 cterm=NONE guibg=NONE guifg=#5FAF87 gui=NONE
hi WarningMsg ctermbg=168 ctermfg=232 cterm=NONE guibg=#D75F87 guifg=#080808 gui=NONE
hi QuickFixLine ctermbg=15 ctermfg=240 cterm=NONE guibg=#FFFFFF guifg=#585858 gui=NONE
elseif &t_Co == 8 || $TERM !~# '^linux' || &t_Co == 16
set t_Co=16
hi Normal ctermbg=black ctermfg=grey cterm=NONE
hi NonText ctermbg=NONE ctermfg=darkgrey cterm=NONE
hi Comment ctermbg=NONE ctermfg=darkgrey cterm=NONE
hi Constant ctermbg=NONE ctermfg=red cterm=NONE
hi Error ctermbg=white ctermfg=darkmagenta cterm=reverse
hi Identifier ctermbg=NONE ctermfg=darkred cterm=NONE
hi Ignore ctermbg=NONE ctermfg=NONE cterm=NONE
hi PreProc ctermbg=NONE ctermfg=yellow cterm=NONE
hi Special ctermbg=NONE ctermfg=white cterm=NONE
hi Statement ctermbg=NONE ctermfg=darkred cterm=NONE
hi String ctermbg=NONE ctermfg=darkyellow cterm=NONE
hi Todo ctermbg=NONE ctermfg=NONE cterm=reverse
hi Type ctermbg=NONE ctermfg=cyan cterm=NONE
hi Underlined ctermbg=NONE ctermfg=NONE cterm=underline
hi Number ctermbg=NONE ctermfg=red cterm=NONE
hi StatusLine ctermbg=white ctermfg=darkgrey cterm=NONE
hi StatusLineNC ctermbg=darkgrey ctermfg=white cterm=NONE
hi VertSplit ctermbg=darkgrey ctermfg=darkgrey cterm=NONE
hi TabLine ctermbg=darkgrey ctermfg=white cterm=NONE
hi TabLineFill ctermbg=darkgrey ctermfg=darkgrey cterm=NONE
hi TabLineSel ctermbg=white ctermfg=darkgrey cterm=NONE
hi Title ctermbg=NONE ctermfg=green cterm=NONE
hi LineNr ctermbg=NONE ctermfg=cyan cterm=NONE
hi Cursor ctermbg=white ctermfg=black cterm=NONE
hi CursorColumn ctermbg=darkmagenta ctermfg=NONE cterm=NONE
hi CursorLine ctermbg=black ctermfg=NONE cterm=NONE
hi CursorLineNr ctermbg=black ctermfg=NONE cterm=NONE
hi helpLeadBlank ctermbg=NONE ctermfg=NONE cterm=NONE
hi helpNormal ctermbg=NONE ctermfg=NONE cterm=NONE
hi Visual ctermbg=cyan ctermfg=black cterm=NONE
hi VisualNOS ctermbg=darkred ctermfg=black cterm=NONE
hi Pmenu ctermbg=yellow ctermfg=black cterm=NONE
hi PmenuSbar ctermbg=darkyellow ctermfg=yellow cterm=NONE
hi PmenuSel ctermbg=darkred ctermfg=black cterm=NONE
hi PmenuThumb ctermbg=darkred ctermfg=darkred cterm=NONE
hi FoldColumn ctermbg=NONE ctermfg=green cterm=NONE
hi Folded ctermbg=NONE ctermfg=grey cterm=NONE
hi WildMenu ctermbg=darkblue ctermfg=white cterm=NONE
hi SpecialKey ctermbg=NONE ctermfg=yellow cterm=NONE
hi DiffAdd ctermbg=black ctermfg=blue cterm=reverse
hi DiffChange ctermbg=black ctermfg=grey cterm=reverse
hi DiffDelete ctermbg=black ctermfg=yellow cterm=reverse
hi DiffText ctermbg=black ctermfg=darkgray cterm=reverse
hi IncSearch ctermbg=black ctermfg=darkred cterm=reverse
hi Search ctermbg=yellow ctermfg=black cterm=NONE
hi Directory ctermbg=NONE ctermfg=green cterm=NONE
hi MatchParen ctermbg=darkgrey ctermfg=yellow cterm=NONE
hi SpellBad ctermbg=darkmagenta ctermfg=black cterm=NONE
hi SpellCap ctermbg=green ctermfg=black cterm=NONE
hi SpellLocal ctermbg=darkyellow ctermfg=black cterm=NONE
hi SpellRare ctermbg=darkred ctermfg=black cterm=NONE
hi ColorColumn ctermbg=darkred ctermfg=NONE cterm=NONE
hi signColumn ctermbg=NONE ctermfg=yellow cterm=NONE
hi ErrorMsg ctermbg=darkmagenta ctermfg=white cterm=NONE
hi ModeMsg ctermbg=darkyellow ctermfg=black cterm=NONE
hi MoreMsg ctermbg=NONE ctermfg=darkyellow cterm=NONE
hi Question ctermbg=NONE ctermfg=green cterm=NONE
hi WarningMsg ctermbg=red ctermfg=black cterm=NONE
hi QuickFixLine ctermbg=white ctermfg=darkgrey cterm=NONE
endif
hi link StatusLineTerm StatusLine
hi link StatusLineTermNC StatusLineNC
let g:terminal_ansi_colors = [
\ '#080808',
\ '#AF5FAF',
\ '#008700',
\ '#AFAF00',
\ '#00005F',
\ '#87005F',
\ '#87D7D7',
\ '#D0D0D0',
\ '#808080',
\ '#D75F87',
\ '#5FAF87',
\ '#DFDF87',
\ '#87D7D7',
\ '#D75F87',
\ '#87D7D7',
\ '#FFFFFF',
\ ]
" Generated with RNB (https://gist.github.com/romainl/5cd2f4ec222805f49eca)

139
vim/general.vim Normal file
View file

@ -0,0 +1,139 @@
" drop vi-compatibility
set nocompatible
" disable autocmd
set secure
" use utf8 only
set encoding=utf8
" file/directory matching
set wildmode=list:longest,full
" ignore case when completing
if exists('+wildignorecase')
set wildignorecase
endif
" ignorelist
set wildignore=*.o,*.d,*.so,*.class,*.aux,*.log,*.out,*.toc,*.pdf,*.pyc
" increase command history
set history=1000
" increase count of possible undos
set undolevels=1000
" encrypt buffers when saved to files
if exists('+cryptmethod')
set cryptmethod=blowfish
endif
" enable fast terminal for tmux but not for ssh connection
if &term =~# '^screen' && !exists('SSH_CONNECTION')
set ttyfast
endif
" enable automatic file detection, plugin and indention support
if has('autocmd')
filetype plugin indent on
endif
" use utf8 encoding for all files and recognize latin1
set fileencodings=utf-8,latin1
" use unix line-endings and recognize dos endings
set fileformats=unix,dos
" tabs
set tabstop=4
set shiftwidth=4
set autoindent
set smartindent
set smarttab
" allow backspacing over autoindent and line breaks
set backspace=indent,eol,start
" already display matches while searching
set incsearch
" only check for case if the searched word contains a capital
set ignorecase
set smartcase
" highlight all matches. use <C-L> to remove the highlights
set hlsearch
" treat hyphenated words as a single word
set iskeyword+=-
" syntax folding
if has('folding')
set foldmethod=syntax
" only use folding when there is enough space
" if &columns > 80
" set foldcolumn=2
" endif
set foldlevel=99
" dont open fold for block movements
set foldopen-=block
endif
" allow buffers with changes to be hidden
set hidden
" correct splitting
if has('vertsplit')
set splitright
set splitbelow
endif
" Visual
" set text color for dark terminal background
set background=dark
" activate syntax highlighting
if has('syntax')
syntax enable
endif
" set colorscheme
colorscheme dichromatic
" display line at which the current is positioned
if exists('+cursorline')
set cursorline
" remove line and make the line bold instead
highlight CursorLine term=bold cterm=bold
highlight CursorLineNR term=bold cterm=bold ctermbg=darkgrey
endif
" display warning column at 81 and 121
let &colorcolumn="81,121"
highlight ColorColumn ctermbg=235 guibg=#2d2d2d
" display line numbers
set number
" show cursor position all the time
set ruler
" show vim tabs all the time
set showtabline=2
" show currently typed command
set showcmd
" define characters to display when using 'set list'
set listchars=tab:→\ ,trail:∙,eol,extends:,precedes:,nbsp:␣
" increase completion performance and reduce time until timeout
set updatetime=300
set timeoutlen=500
" copy paste between vim and everything else
set clipboard=unnamedplus
" Misc
set mouse=n
" remove windows ^M when the encoding gets messed up
noremap <Leader>m mmHmt:%s/<C-V><cr>//ge<cr>'tzt'm
" add convenience command for force-saving read-only files
cmap w!! w !sudo tee %

16
vim/keybindings.vim Normal file
View file

@ -0,0 +1,16 @@
" allow easier pane switching
nnoremap <C-J> <C-W><C-J>
nnoremap <C-K> <C-W><C-K>
nnoremap <C-L> <C-W><C-L>
nnoremap <C-H> <C-W><C-H>
" allow easier pane resizing
nnoremap <M-J> :resize -2<CR>
nnoremap <M-K> :resize +2<CR>
nnoremap <M-L> :vertical resize -2<CR>
nnoremap <M-H> :vertical resize +2<CR>
" use TAB to switch to next buffers
nnoremap <TAB> :bnext<CR>
" use Shift-TAB to switch to previous buffers
nnoremap <S-TAB> :bprevious<CR>

145
vimrc
View file

@ -1,143 +1,2 @@
" .vimrc
" only vim and not vi
set nocompatible
" disable autocmd
set secure
" use utf8 only
set encoding=utf8
" file/directory matching
set wildmode=list:longest,full
" ignore case when completing
if exists('+wildignorecase')
set wildignorecase
endif
" ignorelist
set wildignore=*.o,*.d,*.so,*.class,*.aux,*.log,*.out,*.toc,*.pdf,*.pyc
" show completion menu even with only one match
if exists('+completeopt')
set completeopt+=menuone
endif
" increase command history
set history=1000
" increase count of possible undos
set undolevels=1000
" encrypt buffers when saved to files
if exists('+cryptmethod')
set cryptmethod=blowfish
endif
" enable fast terminal for tmux but not for ssh connection
if &term =~# '^screen' && !exists('SSH_CONNECTION')
set ttyfast
endif
" enable automatic file detection, plugin and indention support
if has('autocmd')
filetype off "for pathogen
filetype plugin indent on
endif
" use utf8 encoding for all files and recognize latin1
set fileencodings=utf-8,latin1
" use unix line-endings and recognize dos endings
set fileformats=unix,dos
" tabs
set tabstop=4
set shiftwidth=4
set autoindent
set smartindent
set smarttab
" allow backspacing over autoindent and line breaks
set backspace=indent,eol,start
" already display matches while searching
set incsearch
" only check for case if the searched word contains a capital
set ignorecase
set smartcase
" highlight all matches. use <C-L> to remove the highlights
set hlsearch
" syntax folding
if has('folding')
set foldmethod=syntax
" only use folding when there is enough space
" if &columns > 80
" set foldcolumn=2
" endif
set foldlevel=99
" dont open fold for block movements
set foldopen-=block
endif
" allow buffers with changes to be hidden
set hidden
" correct splitting
if has('vertsplit')
set splitright
set splitbelow
endif
" Visual
" set text color for dark terminal background
set background=dark
" activate syntax highlighting
if has('syntax')
syntax enable
endif
" set colorscheme
colorscheme ron
" display line at which the current is positioned
if exists('+cursorline')
set cursorline
" remove line and make the line bold instead
highlight CursorLine term=bold cterm=bold
highlight CursorLineNR term=bold cterm=bold ctermbg=darkgrey
endif
" display box from column 81 to 100
let &colorcolumn=join(range(81, 100), ",")
highlight ColorColumn ctermbg=235 guibg=#2d2d2d
" display line numbers
set number
" show currently typed command
set showcmd
" define characters to display when using 'set list'
set listchars=tab:→\ ,trail:∙,eol,extends:,precedes:,nbsp:␣
" Disable arrow keys
"map <Right> <Nop>
"map <Left> <Nop>
"map <Up> <Nop>
"map <Down> <Nop>
"map! <Right> <Nop>
"map! <Left> <Nop>
"map! <Up> <Nop>
"map! <Down> <Nop>
" allow easier pane switching
nnoremap <C-J> <C-W><C-J>
nnoremap <C-K> <C-W><C-K>
nnoremap <C-L> <C-W><C-L>
nnoremap <C-H> <C-W><C-H>
" Misc
set mouse=n
noremap <Leader>m mmHmt:%s/<C-V><cr>//ge<cr>'tzt'm
source $HOME/.vim/general.vim
source $HOME/.vim/keybindings.vim

15
xinitrc
View file

@ -1,7 +1,12 @@
#! /bin/bash
case "$HOSTNAME" in
fau*)
cipbuero4)
# detects fau-machine and defines variable for Xresources
xrdb -load -DHOST_FAUCIP ~/.Xresources
xrandr --output DP-2 --scale 1.6x1.6
;;
fau*|cip*)
# detects fau-machine and defines variable for Xresources
xrdb -load -DHOST_FAUCIP ~/.Xresources
;;
@ -18,13 +23,19 @@ if [ -d $HOME/.fonts ]; then
xset fp rehash
fi
# start automount-daemon for udisks2 if available
if type "udiskie" >/dev/null 2>&1; then
udiskie &
fi
# autolock on suspend
xss-lock -- i3lock --nofork &
xss-lock -- i3lock --nofork --show-failed-attempts &
# autolock after 5 minutes of inactivity
xset s 300
# set background
xsetroot -solid '#22AA22'
feh --randomize --bg-fill ~/misc/wallpapers
exec i3

View file

@ -45,7 +45,14 @@ alias grep='grep --binary-files=without-match -H -n --color=always'
alias less='less -r'
alias cp='cp -i'
alias mv='mv -i'
# use nvim instead of vim when available
if type nvim >/dev/null 2>&1; then
alias vi='vim'
alias vim='nvim'
fi
alias automake='{ while true; do inotifywait -r -e modify . && make; done; } &'
# less verbose and more colorful `ip addr`-output
alias ip='ip -br -color=auto'
# ===== sp aliases
alias xterm='xterm -fa terminus -fs 8'

View file

@ -51,7 +51,9 @@ zstyle ':completion:::::' completer \
#TODO: keep _prefix or not?
# ignore case when trying to match typed characters
zstyle ':completion:*:(^approximate):*' matcher-list 'm:{a-zA-Z-_}={A-Za-z_-}'
zstyle ':completion:*:(^approximate):*' matcher-list 'm:{[:lower:]}={[:upper:]}' \
'+m:{[:upper:]}={[:lower:]}' \
'+m:{-_}={_-}'
# allow one mistake per three characters
zstyle -e ':completion:*:approximate:*' max-errors \
@ -106,11 +108,11 @@ zstyle ':completion:*' separate-sections on
zstyle ':completion:*:*:kill:*:processes' list-colors '=(#b) #([0-9]#) ([0-9a-z-]#)*=01;34=0=01'
# do not complete unwanted files with vim
zstyle ':completion:*:*:vim:*:globbed-files' ignored-patterns \
'*.aux' '*.log' '*.pdf' '*.ps' '*.bbl' '*.blg' '*.out' '*-blx.bib' '*.run.xml' '*.dvi' \
'*.o' \
zstyle ':completion:*:*:*vim:*:globbed-files' ignored-patterns \
'*.o' '*.so' '*.out' \
'*.class' \
'*.pyc' \
'*.class'
'*.aux' '*.bbl' '*.bcf' '*.blg' '*.lof' '*.lol' '*.lot' '*.pdf' '*.rubbercache' '*.run.xml' '*.toc' '*.pdf' '*.dvi'
# only complete *.pdf with katarakt
zstyle ':completion:*:*:katarakt:*:*' file-patterns '*.pdf *(-/)'

View file

@ -1,4 +1,6 @@
# set EDITOR variable
if type vim >/dev/null 2>&1; then
if type nvim >/dev/null 2>&1; then
export EDITOR="nvim"
elif type vim >/dev/null 2>&1; then
export EDITOR="vim"
fi

View file

@ -7,7 +7,7 @@ case "$OSTYPE" in
export LSCOLORS=gxfxcxdxbxegedabagacad
;;
*)
export LS_COLORS=di='36;40:ln=35;40:so=32;40:pi=33;40:ex=31;40:bd=34;46:cd=34;43:su=0;41:sg=0;46:tw=0;42:ow=0;43:'
export LS_COLORS=di='36;40:ln=35;40:so=32;40:pi=33;40:ex=31;40:bd=34;46:cd=34;43:su=0;41:sg=0;46:tw=0;42:ow=0;45:'
;;
esac
@ -18,6 +18,9 @@ setopt transient_rprompt # only show the rprompt on the current prompt
# ===== set the prompt
zshrc_prompt_precmd() {
# call vcs_info before every prompt
vcs_info
# regex to remove all zerospace elements. Used to calculate the width of
# the top prompt.
local zero='%([BSUBfksu]|([FB]|){*})'
@ -52,6 +55,14 @@ zshrc_prompt_precmd() {
# username, green for normal users, red for root
local user="%(!.%F{red}.%F{green})%n%f"
# information about unstaged/staged changes in VCS in current directory
local vcs="${vcs_info_msg_0_}"
local vcs_width=${#${(S%%%)vcs//$~zero/}}
if [[ $vcs_width -ne 0 ]]; then
# add brackets if vcs is non-empty
vcs="${bracket_open}${vcs}${bracket_close}"
fi
# hostname, underlined if running on a remote system through SSH
local host="%F{green}%m%f"
if [[ -n $SSH_CONNECTION ]]; then
@ -95,6 +106,7 @@ zshrc_prompt_precmd() {
# combine them to create the prompt
local top_left=""
local top_right="${bracket_open}${time}${bracket_close}"
local top_middle="${vcs}"
local bottom_left="${bracket_open}${user}%F{green}@%f${host}${bracket_close}${exitcode}${separator}${symbol}"
local bottom_right=
@ -109,15 +121,16 @@ zshrc_prompt_precmd() {
local width_top_prefix=${#${(S%%%)top_prefix//$~zero/}}
local width_top_suffix=${#${(S%%%)top_suffix//$~zero/}}
local width_top_left=${#${(S%%%)top_left//$~zero/}}
local width_top_middle=${#${(S%%%)top_middle//$~zero/}}
local width_top_right=${#${(S%%%)top_right//$~zero/}}
# calculate the maximum width of ${top_left}:
# (-4 for brackets, -1 as spacing between top_left and top_right)
# (-4 for brackets and as spacing between top_left, top_middle and top_right)
local top_left_width_max=$((
COLUMNS - $width_top_prefix
- $width_top_left - 4
- 1
- $width_top_right
- $width_top_left - 2
- $width_top_middle
- $width_top_right - 2
- $width_top_suffix
))
@ -129,12 +142,14 @@ zshrc_prompt_precmd() {
local width=$((
COLUMNS - width_top_prefix
- width_top_left
- width_top_middle
- width_top_right
- width_top_suffix
))
local top_separator="%F{cyan}${(pl:${width}::$dash:)}%f"
local top_left_separator="%F{cyan}${(pl:$((width / 2))::$dash:)}%f"
local top_right_separator="%F{cyan}${(pl:$((width / 2 + width % 2))::$dash:)}%f"
PROMPT="${top_prefix}${top_left}${top_separator}${top_right}${top_suffix}
PROMPT="${top_prefix}${top_left}${top_left_separator}${top_middle}${top_right_separator}${top_right}${top_suffix}
${bottom_prefix}${bottom_left} "
RPROMPT="${bottom_right}${bottom_suffix}"

69
zsh/vcs.zsh Normal file
View file

@ -0,0 +1,69 @@
autoload -Uz vcs_info
# only look for certain VCS
zstyle ':vcs_info:*' enable git
# check repository for changes so that they can be used in %u/%c
# (this might be slow for bigger repositories)
zstyle ':vcs_info:*' check-for-changes yes
# display current branch (%b -> green), unstaged + staged changes (%u/%c -> green),
# VCS (%s -> blue) and custom messages (%m).
zstyle ':vcs_info:*' formats \
"%F{green}%b%u%c%F{default}:%F{blue}%s%F{default}%m"
# during special actions (e.g. merge, rebase), also display those (%a -> red)
zstyle ':vcs_info:*' actionformats \
"(%F{green}%b%u%c%F{default}/%F{red}%a%F{default}:%F{blue}%s%F{default}%m)"
# set style for formats/actionformats when unstaged (%u) and staged (%c)
# changes are detected in the repository
# (check-for-changes must be true for this to work)
zstyle ':vcs_info:*' unstagedstr '¹'
zstyle ':vcs_info:*' stagedstr '²'
# force vcs_info to be run. this prevents running it later for performance reasons.
# default to run vcs_info. will be prevented from running later if possible
# (for speedup)
zshrc_force_run_vcs_info=1
# cache data
zstyle ':vcs_info:*+pre-get-data:*' hooks pre-get-data
+vi-pre-get-data() {
# only git and mercurial support and need caching. ignore all other VCS
[[ $vcs != git && $vcs != hg ]] && return
# run vcs_info on startup, on directory change (or for other custom reasons)
if [[ -n $zshrc_force_run_vcs_info ]]; then
zshrc_force_run_vcs_info=
return
fi
# don't run vcs_info by default to speed up the shell
ret=1
case $(fc -ln $(($HISTCMD-1))) in
# vcs status might need an update after running git/hg
git* | g\ *)
ret=0
;;
esac
}
# display stash count
function +vi-git-stashes() {
if [[ -s ${hook_com[base]/.git/refs/stash} ]]; then
local -a stashes
# "grep" output of git stash list via (M) and :#(...)
stashes=( ${(M)${(f)"$(git stash list 2>/dev/null)"}:#(*WIP*)} )
if [[ ${#stashes} -gt 0 ]]; then
hook_com[misc]+=" %F{yellow}${#stashes}s%F{default}"
fi
fi
}
zstyle ':vcs_info:git*+set-message:*' hooks git-stashes
# enforce running vcs_info when changing directory
prompt_chpwd() {
zshrc_force_run_vcs_info=1
}
chpwd_functions+=(prompt_chpwd)

6
zshrc
View file

@ -2,9 +2,15 @@
source ~/.zsh/keybindings.zsh
source ~/.zsh/setopt.zsh
source ~/.zsh/general.zsh
source ~/.zsh/vcs.zsh
source ~/.zsh/prompt.zsh
source ~/.zsh/completion.zsh
source ~/.zsh/history.zsh
source ~/.zsh/aliases.zsh
source ~/.zsh/multiplexer.zsh
source ~/.zsh/exports.zsh
# Try loading additional local config if available
if [ -f ~/.zsh/custom.zsh ]; then
source ~/.zsh/custom.zsh
fi