aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjakobst1n <jakob.stendahl@outlook.com>2024-02-02 17:17:56 +0100
committerjakobst1n <jakob.stendahl@outlook.com>2024-02-02 17:17:56 +0100
commite1b6d486dbde35f4377a077babfac9236c8a446f (patch)
tree0ab5bb6439322bcfa4d87c73ede67cc125c1479b
parent23bd6ccdd2c7e32be30cfd172c0c769755b53884 (diff)
downloaddotfiles-e1b6d486dbde35f4377a077babfac9236c8a446f.tar.gz
dotfiles-e1b6d486dbde35f4377a077babfac9236c8a446f.zip
neovim and waybar things
-rwxr-xr-xCommon/nvim/lua/helper_functions.lua41
-rwxr-xr-xCommon/nvim/lua/plugins.lua13
-rw-r--r--Common/nvim/spell/nb.utf-8.add1
-rw-r--r--Common/nvim/spell/nb.utf-8.add.splbin0 -> 61 bytes
-rwxr-xr-xinstall/install_linux.sh8
-rw-r--r--linux/sway/autostart17
-rw-r--r--linux/sway/config2
-rw-r--r--linux/sway/hid6
-rw-r--r--linux/waybar/config82
-rw-r--r--linux/waybar/style.segmented.css18
10 files changed, 142 insertions, 46 deletions
diff --git a/Common/nvim/lua/helper_functions.lua b/Common/nvim/lua/helper_functions.lua
index 81ad6ca..945473b 100755
--- a/Common/nvim/lua/helper_functions.lua
+++ b/Common/nvim/lua/helper_functions.lua
@@ -118,6 +118,47 @@ vim.api.nvim_create_user_command('A', auto, {bang=false, desc='Enable filetype p
vim.api.nvim_create_user_command('RerunTermCommand', rerun_last_command_in_any_terminal, {bang=false, desc=''})
vim.api.nvim_set_keymap('n', '<F5>', ':lua rerun_last_command_in_any_terminal()<CR>', {noremap = true, silent = true})
+-- Look at history on range or line
+vim.cmd [[
+function! ShowCommitDiff(commit)
+ " Extract the commit hash from the selected line (assuming it's the first word)
+ let commit_hash = split(a:commit)[0]
+
+ tabnew
+ setlocal buftype=nofile
+ setlocal bufhidden=delete
+
+ " Use 'read !command' to insert the output of the git show command into the buffer
+ execute 'read !git show ' . commit_hash
+
+ setlocal nomodifiable
+ set filetype=gitcommit
+ normal! gg
+endfunction
+
+function! GitHistoryForLine(start_line, end_line)
+ " Check if the range encompasses the entire file, which might indicate that no specific range was provided
+ if a:start_line == 1 && a:end_line == line('$')
+ " Default to the current line if it seems like the entire file is being selected
+ let l:start_line = line('.')
+ let l:end_line = l:start_line
+ else
+ let l:start_line = a:start_line
+ let l:end_line = a:end_line
+ endif
+
+ let l:filepath = expand('%:p')
+ let l:git_cmd = 'git log -s --pretty=format:"%h %s (%an)" -L '.l:start_line.','.l:end_line.':"'.l:filepath.'"'
+ let l:options = '--delimiter " " --preview "git show {1}"'
+ call fzf#vim#grep(l:git_cmd, 1, {'options': l:options, 'sink': function('ShowCommitDiff')}, 0)
+endfunction
+
+command! -range=% GitHistoryForLine call GitHistoryForLine(<line1>, <line2>)
+nnoremap <leader><leader>s :GitHistoryForLine<CR>
+vnoremap <leader><leader>s :'<,'>GitHistoryForLine<CR>
+]]
+
+
-- Close buffer without closing window
--[[
vim.cmd [[
diff --git a/Common/nvim/lua/plugins.lua b/Common/nvim/lua/plugins.lua
index d9ae65f..65b7d05 100755
--- a/Common/nvim/lua/plugins.lua
+++ b/Common/nvim/lua/plugins.lua
@@ -76,14 +76,17 @@ return require('packer').startup(function(use)
-- fzf (Fuzzy finder for various things)
use {
'junegunn/fzf.vim',
- requires = { 'kyazdani42/nvim-web-devicons' },
+ requires = { 'junegunn/fzf', 'kyazdani42/nvim-web-devicons' },
config = function()
vim.cmd [[
let g:fzf_layout = { 'down': '40%' }
+ autocmd! FileType fzf
+ autocmd FileType fzf set laststatus=0 noshowmode noruler
+ \| autocmd BufLeave <buffer> set laststatus=2 showmode ruler
]]
map("n", ";", ":Files<cr>", silentnoremap)
map("n", "<leader>;", ":Rg<cr>", silentnoremap)
- map("n", "<leader><leader>;", ":BLines<cr>", silentnoremap)
+ map("n", "<leader><leader>;", ":Lines<cr>", silentnoremap)
end,
}
@@ -180,10 +183,10 @@ return require('packer').startup(function(use)
},
},
{
- path = '~/Nextcloud/wiki/M42',
+ path = '~/Nextcloud/1-Prosjekter/101-masteroppgave/101.02-quick-notes',
syntax = 'markdown',
ext = 'md',
- name = 'M42',
+ name = 'P101',
auto_toc = 1,
nested_syntaxes = {
python = 'python',
@@ -191,7 +194,7 @@ return require('packer').startup(function(use)
},
},
{
- path = '~/Nextcloud/wiki/P01/',
+ path = '~/Nextcloud/',
syntax = 'markdown',
ext = 'md',
name = 'P01',
diff --git a/Common/nvim/spell/nb.utf-8.add b/Common/nvim/spell/nb.utf-8.add
new file mode 100644
index 0000000..aab906d
--- /dev/null
+++ b/Common/nvim/spell/nb.utf-8.add
@@ -0,0 +1 @@
+meldingsutveksling
diff --git a/Common/nvim/spell/nb.utf-8.add.spl b/Common/nvim/spell/nb.utf-8.add.spl
new file mode 100644
index 0000000..b8c156a
--- /dev/null
+++ b/Common/nvim/spell/nb.utf-8.add.spl
Binary files differ
diff --git a/install/install_linux.sh b/install/install_linux.sh
index 0ac2111..e0d64ca 100755
--- a/install/install_linux.sh
+++ b/install/install_linux.sh
@@ -25,7 +25,7 @@ function dlgYN() {
dlgYN "> Install \"Highlight, atool, w3m, mediainfo, vim, git\"" res
if [ $res -eq 1 ]; then
tput sc
- $INST_PM highlight atool w3m mediainfo curl zsh vim git python3-pip zsh tmux nodejs
+ $INST_PM highlight atool w3m mediainfo curl zsh vim git python3-pip zsh tmux nodejs catimg ripgrep silversearcher-ag
tput rc; tput ed
fi
@@ -83,7 +83,11 @@ fi
dlgYN "> Install sway" res
if [ $res -eq 1 ]; then
tput sc
- $INST_PM sway swayidle physlock alacritty blueman network-manager-gnome wob wlogout wofi brightnessctl clipman
+ if [ "$distro" == "fedora" ]; then
+ $INST_PM sway swayidle alacritty blueman wob wlogout wofi brightnessctl clipman xwayland seahorse fcitx5 im-config
+ else
+ $INST_PM sway swayidle physlock alacritty blueman network-manager-gnome wob wlogout wofi brightnessctl clipman xwayland seahorse fcitx5 imsettings
+ fi
tput rc; tput ed
fi
diff --git a/linux/sway/autostart b/linux/sway/autostart
index 2d5eae7..3e53a79 100644
--- a/linux/sway/autostart
+++ b/linux/sway/autostart
@@ -2,9 +2,11 @@
exec dbus-update-activation-environment --systemd DISPLAY WAYLAND_DISPLAY SWAYSOCK
# screen locking
-exec swayidle timeout 1200 physlock \
- timeout 1800 'swaymsg "output * dpms off"' \
- resume 'swaymsg "output * dpms on"'
+exec swayidle -w \
+ timeout 300 'swaymsg "output * dpms off"' \
+ timeout 3600 physlock \
+ resume 'swaymsg "output * dpms on"' \
+ before-sleep physlock
# notification centre
exec swaync
@@ -24,3 +26,12 @@ exec wl-paste -t text --watch clipman store --no-persist
# Nice color hues in the evenings
exec wlsunset -l 59.9614 -L 10.925 -t 4500 -T 6500 -g 1.0
+# start nextcloud
+exec_always nextcloud --background
+
+# gnome keyring daemon
+exec_always eval $(gnome-keyring-daemon --start)
+exec_always export SSH_AUTH_SOCK
+
+# IME
+exec_always fcitx5 -d
diff --git a/linux/sway/config b/linux/sway/config
index a772cd6..fb4afe5 100644
--- a/linux/sway/config
+++ b/linux/sway/config
@@ -47,7 +47,7 @@ bindsym $Mod+Return exec alacritty
bindsym $Mod+w exec firefox
bindsym $Mod+f exec thunar
bindsym $Mod+c exec swaync-client -t
-bindsym Mod1+l exec nwg-lock
+bindsym Mod1+l exec physlock
bindsym $Mod+d exec wofi --show=drun
# Exit menu
diff --git a/linux/sway/hid b/linux/sway/hid
index 7ef3f70..23ad103 100644
--- a/linux/sway/hid
+++ b/linux/sway/hid
@@ -1,3 +1,7 @@
+output eDP-1 {
+ scale 1.4
+}
+
input "type:keyboard" {
xkb_layout us,no
repeat_delay 300
@@ -8,7 +12,7 @@ input "type:keyboard" {
input "type:touchpad" {
pointer_accel 0.0
- natural_scroll disabled
+ natural_scroll enabled
scroll_factor 1.0
scroll_method two_finger
left_handed disabled
diff --git a/linux/waybar/config b/linux/waybar/config
index 1f720dd..8a53674 100644
--- a/linux/waybar/config
+++ b/linux/waybar/config
@@ -1,14 +1,37 @@
{
// "layer": "top", // Waybar at top layer
// "position": "bottom", // Waybar position (top|bottom|left|right)
- //"height": 0, // Waybar height (to be removed for auto height)
+ // "height": 0, // Waybar height (to be removed for auto height)
// "width": 1280, // Waybar width
"spacing": 0, // Gaps between modules (4px)
- // Choose the order of the modules
- "modules-left": ["sway/workspaces", "sway/mode", "sway/scratchpad", "custom/media"],
- "modules-center": ["clock"],
- "modules-right": ["temperature", "mpd", "cpu", "memory", "idle_inhibitor", "sway/language", "pulseaudio", "battery", "battery#bat2", "tray"],
- // Modules configuration
+
+ "modules-left": [
+ "sway/workspaces",
+ "sway/mode",
+ "sway/scratchpad"
+ ],
+
+ "modules-center": [
+ "clock",
+ "privacy",
+ ],
+
+ //"modules-right": ["temperature", "mpd", "cpu", "memory", "idle_inhibitor", "", "sway/language", "pulseaudio", "battery", "battery#bat2", "tray"],
+ "modules-right": [
+ "temperature",
+ "mpd",
+ "cpu",
+ "memory",
+ "idle_inhibitor",
+ "custom/notification",
+ "pulseaudio",
+ "battery",
+ "battery#bat2",
+ "tray"
+ ],
+
+
+
"sway/workspaces": {
//"disable-scroll": true,
//"all-outputs": true,
@@ -33,6 +56,24 @@
"unlocked": ""
}
},
+ "privacy": {
+ "icon-spacing": 4,
+ "transition-duration": 250,
+ "modules": [
+ {
+ "type": "screenshare",
+ "tooltip": true,
+ },
+ {
+ "type": "audio-out",
+ "tooltip": true,
+ },
+ {
+ "type": "audio-in",
+ "tooltip": true,
+ },
+ ]
+ },
"sway/mode": {
"format": "<span style=\"italic\">{}</span>"
},
@@ -83,7 +124,8 @@
"clock": {
// "timezone": "America/New_York",
"tooltip-format": "<big>{:%Y %B}</big>\n<tt><small>{calendar}</small></tt>",
- "format-alt": "{:%Y-%m-%d}"
+ "format-alt": "{:%H:%M}",
+ "format": "{:%H:%M (%d/%m/%Y)}",
},
"cpu": {
"format-critical": " {usage}%",
@@ -161,17 +203,25 @@
},
"on-click": "pavucontrol"
},
- "custom/media": {
- "format": "{icon} {}",
- "return-type": "json",
- "max-length": 40,
+ "custom/notification": {
+ "tooltip": false,
+ "format": "{icon}",
"format-icons": {
- "spotify": "",
- "default": "🎜"
+ "notification": "<span foreground='red'><sup></sup></span>",
+ "none": "",
+ "dnd-notification": "<span foreground='red'><sup></sup></span>",
+ "dnd-none": "",
+ "inhibited-notification": "<span foreground='red'><sup></sup></span>",
+ "inhibited-none": "",
+ "dnd-inhibited-notification": "<span foreground='red'><sup></sup></span>",
+ "dnd-inhibited-none": ""
},
- "escape": true,
- "exec": "$HOME/.config/waybar/mediaplayer.py 2> /dev/null" // Script in resources folder
- // "exec": "$HOME/.config/waybar/mediaplayer.py --player spotify 2> /dev/null" // Filter player based on name
+ "return-type": "json",
+ "exec-if": "which swaync-client",
+ "exec": "swaync-client -swb",
+ "on-click": "sleep 0.1 && swaync-client -t -sw",
+ "on-click-right": "sleep 0.1 && swaync-client -d -sw",
+ "escape": true
}
}
diff --git a/linux/waybar/style.segmented.css b/linux/waybar/style.segmented.css
index 9d994ca..0d0af78 100644
--- a/linux/waybar/style.segmented.css
+++ b/linux/waybar/style.segmented.css
@@ -20,24 +20,6 @@ window#waybar.hidden {
opacity: 0.2;
}
-/*
-window#waybar.empty {
- background-color: transparent;
-}
-window#waybar.solo {
- background-color: #FFFFFF;
-}
-*/
-
-window#waybar.termite {
- background-color: #3F3F3F;
-}
-
-window#waybar.chromium {
- background-color: #000000;
- border: none;
-}
-
#workspaces button {
padding: 0 5px;
padding-top: 4px;