Compare commits
6 Commits
39f2d64803
...
19b00f17d5
Author | SHA1 | Date |
---|---|---|
|
19b00f17d5 | |
|
bb751513fb | |
|
f183fa7b94 | |
|
4e63f0a0cd | |
|
c41d32c454 | |
|
ad6c10ac4e |
17
.bashrc
17
.bashrc
|
@ -44,20 +44,3 @@ if ! shopt -oq posix; then
|
|||
. /etc/bash_completion
|
||||
fi
|
||||
fi
|
||||
|
||||
# osc7
|
||||
osc7_cwd() {
|
||||
local strlen=${#PWD}
|
||||
local encoded=""
|
||||
local pos c o
|
||||
for (( pos=0; pos<strlen; pos++ )); do
|
||||
c=${PWD:$pos:1}
|
||||
case "$c" in
|
||||
[-/:_.!\'\(\)~[:alnum:]] ) o="${c}" ;;
|
||||
* ) printf -v o '%%%02X' "'${c}" ;;
|
||||
esac
|
||||
encoded+="${o}"
|
||||
done
|
||||
printf '\e]7;file://%s%s\e\\' "${HOSTNAME}" "${encoded}"
|
||||
}
|
||||
PROMPT_COMMAND=${PROMPT_COMMAND:+$PROMPT_COMMAND}osc7_cwd
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
APT::Default-Release "/^testing(|-security)$/";
|
|
@ -1 +0,0 @@
|
|||
APT::AutoRemove::SuggestsImportant "false";
|
|
@ -1,11 +0,0 @@
|
|||
deb http://deb.debian.org/debian/ testing main non-free-firmware
|
||||
deb-src http://deb.debian.org/debian/ testing main non-free-firmware
|
||||
|
||||
deb http://security.debian.org/debian-security testing-security main non-free-firmware
|
||||
deb-src http://security.debian.org/debian-security testing-security main non-free-firmware
|
||||
|
||||
deb http://deb.debian.org/debian/ unstable main non-free-firmware
|
||||
deb-src http://deb.debian.org/debian/ unstable main non-free-firmware
|
||||
|
||||
deb http://deb.debian.org/debian/ experimental main non-free-firmware
|
||||
deb-src http://deb.debian.org/debian/ experimental main non-free-firmware
|
|
@ -1,8 +0,0 @@
|
|||
<?xml version="1.0"?>
|
||||
<!DOCTYPE fontconfig SYSTEM "urn:fontconfig:fonts.dtd">
|
||||
<fontconfig>
|
||||
<alias>
|
||||
<family>monospace</family>
|
||||
<prefer><family>Agave</family></prefer>
|
||||
</alias>
|
||||
</fontconfig>
|
|
@ -1,23 +0,0 @@
|
|||
[main]
|
||||
dpi-aware=no
|
||||
font=monospace:size=13
|
||||
|
||||
[colors]
|
||||
foreground=e2e2e2
|
||||
background=000000
|
||||
regular0=000000
|
||||
regular1=fa3500
|
||||
regular2=009843
|
||||
regular3=d06600
|
||||
regular4=856cff
|
||||
regular5=ff1170
|
||||
regular6=008cca
|
||||
regular7=e2e2e2
|
||||
bright0=848484
|
||||
bright1=ff888e
|
||||
bright2=00c55b
|
||||
bright3=ff8d48
|
||||
bright4=ac9fff
|
||||
bright5=ffb1c0
|
||||
bright6=92ccff
|
||||
bright7=ffffff
|
|
@ -1,18 +0,0 @@
|
|||
[main]
|
||||
layer=overlay
|
||||
dpi-aware=no
|
||||
font=monospace:size=13
|
||||
icons-enabled=no
|
||||
width=72
|
||||
|
||||
[colors]
|
||||
background=000000ff
|
||||
text=856cffff
|
||||
match=d06600ff
|
||||
selection=000000ff
|
||||
selection-text=ff1170ff
|
||||
selection-match=ff1170ff
|
||||
border=856cffff
|
||||
|
||||
[border]
|
||||
radius=0
|
|
@ -1 +0,0 @@
|
|||
invisible=1
|
|
@ -1,6 +0,0 @@
|
|||
[Default Applications]
|
||||
text/plain=nvim.desktop;
|
||||
text/markdown=nvim.desktop;
|
||||
application/pdf=org.pwmt.zathura.desktop;
|
||||
x-scheme-handler/http=firefox.desktop;
|
||||
x-scheme-handler/https=firefox.desktop;
|
|
@ -1,10 +0,0 @@
|
|||
UP ignore
|
||||
DOWN ignore
|
||||
LEFT repeatable playlist-prev
|
||||
RIGHT repeatable playlist-next
|
||||
|
||||
MBTN_RIGHT script-binding drag-to-pan
|
||||
MBTN_LEFT script-binding pan-follows-cursor
|
||||
MBTN_LEFT_DBL ignore
|
||||
WHEEL_UP script-message cursor-centric-zoom 0.1
|
||||
WHEEL_DOWN script-message cursor-centric-zoom -0.1
|
|
@ -1,8 +0,0 @@
|
|||
# window
|
||||
image-display-duration=inf
|
||||
|
||||
# osd
|
||||
osd-level=0
|
||||
|
||||
# gpu renderer options
|
||||
background="#000000"
|
|
@ -1,282 +0,0 @@
|
|||
local opts = {
|
||||
drag_to_pan_margin = 50,
|
||||
drag_to_pan_move_if_full_view = false,
|
||||
|
||||
pan_follows_cursor_margin = 50,
|
||||
|
||||
cursor_centric_zoom_margin = 50,
|
||||
cursor_centric_zoom_auto_center = true,
|
||||
cursor_centric_zoom_dezoom_if_full_view = false,
|
||||
}
|
||||
local options = require 'mp.options'
|
||||
local msg = require 'mp.msg'
|
||||
local assdraw = require 'mp.assdraw'
|
||||
|
||||
options.read_options(opts, nil, function() end)
|
||||
|
||||
function clamp(value, low, high)
|
||||
if value <= low then
|
||||
return low
|
||||
elseif value >= high then
|
||||
return high
|
||||
else
|
||||
return value
|
||||
end
|
||||
end
|
||||
|
||||
local cleanup = nil -- function set up by drag-to-pan/pan-follows cursor and must be called to clean lingering state
|
||||
|
||||
function drag_to_pan_handler(table)
|
||||
if cleanup then
|
||||
cleanup()
|
||||
cleanup = nil
|
||||
end
|
||||
if table["event"] == "down" then
|
||||
local dim = mp.get_property_native("osd-dimensions")
|
||||
if not dim then return end
|
||||
local mouse_pos_origin, video_pan_origin = {}, {}
|
||||
local moved = false
|
||||
mouse_pos_origin[1], mouse_pos_origin[2] = mp.get_mouse_pos()
|
||||
video_pan_origin[1] = mp.get_property_number("video-pan-x")
|
||||
video_pan_origin[2] = mp.get_property_number("video-pan-y")
|
||||
local video_size = { dim.w - dim.ml - dim.mr, dim.h - dim.mt - dim.mb }
|
||||
local margin = opts.drag_to_pan_margin
|
||||
local move_up = true
|
||||
local move_lateral = true
|
||||
if not opts.drag_to_pan_move_if_full_view then
|
||||
if dim.ml >= 0 and dim.mr >= 0 then
|
||||
move_lateral = false
|
||||
end
|
||||
if dim.mt >= 0 and dim.mb >= 0 then
|
||||
move_up = false
|
||||
end
|
||||
end
|
||||
if not move_up and not move_lateral then return end
|
||||
local idle = function()
|
||||
if moved then
|
||||
local mX, mY = mp.get_mouse_pos()
|
||||
local pX = video_pan_origin[1]
|
||||
local pY = video_pan_origin[2]
|
||||
if move_lateral then
|
||||
pX = video_pan_origin[1] + (mX - mouse_pos_origin[1]) / video_size[1]
|
||||
if 2 * margin > dim.ml + dim.mr then
|
||||
pX = clamp(pX,
|
||||
(-margin + dim.w / 2) / video_size[1] - 0.5,
|
||||
(margin - dim.w / 2) / video_size[1] + 0.5)
|
||||
else
|
||||
pX = clamp(pX,
|
||||
(margin - dim.w / 2) / video_size[1] + 0.5,
|
||||
(-margin + dim.w / 2) / video_size[1] - 0.5)
|
||||
end
|
||||
end
|
||||
if move_up then
|
||||
pY = video_pan_origin[2] + (mY - mouse_pos_origin[2]) / video_size[2]
|
||||
if 2 * margin > dim.mt + dim.mb then
|
||||
pY = clamp(pY,
|
||||
(-margin + dim.h / 2) / video_size[2] - 0.5,
|
||||
(margin - dim.h / 2) / video_size[2] + 0.5)
|
||||
else
|
||||
pY = clamp(pY,
|
||||
(margin - dim.h / 2) / video_size[2] + 0.5,
|
||||
(-margin + dim.h / 2) / video_size[2] - 0.5)
|
||||
end
|
||||
end
|
||||
mp.command("no-osd set video-pan-x " .. clamp(pX, -3, 3) .. "; no-osd set video-pan-y " .. clamp(pY, -3, 3))
|
||||
moved = false
|
||||
end
|
||||
end
|
||||
mp.register_idle(idle)
|
||||
mp.add_forced_key_binding("mouse_move", "image-viewer-mouse-move", function() moved = true end)
|
||||
cleanup = function()
|
||||
mp.remove_key_binding("image-viewer-mouse-move")
|
||||
mp.unregister_idle(idle)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function pan_follows_cursor_handler(table)
|
||||
if cleanup then
|
||||
cleanup()
|
||||
cleanup = nil
|
||||
end
|
||||
if table["event"] == "down" then
|
||||
local dim = mp.get_property_native("osd-dimensions")
|
||||
if not dim then return end
|
||||
local video_size = { dim.w - dim.ml - dim.mr, dim.h - dim.mt - dim.mb }
|
||||
local moved = true
|
||||
local idle = function()
|
||||
if moved then
|
||||
local mX, mY = mp.get_mouse_pos()
|
||||
local x = math.min(1, math.max(-2 * mX / dim.w + 1, -1))
|
||||
local y = math.min(1, math.max(-2 * mY / dim.h + 1, -1))
|
||||
local command = ""
|
||||
local margin = opts.pan_follows_cursor_margin
|
||||
if dim.ml + dim.mr < 0 then
|
||||
command = command ..
|
||||
"no-osd set video-pan-x " .. clamp(x * (2 * margin - dim.ml - dim.mr) / (2 * video_size[1]), -3, 3) .. ";"
|
||||
elseif mp.get_property_number("video-pan-x") ~= 0 then
|
||||
command = command .. "no-osd set video-pan-x " .. "0;"
|
||||
end
|
||||
if dim.mt + dim.mb < 0 then
|
||||
command = command ..
|
||||
"no-osd set video-pan-y " .. clamp(y * (2 * margin - dim.mt - dim.mb) / (2 * video_size[2]), -3, 3) .. ";"
|
||||
elseif mp.get_property_number("video-pan-y") ~= 0 then
|
||||
command = command .. "no-osd set video-pan-y " .. "0;"
|
||||
end
|
||||
if command ~= "" then
|
||||
mp.command(command)
|
||||
end
|
||||
moved = false
|
||||
end
|
||||
end
|
||||
mp.register_idle(idle)
|
||||
mp.add_forced_key_binding("mouse_move", "image-viewer-mouse-move", function() moved = true end)
|
||||
cleanup = function()
|
||||
mp.remove_key_binding("image-viewer-mouse-move")
|
||||
mp.unregister_idle(idle)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function cursor_centric_zoom_handler(amt)
|
||||
local zoom_inc = tonumber(amt)
|
||||
if not zoom_inc or zoom_inc == 0 then return end
|
||||
local dim = mp.get_property_native("osd-dimensions")
|
||||
if not dim then return end
|
||||
|
||||
local margin = opts.cursor_centric_zoom_margin
|
||||
|
||||
local video_size = { dim.w - dim.ml - dim.mr, dim.h - dim.mt - dim.mb }
|
||||
|
||||
-- the size in pixels of the (in|de)crement
|
||||
local diff_width = (2 ^ zoom_inc - 1) * video_size[1]
|
||||
local diff_height = (2 ^ zoom_inc - 1) * video_size[2]
|
||||
if not opts.cursor_centric_zoom_dezoom_if_full_view and
|
||||
zoom_inc < 0 and
|
||||
video_size[1] + diff_width + 2 * margin <= dim.w and
|
||||
video_size[2] + diff_height + 2 * margin <= dim.h
|
||||
then
|
||||
-- the zoom decrement is too much, reduce it such that the full image is visible, no more, no less
|
||||
-- in addition, this should take care of trying too zoom out while everything is already visible
|
||||
local new_zoom_inc_x = math.log((dim.w - 2 * margin) / video_size[1]) / math.log(2)
|
||||
local new_zoom_inc_y = math.log((dim.h - 2 * margin) / video_size[2]) / math.log(2)
|
||||
local new_zoom_inc = math.min(0, math.min(new_zoom_inc_x, new_zoom_inc_y))
|
||||
zoom_inc = new_zoom_inc
|
||||
diff_width = (2 ^ zoom_inc - 1) * video_size[1]
|
||||
diff_height = (2 ^ zoom_inc - 1) * video_size[2]
|
||||
end
|
||||
local new_width = video_size[1] + diff_width
|
||||
local new_height = video_size[2] + diff_height
|
||||
|
||||
local mouse_pos_origin = {}
|
||||
mouse_pos_origin[1], mouse_pos_origin[2] = mp.get_mouse_pos()
|
||||
local new_pan_x, new_pan_y
|
||||
|
||||
-- some additional constraints:
|
||||
-- if image can be fully visible (in either direction), set pan to 0
|
||||
-- if border would show on either side, then prefer adjusting the pan even if not cursor-centric
|
||||
local auto_c = opts.cursor_centric_zoom_auto_center
|
||||
if auto_c and video_size[1] + diff_width + 2 * margin <= dim.w then
|
||||
new_pan_x = 0
|
||||
else
|
||||
local pan_x = mp.get_property("video-pan-x")
|
||||
local rx = (dim.ml + video_size[1] / 2 - mouse_pos_origin[1]) / (video_size[1] / 2)
|
||||
new_pan_x = (pan_x * video_size[1] + rx * diff_width / 2) / new_width
|
||||
if auto_c then
|
||||
new_pan_x = clamp(new_pan_x, (dim.w - 2 * margin) / (2 * new_width) - 0.5,
|
||||
-(dim.w - 2 * margin) / (2 * new_width) + 0.5)
|
||||
end
|
||||
end
|
||||
|
||||
if auto_c and video_size[2] + diff_height + 2 * margin <= dim.h then
|
||||
new_pan_y = 0
|
||||
else
|
||||
local pan_y = mp.get_property("video-pan-y")
|
||||
local ry = (dim.mt + video_size[2] / 2 - mouse_pos_origin[2]) / (video_size[2] / 2)
|
||||
new_pan_y = (pan_y * video_size[2] + ry * diff_height / 2) / new_height
|
||||
if auto_c then
|
||||
new_pan_y = clamp(new_pan_y, (dim.h - 2 * margin) / (2 * new_height) - 0.5,
|
||||
-(dim.h - 2 * margin) / (2 * new_height) + 0.5)
|
||||
end
|
||||
end
|
||||
|
||||
local zoom_origin = mp.get_property("video-zoom")
|
||||
mp.command("no-osd set video-zoom " ..
|
||||
zoom_origin + zoom_inc ..
|
||||
"; no-osd set video-pan-x " .. clamp(new_pan_x, -3, 3) .. "; no-osd set video-pan-y " .. clamp(new_pan_y, -3, 3))
|
||||
end
|
||||
|
||||
function align_border(x, y)
|
||||
local dim = mp.get_property_native("osd-dimensions")
|
||||
if not dim then return end
|
||||
local video_size = { dim.w - dim.ml - dim.mr, dim.h - dim.mt - dim.mb }
|
||||
local x, y = tonumber(x), tonumber(y)
|
||||
local command = ""
|
||||
if x then
|
||||
command = command .. "no-osd set video-pan-x " .. clamp(-x * (dim.ml + dim.mr) / (2 * video_size[1]), -3, 3) .. ";"
|
||||
end
|
||||
if y then
|
||||
command = command .. "no-osd set video-pan-y " .. clamp(-y * (dim.mt + dim.mb) / (2 * video_size[2]), -3, 3) .. ";"
|
||||
end
|
||||
if command ~= "" then
|
||||
mp.command(command)
|
||||
end
|
||||
end
|
||||
|
||||
function pan_image(axis, amount, zoom_invariant, image_constrained)
|
||||
amount = tonumber(amount)
|
||||
if not amount or amount == 0 or axis ~= "x" and axis ~= "y" then return end
|
||||
if zoom_invariant == "yes" then
|
||||
amount = amount / 2 ^ mp.get_property_number("video-zoom")
|
||||
end
|
||||
local prop = "video-pan-" .. axis
|
||||
local old_pan = mp.get_property_number(prop)
|
||||
if image_constrained == "yes" then
|
||||
local dim = mp.get_property_native("osd-dimensions")
|
||||
if not dim then return end
|
||||
local margin =
|
||||
(axis == "x" and amount > 0) and dim.ml
|
||||
or (axis == "x" and amount < 0) and dim.mr
|
||||
or (amount > 0) and dim.mt
|
||||
or (amount < 0) and dim.mb
|
||||
local vid_size = (axis == "x") and (dim.w - dim.ml - dim.mr) or (dim.h - dim.mt - dim.mb)
|
||||
local pixels_moved = math.abs(amount) * vid_size
|
||||
-- the margin is already visible, no point going further
|
||||
if margin >= 0 then
|
||||
return
|
||||
elseif margin + pixels_moved > 0 then
|
||||
amount = -(math.abs(amount) / amount) * margin / vid_size
|
||||
end
|
||||
end
|
||||
mp.set_property_number(prop, old_pan + amount)
|
||||
end
|
||||
|
||||
function rotate_video(amt)
|
||||
local rot = mp.get_property_number("video-rotate")
|
||||
rot = (rot + amt) % 360
|
||||
mp.set_property_number("video-rotate", rot)
|
||||
end
|
||||
|
||||
function reset_pan_if_visible()
|
||||
local dim = mp.get_property_native("osd-dimensions")
|
||||
if not dim then return end
|
||||
local command = ""
|
||||
if (dim.ml + dim.mr >= 0) then
|
||||
command = command .. "no-osd set video-pan-x 0" .. ";"
|
||||
end
|
||||
if (dim.mt + dim.mb >= 0) then
|
||||
command = command .. "no-osd set video-pan-y 0" .. ";"
|
||||
end
|
||||
if command ~= "" then
|
||||
mp.command(command)
|
||||
end
|
||||
end
|
||||
|
||||
mp.add_key_binding(nil, "drag-to-pan", drag_to_pan_handler, { complex = true })
|
||||
mp.add_key_binding(nil, "pan-follows-cursor", pan_follows_cursor_handler, { complex = true })
|
||||
mp.add_key_binding(nil, "cursor-centric-zoom", cursor_centric_zoom_handler)
|
||||
mp.add_key_binding(nil, "align-border", align_border)
|
||||
mp.add_key_binding(nil, "pan-image", pan_image)
|
||||
mp.add_key_binding(nil, "rotate-video", rotate_video)
|
||||
mp.add_key_binding(nil, "reset-pan-if-visible", reset_pan_if_visible)
|
||||
mp.add_key_binding(nil, "force-print-filename", force_print_filename)
|
|
@ -1,15 +1,31 @@
|
|||
#!/usr/sbin/nft -f
|
||||
|
||||
flush ruleset
|
||||
|
||||
table inet filter {
|
||||
chain input {
|
||||
type filter hook input priority filter; policy drop;
|
||||
# accept any localhost traffic
|
||||
iif lo accept
|
||||
# accept traffic originated from us
|
||||
ct state established,related accept
|
||||
# accept neighbour discovery otherwise connectivity breaks
|
||||
icmpv6 type { nd-neighbor-solicit, nd-router-advert, nd-neighbor-advert } accept
|
||||
chain inbound {
|
||||
type filter hook input priority 0; policy drop;
|
||||
|
||||
iif lo accept comment "Accept loopback traffic"
|
||||
meta l4proto { icmp, ipv6-icmp } accept comment "Accept all icmp/icmpv6 traffic"
|
||||
ct state vmap { established : accept, related : accept, invalid : drop } comment "Allow traffic from established and related connections, drop invalid"
|
||||
|
||||
tcp dport ssh accept comment "Accept SSH on port 22"
|
||||
udp dport 1194 accept comment "Accept VPN on port 1194"
|
||||
|
||||
# log prefix "[nftables] Inbound Denied: " counter drop comment "Log denied traffic"
|
||||
}
|
||||
chain forward {
|
||||
type filter hook forward priority 0; policy drop;
|
||||
iifname "padova" accept
|
||||
}
|
||||
}
|
||||
|
||||
table inet nat {
|
||||
chain prerouting {
|
||||
type nat hook prerouting priority -100;
|
||||
}
|
||||
chain postrouting {
|
||||
type nat hook postrouting priority 100;
|
||||
oifname "eth0" masquerade
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +0,0 @@
|
|||
-- options
|
||||
vim.opt.tabstop = 2
|
||||
vim.opt.shiftwidth = 2
|
||||
vim.opt.expandtab = true
|
|
@ -1,7 +0,0 @@
|
|||
-- options
|
||||
vim.opt.tabstop = 2
|
||||
vim.opt.shiftwidth = 2
|
||||
vim.opt.expandtab = true
|
||||
|
||||
-- treesitter
|
||||
vim.treesitter.start()
|
|
@ -1,9 +0,0 @@
|
|||
-- options
|
||||
vim.bo.tabstop = 2
|
||||
vim.bo.shiftwidth = 2
|
||||
vim.bo.expandtab = true
|
||||
|
||||
-- keymaps
|
||||
local keymap_set = vim.keymap.set
|
||||
keymap_set("n", "]h", "/\\_^#.*\\ze\\n\\{2}<esc>", {})
|
||||
keymap_set("n", "[h", "?\\_^#.*\\ze\\n\\{2}<esc>", {})
|
|
@ -1,2 +0,0 @@
|
|||
-- treesitter
|
||||
vim.treesitter.start()
|
|
@ -1,21 +0,0 @@
|
|||
if exists("b:current_syntax")
|
||||
unlet! b:current_syntax
|
||||
endif
|
||||
|
||||
" yaml
|
||||
syntax clear markdownYamlHead
|
||||
syntax region markdownYamlHead start="^-\{3}\n\S" end="\S\n\%(-\|\.\)\{3}$" keepend contains=@markdownYamlTop,@Spell
|
||||
|
||||
" citation
|
||||
syntax match markdownPCite "\^\@<!\[[^\[\]]\{-}-\{0,1}@[[:alnum:]_][[:digit:][:lower:][:upper:]_:.#$%&\-+?<>~/]*\_.\{-}\]" contains=@markdownInline,markdownCiteKey
|
||||
syn match markdownICite "@[[:alnum:]_][[:digit:][:lower:][:upper:]_:.#$%&\-+?<>~/]*\s\[.\{-1,}\]" contains=markdownCiteKey,@Spell display
|
||||
syn match markdownCiteKey /\(-\=@[[:alnum:]_][[:digit:][:lower:][:upper:]_:.#$%&\-+?<>~/]*\)/ containedin=markdownPCite,markdownICite contains=@NoSpell display
|
||||
|
||||
hi def link markdownPCite Comment
|
||||
hi def link markdownICite Comment
|
||||
hi def link markdownCiteKey markdownLabel
|
||||
hi def link markdownLabel Label
|
||||
|
||||
let b:current_syntax = "markdown"
|
||||
|
||||
" vim:set sw=2:
|
|
@ -1,344 +0,0 @@
|
|||
-- basic neovim colorscheme template
|
||||
--
|
||||
-- A simple neovim colorscheme template that defines highlight groups
|
||||
-- from a list of 8 colors.
|
||||
|
||||
-- colors ----------------------------------------------------------------------
|
||||
local C = {
|
||||
black = { cterm = 0, gui = "#000000" },
|
||||
red = { cterm = 1, gui = "#fa3500" },
|
||||
green = { cterm = 2, gui = "#009843" },
|
||||
orange = { cterm = 3, gui = "#d06600" },
|
||||
blue = { cterm = 4, gui = "#856cff" },
|
||||
magenta = { cterm = 5, gui = "#ff1170" },
|
||||
cyan = { cterm = 6, gui = "#008cca" },
|
||||
white = { cterm = 7, gui = "#e2e2e2" },
|
||||
bright_black = { cterm = 8, gui = "#848484" },
|
||||
bright_red = { cterm = 9, gui = "#ff888e" },
|
||||
bright_green = { cterm = 10, gui = "#00c55b" },
|
||||
bright_orange = { cterm = 11, gui = "#ff8d48" },
|
||||
bright_blue = { cterm = 12, gui = "#ac9fff" },
|
||||
bright_magenta = { cterm = 13, gui = "#ffb1c0" },
|
||||
bright_cyan = { cterm = 14, gui = "#92ccff" },
|
||||
bright_white = { cterm = 15, gui = "#ffffff" },
|
||||
}
|
||||
|
||||
vim.g.terminal_color_0 = "#000000"
|
||||
vim.g.terminal_color_1 = "#fa3500"
|
||||
vim.g.terminal_color_2 = "#009843"
|
||||
vim.g.terminal_color_3 = "#d06600"
|
||||
vim.g.terminal_color_4 = "#856cff"
|
||||
vim.g.terminal_color_5 = "#ff1170"
|
||||
vim.g.terminal_color_6 = "#008cca"
|
||||
vim.g.terminal_color_7 = "#e2e2e2"
|
||||
vim.g.terminal_color_8 = "#848484"
|
||||
vim.g.terminal_color_9 = "#ff888e"
|
||||
vim.g.terminal_color_10 = "#00c55b"
|
||||
vim.g.terminal_color_11 = "#ff8d48"
|
||||
vim.g.terminal_color_12 = "#ac9fff"
|
||||
vim.g.terminal_color_13 = "#ffb1c0"
|
||||
vim.g.terminal_color_14 = "#92ccff"
|
||||
vim.g.terminal_color_15 = "#ffffff"
|
||||
|
||||
-- init ------------------------------------------------------------------------
|
||||
vim.cmd.highlight("clear")
|
||||
if vim.fn.exists("syntax_on") then
|
||||
vim.cmd.syntax("reset")
|
||||
end
|
||||
vim.opt.background = "dark"
|
||||
vim.g.colors_name = "basic"
|
||||
|
||||
if
|
||||
vim.env.TERM == "linux" or
|
||||
vim.env.TERM == "screen" or
|
||||
vim.env.TERM == "screen.linux"
|
||||
then
|
||||
vim.opt.termguicolors = false
|
||||
else
|
||||
vim.opt.termguicolors = true
|
||||
end
|
||||
|
||||
-- highlights ------------------------------------------------------------------
|
||||
local fg = C.white
|
||||
local bg = C.black
|
||||
local accent = C.magenta
|
||||
local dimmed = C.blue
|
||||
|
||||
local nvim_set_hl = vim.api.nvim_set_hl
|
||||
local function set_hl(group, def) nvim_set_hl(0, group, def) end
|
||||
|
||||
-- normal ----------------------------------------------------------------------
|
||||
local normal_h = {}
|
||||
|
||||
set_hl("Normal", normal_h)
|
||||
set_hl("NormalNC", normal_h)
|
||||
|
||||
-- tui -------------------------------------------------------------------------
|
||||
local tui_normal_h = {}
|
||||
local tui_accent_h = { ctermfg = accent.cterm, fg = accent.gui }
|
||||
local tui_dimmed_h = { ctermfg = dimmed.cterm, fg = dimmed.gui }
|
||||
|
||||
set_hl("StatusLine", tui_dimmed_h)
|
||||
set_hl("StatusLineNC", tui_dimmed_h)
|
||||
set_hl("TabLine", tui_dimmed_h)
|
||||
set_hl("TabLineFill", tui_dimmed_h)
|
||||
set_hl("TabLineSel", tui_accent_h)
|
||||
set_hl("WinBar", tui_accent_h)
|
||||
set_hl("WinBarNC", tui_dimmed_h)
|
||||
set_hl("WinSeparator", tui_dimmed_h)
|
||||
set_hl("LineNr", tui_accent_h)
|
||||
set_hl("LineNrAbove", tui_dimmed_h)
|
||||
set_hl("LineNrBelow", tui_dimmed_h)
|
||||
set_hl("SignColumn", tui_dimmed_h)
|
||||
set_hl("FoldColumn", tui_dimmed_h)
|
||||
set_hl("WildMenu", tui_accent_h)
|
||||
|
||||
-- float -----------------------------------------------------------------------
|
||||
local float_normal_h = { ctermfg = bg.cterm,
|
||||
fg = bg.gui,
|
||||
ctermbg = fg.cterm,
|
||||
bg = fg.gui }
|
||||
local float_dimmed_h = { ctermfg = dimmed.cterm,
|
||||
fg = dimmed.gui,
|
||||
ctermbg = fg.cterm,
|
||||
bg = fg.gui }
|
||||
local float_accent_h = { ctermfg = accent.cterm,
|
||||
fg = accent.gui,
|
||||
ctermbg = fg.cterm,
|
||||
bg = fg.gui }
|
||||
|
||||
set_hl("NormalFloat", float_normal_h)
|
||||
set_hl("FloatBorder", float_dimmed_h)
|
||||
set_hl("FloatTitle", float_accent_h)
|
||||
|
||||
-- menu ------------------------------------------------------------------------
|
||||
local menu_normal_h = { ctermfg = accent.cterm,
|
||||
fg = accent.gui,
|
||||
ctermbg = fg.cterm,
|
||||
bg = fg.gui }
|
||||
local menu_accent_h = { ctermfg = accent.cterm,
|
||||
fg = accent.gui,
|
||||
ctermbg = fg.cterm,
|
||||
bg = fg.gui,
|
||||
reverse = true }
|
||||
local test = { ctermfg, fg = 1, 2 }
|
||||
|
||||
set_hl("Pmenu", menu_normal_h)
|
||||
set_hl("PmenuSel", menu_accent_h)
|
||||
set_hl("PmenuKind", menu_normal_h)
|
||||
set_hl("PmenuKindSel", menu_accent_h)
|
||||
set_hl("PmenuExtra", menu_normal_h)
|
||||
set_hl("PmenuExtraSel", menu_accent_h)
|
||||
set_hl("PmenuSbar", menu_normal_h)
|
||||
set_hl("PmenuThumb", menu_accent_h)
|
||||
|
||||
-- messages --------------------------------------------------------------------
|
||||
local message_normal_h = {}
|
||||
local message_accent_h = { ctermfg = accent.cterm, fg = accent.gui }
|
||||
local message_error_h = { ctermfg = C.red.cterm, fg = C.red.gui }
|
||||
local message_warn_h = { ctermfg = C.orange.cterm, fg = C.orange.gui }
|
||||
|
||||
set_hl("MsgArea", message_normal_h)
|
||||
set_hl("MsgSeparator", message_normal_h)
|
||||
set_hl("ModeMsg", message_accent_h)
|
||||
set_hl("MoreMsg", message_accent_h)
|
||||
set_hl("WarningMsg", message_warn_h)
|
||||
set_hl("ErrorMsg", message_error_h)
|
||||
set_hl("Question", message_accent_h)
|
||||
set_hl("Title", message_accent_h)
|
||||
|
||||
-- buffer ----------------------------------------------------------------------
|
||||
local buffer_normal_h = { ctermfg = dimmed.cterm, fg = dimmed.gui }
|
||||
local buffer_normal_bg_h = { ctermbg = dimmed.cterm, bg = dimmed.gui }
|
||||
local buffer_accent_h = { ctermfg = accent.cterm, fg = accent.gui }
|
||||
|
||||
set_hl("Conceal", buffer_normal_h)
|
||||
set_hl("NonText", buffer_normal_h)
|
||||
set_hl("EndOfBuffer", buffer_normal_h)
|
||||
set_hl("Whitespace", buffer_normal_h)
|
||||
set_hl("Folded", buffer_normal_h)
|
||||
set_hl("SpecialKey", buffer_accent_h)
|
||||
set_hl("ColorColumn", buffer_normal_bg_h)
|
||||
|
||||
-- cursor ----------------------------------------------------------------------
|
||||
local cursor_normal_h = { reverse = true }
|
||||
|
||||
set_hl("CursorLine", cursor_normal_h)
|
||||
set_hl("CursorLineNr", cursor_normal_h)
|
||||
set_hl("CursorLineSign", cursor_normal_h)
|
||||
set_hl("CursorLineFold", cursor_normal_h)
|
||||
set_hl("CursorColumn", cursor_normal_h)
|
||||
set_hl("QuickFixLine", cursor_normal_h)
|
||||
set_hl("Cursor", cursor_normal_h)
|
||||
set_hl("lCursor", cursor_normal_h)
|
||||
set_hl("CursorIM", cursor_normal_h)
|
||||
set_hl("TermCursor", cursor_normal_h)
|
||||
set_hl("TermCursorNC", cursor_normal_h)
|
||||
|
||||
-- match -----------------------------------------------------------------------
|
||||
local match_normal_h = { ctermfg = C.black.cterm,
|
||||
fg = C.black.gui,
|
||||
ctermbg = C.orange.cterm,
|
||||
bg = C.orange.gui }
|
||||
local match_accent_h = { ctermfg = C.black.cterm,
|
||||
fg = C.black.gui,
|
||||
ctermbg = C.magenta.cterm,
|
||||
bg = C.magenta.gui }
|
||||
local match_dimmed_h = { ctermfg = C.magenta.cterm,
|
||||
fg = C.magenta.gui,
|
||||
ctermbg = C.white.cterm,
|
||||
bg = C.white.gui }
|
||||
|
||||
set_hl("Search", match_normal_h)
|
||||
set_hl("Substitute", match_normal_h)
|
||||
set_hl("IncSearch", match_accent_h)
|
||||
set_hl("CurSearch", match_accent_h)
|
||||
set_hl("MatchParen", match_dimmed_h)
|
||||
|
||||
-- selection -------------------------------------------------------------------
|
||||
local selection_normal_h = { ctermfg = C.black.cterm,
|
||||
fg = C.black.gui,
|
||||
ctermbg = C.blue.cterm,
|
||||
bg = C.blue.gui }
|
||||
|
||||
set_hl("Visual", selection_normal_h)
|
||||
set_hl("Visualnos", selection_normal_h)
|
||||
|
||||
-- diff ------------------------------------------------------------------------
|
||||
local diff_add_h = { ctermfg = C.green.cterm, fg = C.green.gui }
|
||||
local diff_change_h = { ctermfg = C.orange.cterm, fg = C.orange.gui }
|
||||
local diff_delete_h = { ctermfg = C.red.cterm, fg = C.red.gui }
|
||||
local diff_text_h = { ctermfg = C.orange.cterm, fg = C.orange.gui, underline = true }
|
||||
|
||||
set_hl("DiffAdd", diff_add_h)
|
||||
set_hl("DiffChange", diff_change_h)
|
||||
set_hl("DiffDelete", diff_delete_h)
|
||||
set_hl("DiffText", diff_text_h)
|
||||
|
||||
-- spell -----------------------------------------------------------------------
|
||||
local spell_error_h = { ctermfg = C.red.cterm, fg = C.red.gui, underline = true }
|
||||
local spell_warn_h = { ctermfg = C.orange.cterm, fg = C.orange.gui, underline = true }
|
||||
|
||||
set_hl("SpellBad", spell_error_h)
|
||||
set_hl("SpellCap", spell_warn_h)
|
||||
set_hl("SpellLocal", spell_warn_h)
|
||||
set_hl("SpellRare", spell_warn_h)
|
||||
|
||||
-- diagnostic ------------------------------------------------------------------
|
||||
local diagnostic_error_h = { ctermfg = C.red.cterm, fg = C.red.gui }
|
||||
local diagnostic_warn_h = { ctermfg = C.orange.cterm, fg = C.orange.gui }
|
||||
local diagnostic_info_h = { ctermfg = C.blue.cterm, fg = C.blue.gui }
|
||||
local diagnostic_hint_h = { ctermfg = C.white.cterm, fg = C.white.gui }
|
||||
local diagnostic_ok_h = { ctermfg = C.green.cterm, fg = C.green.gui }
|
||||
local diagnostic_error_u_h = { ctermfg = C.red.cterm, fg = C.red.gui, underline = true }
|
||||
local diagnostic_warn_u_h = { ctermfg = C.orange.cterm, fg = C.orange.gui, underline = true }
|
||||
local diagnostic_info_u_h = { ctermfg = C.blue.cterm, fg = C.blue.gui, underline = true }
|
||||
local diagnostic_hint_u_h = { ctermfg = C.white.cterm, fg = C.white.gui, underline = true }
|
||||
local diagnostic_ok_u_h = { ctermfg = C.green.cterm, fg = C.green.gui, underline = true }
|
||||
|
||||
set_hl("DiagnosticError", diagnostic_error_h)
|
||||
set_hl("DiagnosticWarn", diagnostic_warn_h)
|
||||
set_hl("DiagnosticInfo", diagnostic_info_h)
|
||||
set_hl("DiagnosticHint", diagnostic_hint_h)
|
||||
set_hl("DiagnosticOk", diagnostic_ok_h)
|
||||
set_hl("DiagnosticVirtualError", diagnostic_error_h)
|
||||
set_hl("DiagnosticVirtualWarn", diagnostic_warn_h)
|
||||
set_hl("DiagnosticVirtualInfo", diagnostic_info_h)
|
||||
set_hl("DiagnosticVirtualHint", diagnostic_hint_h)
|
||||
set_hl("DiagnosticVirtualOk", diagnostic_ok_h)
|
||||
set_hl("DiagnosticUnderlineError", diagnostic_error_u_h)
|
||||
set_hl("DiagnosticUnderlineWarn", diagnostic_warn_u_h)
|
||||
set_hl("DiagnosticUnderlineInfo", diagnostic_info_u_h)
|
||||
set_hl("DiagnosticUnderlineHint", diagnostic_hint_u_h)
|
||||
set_hl("DiagnosticUnderlineOk", diagnostic_ok_u_h)
|
||||
set_hl("DiagnosticFloatingError", diagnostic_error_h)
|
||||
set_hl("DiagnosticFloatingWarn", diagnostic_warn_h)
|
||||
set_hl("DiagnosticFloatingInfo", diagnostic_info_h)
|
||||
set_hl("DiagnosticFloatingHint", diagnostic_hint_h)
|
||||
set_hl("DiagnosticFloatingOk", diagnostic_ok_h)
|
||||
set_hl("DiagnosticSingError", diagnostic_error_h)
|
||||
set_hl("DiagnosticSingWarn", diagnostic_warn_h)
|
||||
set_hl("DiagnosticSingInfo", diagnostic_info_h)
|
||||
set_hl("DiagnosticSingHint", diagnostic_hint_h)
|
||||
set_hl("DiagnosticSingOk", diagnostic_ok_h)
|
||||
set_hl("DiagnosticDeprecated", diagnostic_hint_u_h)
|
||||
set_hl("DiagnosticUnnecessary", diagnostic_hint_u_h)
|
||||
|
||||
-- misc ------------------------------------------------------------------------
|
||||
set_hl("Directory", { ctermfg = C.blue.cterm, fg = C.blue.gui })
|
||||
|
||||
-- syntax ----------------------------------------------------------------------
|
||||
local syntax_normal_h = {}
|
||||
local syntax_comment_h = { ctermfg = C.blue.cterm, fg = C.blue.gui }
|
||||
local syntax_constant_h = { ctermfg = C.red.cterm, fg = C.red.gui }
|
||||
local syntax_identifier_h = {}
|
||||
local syntax_statement_h = { ctermfg = C.orange.cterm, fg = C.orange.gui }
|
||||
local syntax_preproc_h = { ctermfg = C.magenta.cterm, fg = C.magenta.gui }
|
||||
local syntax_type_h = { ctermfg = C.green.cterm, fg = C.green.gui }
|
||||
local syntax_special_h = { ctermfg = C.orange.cterm, fg = C.orange.gui }
|
||||
local syntax_underline_h = { ctermfg = C.blue.cterm, fg = C.blue.gui, underline = true }
|
||||
local syntax_ignore_h = { ctermfg = C.black.cterm, fg = C.black.gui }
|
||||
local syntax_error_h = { ctermfg = C.black.cterm, fg = C.black.gui, ctermbg = C.red.cterm, bg = C.red.gui }
|
||||
local syntax_warn_h = { ctermfg = C.black.cterm, fg = C.black.gui, ctermbg = C.orange.cterm, bg = C.orange.gui }
|
||||
|
||||
local syntax_italic_h = { italic = true }
|
||||
local syntax_bold_h = { bold = true }
|
||||
local syntax_bolditalic_h = { bold = true, italic = true }
|
||||
local syntax_strike_h = { strikethrough = true }
|
||||
|
||||
set_hl("Comment", syntax_comment_h)
|
||||
set_hl("Constant", syntax_constant_h)
|
||||
set_hl("String", syntax_constant_h)
|
||||
set_hl("Character", syntax_constant_h)
|
||||
set_hl("Number", syntax_constant_h)
|
||||
set_hl("Boolean", syntax_constant_h)
|
||||
set_hl("Float", syntax_constant_h)
|
||||
set_hl("Identifier", syntax_identifier_h)
|
||||
set_hl("Function", syntax_identifier_h)
|
||||
set_hl("Statement", syntax_statement_h)
|
||||
set_hl("Conditional", syntax_statement_h)
|
||||
set_hl("Repeat", syntax_statement_h)
|
||||
set_hl("Label", syntax_statement_h)
|
||||
set_hl("Operator", syntax_statement_h)
|
||||
set_hl("Keyword", syntax_statement_h)
|
||||
set_hl("Exception", syntax_statement_h)
|
||||
set_hl("PreProc", syntax_preproc_h)
|
||||
set_hl("Include", syntax_preproc_h)
|
||||
set_hl("Define", syntax_preproc_h)
|
||||
set_hl("Macro", syntax_preproc_h)
|
||||
set_hl("PreCondit", syntax_preproc_h)
|
||||
set_hl("Type", syntax_type_h)
|
||||
set_hl("StorageClass", syntax_type_h)
|
||||
set_hl("Structure", syntax_type_h)
|
||||
set_hl("Typedef", syntax_type_h)
|
||||
set_hl("Special", syntax_special_h)
|
||||
set_hl("SpecialChar", syntax_special_h)
|
||||
set_hl("Tag", syntax_special_h)
|
||||
set_hl("Delimiter", syntax_special_h)
|
||||
set_hl("SpecialComment", syntax_special_h)
|
||||
set_hl("Debug", syntax_special_h)
|
||||
set_hl("Underlined", syntax_underline_h)
|
||||
set_hl("Ignore", syntax_ignore_h)
|
||||
set_hl("Error", syntax_error_h)
|
||||
set_hl("Todo", syntax_warn_h)
|
||||
|
||||
set_hl("Italic", syntax_italic_h)
|
||||
set_hl("Bold", syntax_bold_h)
|
||||
set_hl("BoldItalic", syntax_bolditalic_h)
|
||||
set_hl("Strike", syntax_strike_h)
|
||||
|
||||
-- markdown --------------------------------------------------------------------
|
||||
local markdown_label_h = { ctermfg = C.magenta.cterm, fg = C.magenta.gui }
|
||||
local markdown_delimiter_h = { ctermfg = C.blue.cterm, fg = C.blue.gui }
|
||||
local markdown_underline_h = { ctermfg = C.blue.cterm, fg = C.blue.gui, underline = true }
|
||||
|
||||
set_hl("markdownLabel", markdown_label_h)
|
||||
set_hl("markdownHeadingDelimiter", markdown_delimiter_h)
|
||||
set_hl("markdownItalicDelimiter", markdown_delimiter_h)
|
||||
set_hl("markdownBoldDelimiter", markdown_delimiter_h)
|
||||
set_hl("markdownBoldItalicDelimiter", markdown_delimiter_h)
|
||||
set_hl("markdownStrikeDelimiter", markdown_delimiter_h)
|
||||
set_hl("markdownCodeDelimiter", markdown_delimiter_h)
|
||||
|
||||
set_hl("yamlBlockMappingKey", syntax_comment_h)
|
||||
set_hl("yamlPlainScalar", syntax_constant_h)
|
|
@ -1,154 +0,0 @@
|
|||
local opt, api, cmd = vim.opt, vim.api, vim.cmd
|
||||
local fn, ui = vim.fn, vim.ui
|
||||
|
||||
cmd.colorscheme("basic")
|
||||
|
||||
-- options ---------------------------------------------------------------------
|
||||
opt.undofile = true
|
||||
opt.backup = false
|
||||
opt.writebackup = false
|
||||
opt.mouse = {}
|
||||
opt.title = true
|
||||
|
||||
opt.shortmess:append({ I = true })
|
||||
opt.number = true
|
||||
opt.relativenumber = true
|
||||
opt.signcolumn = "number"
|
||||
opt.textwidth = 80
|
||||
opt.colorcolumn = "+1"
|
||||
|
||||
opt.expandtab = true
|
||||
opt.tabstop = 4
|
||||
opt.shiftwidth = 2
|
||||
opt.softtabstop = -1
|
||||
opt.smarttab = true
|
||||
|
||||
opt.showtabline = 2
|
||||
opt.winbar = "%f%( %h%m%r%y%)"
|
||||
opt.laststatus = 3
|
||||
|
||||
local statusline_group = api.nvim_create_augroup("Statusline", {})
|
||||
local cwd = fn.pathshorten(vim.fn.getcwd())
|
||||
api.nvim_create_autocmd({ "DirChanged" }, {
|
||||
group = statusline_group,
|
||||
callback = function()
|
||||
cwd = fn.pathshorten(vim.fn.getcwd())
|
||||
end
|
||||
})
|
||||
|
||||
function _G.statusline()
|
||||
local wordcount = fn.wordcount()
|
||||
return table.concat({
|
||||
cwd,
|
||||
" %=",
|
||||
" <%b> ",
|
||||
wordcount.visual_chars or wordcount.cursor_chars, "/", wordcount.chars, " ",
|
||||
wordcount.visual_words or wordcount.cursor_words, "/", wordcount.words
|
||||
})
|
||||
end
|
||||
opt.statusline = "%!v:lua.statusline()"
|
||||
|
||||
opt.ignorecase = true
|
||||
opt.infercase = true
|
||||
opt.smartcase = true
|
||||
opt.smartindent = true
|
||||
opt.clipboard = "unnamedplus"
|
||||
opt.whichwrap = {
|
||||
["b"] = true,
|
||||
["s"] = true,
|
||||
["h"] = true,
|
||||
["l"] = true,
|
||||
["<"] = true,
|
||||
[">"] = true,
|
||||
["~"] = true,
|
||||
["["] = true,
|
||||
["]"] = true
|
||||
}
|
||||
opt.wildoptions = { "fuzzy" }
|
||||
opt.wildignorecase = true
|
||||
|
||||
opt.path = ".,,**"
|
||||
|
||||
opt.completeopt = {
|
||||
"menuone",
|
||||
"preview",
|
||||
}
|
||||
|
||||
local terminal_group = api.nvim_create_augroup("Terminal", {})
|
||||
api.nvim_create_autocmd({ "TermOpen" }, {
|
||||
group = terminal_group,
|
||||
callback = function()
|
||||
local opt_l = vim.opt_local
|
||||
opt_l.number = false
|
||||
opt_l.relativenumber = false
|
||||
end
|
||||
})
|
||||
|
||||
-- keymaps ---------------------------------------------------------------------
|
||||
local keymap_set = vim.keymap.set
|
||||
|
||||
keymap_set("n", "<esc>", function()
|
||||
cmd.nohlsearch()
|
||||
end, { desc = "Stop the highlighting for the 'hlsearch' option" })
|
||||
|
||||
keymap_set("c", "<m-h>", "<left>", { desc = "Left in c-mode" })
|
||||
keymap_set("c", "<m-l>", "<right>", { desc = "Right in c-mode" })
|
||||
|
||||
keymap_set("n", "<leader>f", ":find ", { desc = ":find" })
|
||||
keymap_set("n", "<leader>b", ":buffer ", { desc = ":buffer" })
|
||||
keymap_set("n", "<leader>h", ":help ", { desc = ":help" })
|
||||
|
||||
keymap_set("n", "<leader>s", function()
|
||||
vim.opt_local.spell = not(vim.opt_local.spell:get())
|
||||
end, { desc = "Toggle spell" })
|
||||
|
||||
keymap_set("n", "<leader>m", "<cmd>make<cr>", { desc = ":make" })
|
||||
|
||||
keymap_set("n", "<leader>d", "<cmd>enew<cr><cmd>bd #<cr>", { desc = "Delete buffer" })
|
||||
keymap_set("n", "<leader>D", "<cmd>bd<cr>", { desc = "Delete buffer and close window" })
|
||||
|
||||
keymap_set("n", "]b", "<cmd>bnext<cr>", { desc = "Next buffer" })
|
||||
keymap_set("n", "[b", "<cmd>bprev<cr>", { desc = "Previous buffer" })
|
||||
keymap_set("n", "]t", "<cmd>tabnext<cr>", { desc = "Next tab" })
|
||||
keymap_set("n", "[t", "<cmd>tabprevious<cr>", { desc = "Previous tab" })
|
||||
keymap_set("n", "]q", "<cmd>cnext<cr>zz", { desc = "Next quickfix item" })
|
||||
keymap_set("n", "[q", "<cmd>cprev<cr>zz", { desc = "Previous quickfix item" })
|
||||
|
||||
keymap_set("n", "<leader>co", "<cmd>copen<cr>", { desc = "Open quickfix window" })
|
||||
keymap_set("n", "<leader>cc", "<cmd>cclose<cr>", { desc = "Close quickfix window" })
|
||||
|
||||
keymap_set("n", "<leader>g", function()
|
||||
local pattern
|
||||
ui.input({ prompt = ":vimgrep " }, function(input)
|
||||
if not input then return end
|
||||
if input:match("/.+/[gjf]*") then
|
||||
pattern = input
|
||||
else
|
||||
pattern = ("/%s/g"):format(input)
|
||||
end
|
||||
end)
|
||||
if not pattern then return end
|
||||
local file
|
||||
ui.input({
|
||||
prompt = (":vimgrep %s "):format(pattern),
|
||||
default = "**/*"
|
||||
}, function(input)
|
||||
if not input then return end
|
||||
file = input
|
||||
end)
|
||||
if not file then return end
|
||||
cmd.vimgrep(pattern, file)
|
||||
end, { desc = ":vimgrep" })
|
||||
|
||||
keymap_set("i", "<c-f>", "<c-x><c-f>", { desc = "File name completion" })
|
||||
|
||||
-- netrw -----------------------------------------------------------------------
|
||||
local g = vim.g
|
||||
|
||||
g.netrw_use_errorwindow = 0
|
||||
g.netrw_banner = 0
|
||||
g.netrw_bufsettings = "noma nomod nowrap ro nobl"
|
||||
g.netrw_fastbrowse = 0
|
||||
|
||||
keymap_set("n", "<leader>.", "<cmd>Explore .<cr>",
|
||||
{ desc = "Explore current working directory" })
|
|
@ -1,2 +0,0 @@
|
|||
# kratice
|
||||
gl.
|
|
@ -1,257 +0,0 @@
|
|||
# set ##########################################################################
|
||||
|
||||
# keys
|
||||
set $mod mod4
|
||||
set $left h
|
||||
set $down j
|
||||
set $up k
|
||||
set $right l
|
||||
|
||||
# colors
|
||||
set $black #000000
|
||||
set $white #e2e2e2
|
||||
set $blue #856cff
|
||||
set $magenta #ff1170
|
||||
set $red #fa3500
|
||||
set $orange #d06600
|
||||
set $green #009843
|
||||
|
||||
# workspaces
|
||||
set $wsq 0:q:cmd
|
||||
set $wsw 1:w:www
|
||||
set $wse 2:e:txt
|
||||
set $wsr 3:r:doc
|
||||
set $wst 4:t:cmd
|
||||
set $wsy 5:y:cmd
|
||||
set $wsu 6:u:cmd
|
||||
set $wsi 7:i:cmd
|
||||
set $wso 8:o:cmd
|
||||
set $wsp 9:p:rdp
|
||||
|
||||
# modes
|
||||
set $session_mode "session: (r)eload (l)ock (q)uit (s)uspend re(b)oot (p)oweroff"
|
||||
set $layout_mode "layout: split(h) split(v) (s)tacking (t)abbed"
|
||||
|
||||
# commands
|
||||
set $swaylock swaylock -f \
|
||||
--color=$black \
|
||||
--indicator-radius 1200 \
|
||||
--inside-color=$blue \
|
||||
--inside-clear-color=$green \
|
||||
--inside-caps-lock-color=$orange \
|
||||
--inside-ver-color=$magenta \
|
||||
--inside-wrong-color=$red \
|
||||
--text-color=#00000000 \
|
||||
--text-clear-color=#00000000 \
|
||||
--text-ver-color=#00000000 \
|
||||
--text-wrong-color=#00000000
|
||||
|
||||
# bar ##########################################################################
|
||||
bar {
|
||||
separator_symbol " | "
|
||||
status_command status.sh
|
||||
strip_workspace_numbers yes
|
||||
wrap_scroll yes
|
||||
colors {
|
||||
background $black
|
||||
statusline $blue
|
||||
separator $blue
|
||||
# border background text
|
||||
focused_workspace $black $black $magenta
|
||||
active_workspace $black $black $white
|
||||
inactive_workspace $black $black $blue
|
||||
urgent_workspace $black $black $red
|
||||
}
|
||||
}
|
||||
|
||||
# workspace_layout #############################################################
|
||||
workspace_layout tabbed
|
||||
|
||||
# xwayland #####################################################################
|
||||
xwayland disable
|
||||
|
||||
# bindsym ######################################################################
|
||||
# floating
|
||||
bindsym $mod+shift+f floating toggle
|
||||
|
||||
# focus
|
||||
bindsym {
|
||||
$mod+$up focus up
|
||||
$mod+$down focus down
|
||||
$mod+$left focus left
|
||||
$mod+$right focus right
|
||||
$mod+a focus parent
|
||||
$mod+s focus child
|
||||
$mod+g focus mode_toggle
|
||||
}
|
||||
|
||||
# fullscreen
|
||||
bindsym $mod+f fullscreen toggle
|
||||
|
||||
# mode
|
||||
bindsym {
|
||||
$mod+d mode $layout_mode, fullscreen disable
|
||||
$mod+escape mode $session_mode, fullscreen disable
|
||||
}
|
||||
|
||||
# move
|
||||
bindsym {
|
||||
$mod+shift+$up move up
|
||||
$mod+shift+$down move down
|
||||
$mod+shift+$left move left
|
||||
$mod+shift+$right move right
|
||||
--to-code $mod+shift+tab move workspace back_and_forth, workspace back_and_forth
|
||||
--to-code $mod+shift+q move workspace $wsq, workspace $wsq
|
||||
--to-code $mod+shift+w move workspace $wsw, workspace $wsw
|
||||
--to-code $mod+shift+e move workspace $wse, workspace $wse
|
||||
--to-code $mod+shift+r move workspace $wsr, workspace $wsr
|
||||
--to-code $mod+shift+t move workspace $wst, workspace $wst
|
||||
--to-code $mod+shift+y move workspace $wsy, workspace $wsy
|
||||
--to-code $mod+shift+u move workspace $wsu, workspace $wsu
|
||||
--to-code $mod+shift+i move workspace $wsi, workspace $wsi
|
||||
--to-code $mod+shift+o move workspace $wso, workspace $wso
|
||||
--to-code $mod+shift+p move workspace $wsp, workspace $wsp
|
||||
--to-code $mod+shift+bracketleft move workspace prev, workspace prev
|
||||
--to-code $mod+shift+bracketright move workspace next, workspace next
|
||||
$mod+colon move scratchpad
|
||||
}
|
||||
|
||||
# scratchpad
|
||||
bindsym $mod+semicolon scratchpad show
|
||||
|
||||
# sticky
|
||||
bindsym $mod+shift+g sticky toggle
|
||||
|
||||
# exec
|
||||
bindsym {
|
||||
$mod+return exec footclient
|
||||
$mod+shift+return exec foot
|
||||
$mod+space exec fuzzel
|
||||
$mod+shift+space exec "$(fuzzel -d -l 0 -p'$ ')"
|
||||
$mod+slash exec xdg-open "$(find -type f | fuzzel -d -p'$ xdg-open ')"
|
||||
$mod+home exec footclient nmtui connect
|
||||
$mod+shift+home exec footclient nmtui
|
||||
$mod+n exec makoctl dismiss
|
||||
$mod+shift+n exec makoctl restore
|
||||
print exec grim - | wl-copy
|
||||
}
|
||||
|
||||
# exec (laptop)
|
||||
bindsym {
|
||||
XF86AudioRaiseVolume exec wpctl set-volume @DEFAULT_AUDIO_SINK@ 1%+; exec notify-send -e -t 2000 -h string:x-canonical-private-synchronous:audio "$(wpctl get-volume @DEFAULT_AUDIO_SINK@)"
|
||||
XF86AudioLowerVolume exec wpctl set-volume @DEFAULT_AUDIO_SINK@ 1%-; exec notify-send -e -t 2000 -h string:x-canonical-private-synchronous:audio "$(wpctl get-volume @DEFAULT_AUDIO_SINK@)"
|
||||
XF86AudioMute exec wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle; exec notify-send -e -t 2000 -h string:x-canonical-private-synchronous:audio "$(wpctl get-volume @DEFAULT_AUDIO_SINK@)"
|
||||
XF86AudioMicMute exec wpctl set-mute @DEFAULT_AUDIO_SOURCE@ toggle; exec notify-send -e -t 2000 -h string:x-canonical-private-synchronous:audio "$(wpctl get-volume @DEFAULT_AUDIO_SOURCE@)"
|
||||
XF86MonBrightnessUp exec brightnessctl set "+1%"; exec notify-send -e -t 2000 -h string:x-canonical-private-synchronous:brightness "Brightness: $(brightnessctl get)"
|
||||
XF86MonBrightnessDown exec brightnessctl set "1%-"; exec notify-send -e -t 2000 -h string:x-canonical-private-synchronous:brightness "Brightness: $(brightnessctl get)"
|
||||
shift+XF86MonBrightnessUp exec brightnessctl set "+10%"; exec notify-send -e -t 2000 -h string:x-canonical-private-synchronous:brightness "Brightness: $(brightnessctl get)"
|
||||
shift+XF86MonBrightnessDown exec brightnessctl set "10%-"; exec notify-send -e -t 2000 -h string:x-canonical-private-synchronous:brightness "Brightness: $(brightnessctl get)"
|
||||
}
|
||||
|
||||
# resize
|
||||
bindsym {
|
||||
$mod+control+$left resize shrink width
|
||||
$mod+control+$down resize grow height
|
||||
$mod+control+$up resize shrink height
|
||||
$mod+control+$right resize grow width
|
||||
}
|
||||
|
||||
# workspace
|
||||
bindsym {
|
||||
--to-code $mod+tab workspace back_and_forth
|
||||
--to-code $mod+q workspace $wsq
|
||||
--to-code $mod+w workspace $wsw
|
||||
--to-code $mod+e workspace $wse
|
||||
--to-code $mod+r workspace $wsr
|
||||
--to-code $mod+t workspace $wst
|
||||
--to-code $mod+y workspace $wsy
|
||||
--to-code $mod+u workspace $wsu
|
||||
--to-code $mod+i workspace $wsi
|
||||
--to-code $mod+o workspace $wso
|
||||
--to-code $mod+p workspace $wsp
|
||||
--to-code $mod+bracketleft workspace prev
|
||||
--to-code $mod+bracketright workspace next
|
||||
}
|
||||
|
||||
# client.* #####################################################################
|
||||
# class border background text indicator child_border
|
||||
client.focused $magenta $magenta $black $red $black
|
||||
client.focused_inactive $blue $blue $black $black $black
|
||||
client.unfocused $blue $blue $black $black $black
|
||||
client.urgent $red $red $black $black $black
|
||||
|
||||
# default_border ###############################################################
|
||||
default_border normal 0
|
||||
|
||||
# default_floating_border ######################################################
|
||||
default_floating_border normal 0
|
||||
|
||||
# exec #########################################################################
|
||||
exec {
|
||||
systemctl --user import-environment DISPLAY WAYLAND_DISPLAY SWAYSOCK
|
||||
dbus-update-activation-environment --systemd DISPLAY WAYLAND_DISPLAY SWAYSOCK
|
||||
swayidle -w \
|
||||
timeout 300 '$swaylock' \
|
||||
timeout 600 'swaymsg "output * power off"' resume 'swaymsg "output * power on"' \
|
||||
before-sleep '$swaylock'
|
||||
wlsunset -l 45 -L 15
|
||||
mako
|
||||
}
|
||||
|
||||
workspace $wse
|
||||
exec foot -s
|
||||
|
||||
# focus_wrapping ###############################################################
|
||||
focus_wrapping yes
|
||||
|
||||
# font #########################################################################
|
||||
font monospace 13
|
||||
|
||||
# input ########################################################################
|
||||
|
||||
# keyboard
|
||||
input "type:keyboard" {
|
||||
xkb_layout us,si
|
||||
xkb_options caps:escape,grp:alt_shift_toggle
|
||||
repeat_delay 200
|
||||
repeat_rate 30
|
||||
}
|
||||
|
||||
# touchpad
|
||||
input "type:touchpad" {
|
||||
tap enabled
|
||||
}
|
||||
|
||||
# mode #########################################################################
|
||||
|
||||
# session
|
||||
mode $session_mode {
|
||||
bindsym {
|
||||
r reload, mode default
|
||||
l exec $swaylock, mode default
|
||||
q exit, mode default
|
||||
s exec systemctl suspend, mode default
|
||||
b exec systemctl reboot, mode default
|
||||
p exec systemctl poweroff, mode default
|
||||
escape mode default
|
||||
}
|
||||
}
|
||||
|
||||
# layout
|
||||
mode $layout_mode {
|
||||
bindsym {
|
||||
h layout splith, mode default
|
||||
v layout splitv, mode default
|
||||
s layout stacking, mode default
|
||||
t layout tabbed, mode default
|
||||
escape mode default
|
||||
}
|
||||
}
|
||||
|
||||
# seat #########################################################################
|
||||
seat * hide_cursor 1000
|
||||
|
||||
# output #######################################################################
|
||||
output * background $black solid_color
|
||||
|
||||
# vim:
|
|
@ -1,8 +0,0 @@
|
|||
XDG_DOCUMENTS_DIR="$HOME/doc"
|
||||
XDG_DOWNLOAD_DIR="$HOME/net"
|
||||
XDG_DESKTOP_DIR="$HOME/net"
|
||||
XDG_MUSIC_DIR="$HOME/net"
|
||||
XDG_PICTURES_DIR="$HOME/net"
|
||||
XDG_PUBLICSHARE_DIR="$HOME/net"
|
||||
XDG_TEMPLATES_DIR="$HOME/net"
|
||||
XDG_VIDEOS_DIR="$HOME/net"
|
|
@ -0,0 +1,14 @@
|
|||
[Interface]
|
||||
Address = 10.200.200.1/24
|
||||
ListenPort = 1194
|
||||
PrivateKey = <padova private key>
|
||||
|
||||
[Peer]
|
||||
# milano
|
||||
PublicKey = <milano public key>
|
||||
AllowedIPs = 10.200.200.2/32
|
||||
|
||||
[Peer]
|
||||
# napoli
|
||||
PublicKey = <napoli public key>
|
||||
AllowedIPs = 10.200.200.3/32
|
|
@ -1,37 +0,0 @@
|
|||
# girara
|
||||
set completion-bg "#000000"
|
||||
set completion-fg "#856cff"
|
||||
set completion-group-bg "#000000"
|
||||
set completion-group-fg "#d06600"
|
||||
set completion-highlight-bg "#000000"
|
||||
set completion-highlight-fg "#ff1170"
|
||||
set default-fg "#e2e2e2"
|
||||
set default-bg "#000000"
|
||||
set inputbar-bg "#000000"
|
||||
set inputbar-fg "#856cff"
|
||||
set notification-bg "#000000"
|
||||
set notification-fg "#856cff"
|
||||
set notification-error-bg "#000000"
|
||||
set notification-error-fg "#fa3500"
|
||||
set notification-warning-bg "#000000"
|
||||
set notification-warning-fg "#d06600"
|
||||
set statusbar-bg "#000000"
|
||||
set statusbar-fg "#856cff"
|
||||
set font "monospace 13"
|
||||
|
||||
# zathura
|
||||
set highlight-active-color "#ff1170"
|
||||
set highlight-color "#856cff"
|
||||
set highlight-fg "#000000"
|
||||
set index-active-bg "#000000"
|
||||
set index-active-fg "#ff1170"
|
||||
set index-fg "#856cff"
|
||||
set index-bg "#000000"
|
||||
set recolor-darkcolor "#e2e2e2"
|
||||
set recolor-lightcolor "#000000"
|
||||
set render-loading-bg "#000000"
|
||||
set render-loading-fg "#856cff"
|
||||
set signature-error-color "#fa3500"
|
||||
set signature-success-color "#009843"
|
||||
set signature-warning-color "#d06600"
|
||||
set selection-clipboard clipboard
|
|
@ -1,52 +0,0 @@
|
|||
#!/bin/sh
|
||||
|
||||
printf "{\"version\":1}\n"
|
||||
printf "[\n"
|
||||
|
||||
if ! command -v jq >/dev/null; then
|
||||
while true; do
|
||||
printf '[{ "full_text":"jq: command not found", "urgent":true },],'
|
||||
sleep 1
|
||||
done
|
||||
fi
|
||||
|
||||
while true; do
|
||||
printf "["
|
||||
# keyboard layout
|
||||
swaymsg -t get_inputs | jq -Mcj '[.[] | select(.type=="keyboard")][0] |
|
||||
{
|
||||
"full_text":.xkb_active_layout_name,
|
||||
"urgent":.xkb_active_layout_index,
|
||||
}, ","'
|
||||
# battery
|
||||
# shellcheck disable=SC2002
|
||||
cat /sys/class/power_supply/BAT0/capacity | jq -Mcj '
|
||||
if .<20 then
|
||||
{
|
||||
"full_text":([.," %"]|join("")),
|
||||
"urgent":true,
|
||||
}
|
||||
else
|
||||
{
|
||||
"full_text":([.," %"]|join("")),
|
||||
}
|
||||
end, ","'
|
||||
# date
|
||||
date +%c | jq -RMcj '{ "full_text":., }, ","'
|
||||
# scratchpad
|
||||
swaymsg -t get_tree | jq -Mcj '.nodes[] | select(.name=="__i3").nodes[] |
|
||||
select(.name=="__i3_scratch").floating_nodes |
|
||||
{
|
||||
"full_text":length,
|
||||
"urgent":length,
|
||||
}, ","'
|
||||
# notifications
|
||||
makoctl list | jq -Mcj '.data[][0] |
|
||||
{
|
||||
"full_text":.summary.data,
|
||||
"urgent":(.urgency.data==2),
|
||||
}, ","'
|
||||
printf "],"
|
||||
# timeout
|
||||
timeout 1 swaymsg -t subscribe '["input","binding"]' >/dev/null
|
||||
done
|
17
.profile
17
.profile
|
@ -19,12 +19,12 @@ if [ -d "$HOME/.local/bin" ]; then
|
|||
fi
|
||||
|
||||
# xdg base directory specification
|
||||
export XDG_DATA_HOME=$HOME/.local/share
|
||||
export XDG_CONFIG_HOME=$HOME/.config
|
||||
export XDG_CACHE_HOME=$HOME/.cache
|
||||
export XDG_DATA_HOME=$HOME/.local/share
|
||||
export XDG_STATE_HOME=$HOME/.local/state
|
||||
export XDG_DATA_DIRS=/usr/local/share:/usr/share
|
||||
export XDG_CONFIG_DIRS=/etc/xdg
|
||||
export XDG_CACHE_HOME=$HOME/.cache
|
||||
|
||||
# .bash_history
|
||||
export HISTFILE=$XDG_STATE_HOME/bash/history
|
||||
|
@ -34,16 +34,3 @@ fi
|
|||
|
||||
# editor
|
||||
export EDITOR=vi
|
||||
|
||||
# desktop
|
||||
if [ "$(tty)" = "/dev/tty1" ] && command -v sway >/dev/null; then
|
||||
# locale
|
||||
export LANG=sl_SI.UTF-8
|
||||
export LC_MESSAGES=en_US.UTF-8
|
||||
# defaults
|
||||
export TERMINAL=footclient
|
||||
export BROWSER=firefox
|
||||
# run sway
|
||||
export XDG_CURRENT_DESKTOP=sway
|
||||
exec systemd-cat --identifier sway sway
|
||||
fi
|
||||
|
|
62
README.md
62
README.md
|
@ -4,68 +4,30 @@ This repo tracks user and system configuration files, installed packages
|
|||
and initial command history for setting-up a desktop environment running Debian
|
||||
testing/unstable with `sway`, `foot`, `fuzzel` and `neovim`.
|
||||
|
||||
(The `padova` branch tracks configuration files, installed packages and initial
|
||||
command history for setting-up a `wireguard` VPN server.)
|
||||
|
||||
## bootstrap the dotfiles
|
||||
|
||||
```
|
||||
sudo apt install git
|
||||
git init -b main
|
||||
git init -b padova
|
||||
git remote add origin gitea@git.kompot.si:urosm/dot.git
|
||||
git pull origin main
|
||||
git pull origin padova
|
||||
```
|
||||
|
||||
## setup urosm@milano
|
||||
## setup urosm@padova
|
||||
|
||||
```sh
|
||||
# disable the annoying `.sudo_as_admin_successful` file
|
||||
sudo cp -ri .config/sudoers.d /etc/
|
||||
# update to debian testing
|
||||
sudo cp -ri .config/apt /etc/
|
||||
sudo apt update
|
||||
sudo apt full-upgrade
|
||||
# reconfigure locales
|
||||
sudo dpkg-reconfigure locales
|
||||
# configure and start firewall
|
||||
sudo cp -ri .config/nftables.conf /etc/
|
||||
systemctl enable --now nftables.service
|
||||
# configure and install networking
|
||||
sudo cp -ir .config/network /etc/
|
||||
sudo apt install network-manager
|
||||
# install utils
|
||||
sudo apt install udisks2
|
||||
sudo apt install jq
|
||||
# install desktop packages
|
||||
sudo apt install sway
|
||||
sudo apt install swayidle swaylock
|
||||
sudo apt install brightnessctl wlsunset
|
||||
sudo apt install grim
|
||||
sudo apt install mako-notifier libnotify-bin
|
||||
sudo apt install fonts-agave
|
||||
# install neovim
|
||||
sudo apt install neovim wl-clipboard
|
||||
# install and configure audio packages
|
||||
sudo apt install pipewire-audio
|
||||
systemctl --user enable --now wireplumber.service
|
||||
# install writing packages
|
||||
sudo apt install make
|
||||
sudo apt install pandoc
|
||||
sudo apt install texlive-latex-extra
|
||||
sudo apt install texlive-lang-european
|
||||
# install web packages
|
||||
sudo apt install firefox
|
||||
sudo apt install thunderbird
|
||||
# install media packages
|
||||
sudo apt install mpv
|
||||
sudo apt install zathura
|
||||
sudo apt install inkscape
|
||||
# install office packages
|
||||
sudo apt install libreoffice libreoffice-gtk3
|
||||
sudo apt install libreoffice-l10n-sl
|
||||
# install printing and scanning packages
|
||||
sudo apt install cups printer-driver-all
|
||||
sudo adduser urosm lpadmin
|
||||
sudo apt install simple-scan
|
||||
# install pdf processing packages
|
||||
sudo apt install qpdf ocrmypdf
|
||||
# install rdp packages
|
||||
sudo apt install remmina
|
||||
# install and configure wireguard
|
||||
sudo apt install wireguard
|
||||
sudo cp -ri .config/wireguard /etc/
|
||||
sudo wg-quick up padova
|
||||
# configure automatic updates
|
||||
sudo apt install unattended-upgrades apt-listchanges
|
||||
```
|
||||
|
|
Loading…
Reference in New Issue