moved all of my config into this nix flake
This commit is contained in:
109
common/programms/alacritty.nix
Normal file
109
common/programms/alacritty.nix
Normal file
@@ -0,0 +1,109 @@
|
||||
{ ... }:
|
||||
{
|
||||
home-manager.users.me.programms.alacritty = {
|
||||
enable = true;
|
||||
settings = {
|
||||
font = {
|
||||
normal = {
|
||||
family = "Hack";
|
||||
style = "Regular";
|
||||
};
|
||||
|
||||
bold = {
|
||||
family = "Hack";
|
||||
style = "Bold";
|
||||
};
|
||||
|
||||
italic = {
|
||||
family = "Hack";
|
||||
style = "Italic";
|
||||
};
|
||||
|
||||
bold_italic = {
|
||||
family = "Hack";
|
||||
style = "Bold Italic";
|
||||
};
|
||||
|
||||
size = 10;
|
||||
};
|
||||
|
||||
# Dracula theme for alacritty
|
||||
colors = {
|
||||
primary = {
|
||||
background = "#282a36";
|
||||
foreground = "#f8f8f2";
|
||||
bright_foreground = "#ffffff";
|
||||
};
|
||||
cursor = {
|
||||
text = "CellBackground";
|
||||
cursor = "CellForeground";
|
||||
};
|
||||
vi_mode_cursor = {
|
||||
text = "CellBackground";
|
||||
cursor = "CellForeground";
|
||||
};
|
||||
search = {
|
||||
matches = {
|
||||
foreground = "#44475a";
|
||||
background = "#50fa7b";
|
||||
};
|
||||
focused_match = {
|
||||
foreground = "#44475a";
|
||||
background = "#ffb86c";
|
||||
};
|
||||
};
|
||||
footer_bar = {
|
||||
background = "#282a36";
|
||||
foreground = "#f8f8f2";
|
||||
};
|
||||
hints = {
|
||||
start = {
|
||||
foreground = "#282a36";
|
||||
background = "#f1fa8c";
|
||||
};
|
||||
end = {
|
||||
foreground = "#f1fa8c";
|
||||
background = "#282a36";
|
||||
};
|
||||
};
|
||||
line_indicator = {
|
||||
foreground = "None";
|
||||
background = "None";
|
||||
};
|
||||
selection = {
|
||||
text = "CellForeground";
|
||||
background = "#44475a";
|
||||
};
|
||||
normal = {
|
||||
black = "#21222c";
|
||||
red = "#ff5555";
|
||||
green = "#50fa7b";
|
||||
yellow = "#f1fa8c";
|
||||
blue = "#bd93f9";
|
||||
magenta = "#ff79c6";
|
||||
cyan = "#8be9fd";
|
||||
white = "#f8f8f2";
|
||||
};
|
||||
bright = {
|
||||
black = "#6272a4";
|
||||
red = "#ff6e6e";
|
||||
green = "#69ff94";
|
||||
yellow = "#ffffa5";
|
||||
blue = "#d6acff";
|
||||
magenta = "#ff92df";
|
||||
cyan = "#a4ffff";
|
||||
white = "#ffffff";
|
||||
};
|
||||
};
|
||||
|
||||
key_bindings = [
|
||||
{ key = "V"; mods = "Control|Shift"; action = "Paste"; }
|
||||
{ key = "C"; mods = "Control|Shift"; action = "Copy"; }
|
||||
{ key = "J"; mods = "Control"; chars = ''\x1b\x5b\x42''; }
|
||||
{ key = "K"; mods = "Control"; chars = ''x1b\x5b\x41''; }
|
||||
{ key = "H"; mods = "Control"; chars = ''x1b\x5b\x44''; }
|
||||
{ key = "L"; mods = "Control"; chars = ''x1b\x5b\x43''; }
|
||||
];
|
||||
};
|
||||
};
|
||||
}
|
||||
250
common/programms/bash.nix
Normal file
250
common/programms/bash.nix
Normal file
@@ -0,0 +1,250 @@
|
||||
{ persistentDir, confDir, ... }:
|
||||
{
|
||||
home-manager.users.me.programs.bash = {
|
||||
|
||||
enable = true;
|
||||
enableCompletion = true;
|
||||
|
||||
historyFile = "${persistentDir}/bash-history";
|
||||
historyFileSize = 100000;
|
||||
historyControl = "ignoredups";
|
||||
historyIgnore = [
|
||||
"ls"
|
||||
"cd"
|
||||
"exit"
|
||||
];
|
||||
|
||||
shellOptions = [
|
||||
# append to the history file, don't overwrite it
|
||||
"histappend"
|
||||
|
||||
# check the window size after each command and, if necessary,
|
||||
# update the values of LINES and COLUMNS.
|
||||
"checkwinsize"
|
||||
|
||||
# If set, the pattern "**" used in a pathname expansion context will
|
||||
# match all files and zero or more directories and subdirectories.
|
||||
"globstar"
|
||||
];
|
||||
|
||||
sessionVariables = {
|
||||
# is needed to that ssh works
|
||||
TREM = "xterm";
|
||||
|
||||
# my prompt
|
||||
PS1 = ''\[\033[01;34m\]\W\[\033[00m\]\[\033[01;32m\]\[\033[00m\] ❯❯❯ '';
|
||||
};
|
||||
|
||||
shellAliases = {
|
||||
shutdown = "echo try harder.... xD";
|
||||
npw = "nmcli c up pw";
|
||||
nixre = "sd nixos-rebuild switch --flake ~/work/config/nix --impure";
|
||||
flex = "neofetch | lolcat";
|
||||
kwoche = "curl https://kalenderwoche.celll.net/?api=1; echo";
|
||||
psg = "ps -e | grep";
|
||||
vilias = "nvim -c 'set syntax=bash' ${confDir}/common/programs/bash.nix";
|
||||
stl = "sudo systemctl";
|
||||
vim = "nvim";
|
||||
sl = "ls";
|
||||
virsh = "virsh -c qemu:///system";
|
||||
nmgui = "nm-applet 2>&1 > /dev/null &; stalonetray 2>&1 > /dev/null; killall nm-applet";
|
||||
c = "cd ..";
|
||||
ne= "alacritty &";
|
||||
cbs = "history | tail -n 2 | head -n 1 | awk '{\$1=\"\"; print \$0}' | cut -c 2- | cb";
|
||||
gs = "git status";
|
||||
gitlog = "git log --all --graph";
|
||||
ipa= ''
|
||||
echo -e "IPv4:\n-----------------"
|
||||
ip -o a show | cut -d " " -f 2,7 | grep -v : | column -t
|
||||
echo -e "\nIPv6:\n-----------------"
|
||||
ip -o a show | cut -d " " -f 2,7 | grep : | column -t
|
||||
'';
|
||||
};
|
||||
|
||||
bashrcExtra = ''
|
||||
# If not running interactively, don't do anything
|
||||
case $- in
|
||||
*i*) ;;
|
||||
*) return;;
|
||||
esac
|
||||
|
||||
|
||||
# make less more friendly for non-text input files, see lesspipe(1)
|
||||
[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)"
|
||||
|
||||
# making reverse search "going back" work with strg+s
|
||||
stty -ixon
|
||||
|
||||
|
||||
#################### functions ####################
|
||||
|
||||
# A shortcut function that simplifies usage of xclip.
|
||||
# - Accepts input from either stdin (pipe), or params.
|
||||
# ------------------------------------------------
|
||||
cb() {
|
||||
local _scs_col="\e[0;32m"; local _wrn_col='\e[1;31m'; local _trn_col='\e[0;33m'
|
||||
# Check that xclip is installed.
|
||||
if ! type xclip > /dev/null 2>&1; then
|
||||
echo -e "$_wrn_col""You must have the 'xclip' program installed.\e[0m"
|
||||
# Check user is not root (root doesn't have access to user xorg server)
|
||||
elif [[ "$USER" == "root" ]]; then
|
||||
echo -e "$_wrn_col""Must be regular user (not root) to copy a file to the clipboard.\e[0m"
|
||||
else
|
||||
# If no tty, data should be available on stdin
|
||||
if ! [[ "$( tty )" == /dev/* ]]; then
|
||||
input="$(< /dev/stdin)"
|
||||
# Else, fetch input from params
|
||||
else
|
||||
input="$*"
|
||||
fi
|
||||
if [ -z "$input" ]; then # If no input, print usage message.
|
||||
echo "Copies a string to the clipboard."
|
||||
echo "Usage: cb <string>"
|
||||
echo " echo <string> | cb"
|
||||
else
|
||||
# Copy input to clipboard
|
||||
echo -n "$input" | xclip -selection c
|
||||
# Truncate text for status
|
||||
if [ ''${#input} -gt 80 ]; then input="$(echo $input | cut -c1-80)$_trn_col...\e[0m"; fi
|
||||
# Print status.
|
||||
echo -e "$_scs_col""Copied to clipboard:\e[0m $input"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
# a little programm, that changes the ssh config to always be able to acces rpi
|
||||
function rpi(){
|
||||
if [ "$1" == "l" ]
|
||||
then
|
||||
cp ~/work/config/ssh/rpi/local ~/work/config/ssh/current_pi_config
|
||||
fi
|
||||
|
||||
if [ "$1" == "local" ]
|
||||
then
|
||||
cp ~/work/config/ssh/rpi/local ~/work/config/ssh/current_pi_config
|
||||
fi
|
||||
|
||||
if [ "$1" == "r" ]
|
||||
then
|
||||
cp ~/work/config/ssh/rpi/remote ~/work/config/ssh/current_pi_config
|
||||
fi
|
||||
|
||||
if [ "$1" == "remote" ]
|
||||
then
|
||||
cp ~/work/config/ssh/rpi/remote ~/work/config/ssh/current_pi_config
|
||||
fi
|
||||
|
||||
if [ "$1" == "w" ]
|
||||
then
|
||||
cp ~/work/config/ssh/rpi/wstunnel ~/work/config/ssh/current_pi_config
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
|
||||
# while true -> do cat.....
|
||||
function follow (){
|
||||
while true;
|
||||
do
|
||||
cat $@;
|
||||
done
|
||||
}
|
||||
|
||||
|
||||
# little looping func
|
||||
function loop (){
|
||||
if [ "$1" == "-s" ]
|
||||
then
|
||||
for (( i=1; i<=$3; i++ )); do sleep $2; ''${@:4}; done
|
||||
return
|
||||
fi
|
||||
case $1 in
|
||||
${"''"}|*[!0-9]*)
|
||||
# infinit iterations
|
||||
while true; do $@; done
|
||||
return
|
||||
;;
|
||||
*) ;;
|
||||
esac
|
||||
for (( i=1; i<=$1; i++ ));do ''${@:2}; done
|
||||
}
|
||||
|
||||
|
||||
function psk(){
|
||||
ps -e | grep $1 | awk '{print $1}' | xargs kill
|
||||
}
|
||||
|
||||
|
||||
sd() {
|
||||
if [ "$1" == "" ]
|
||||
then
|
||||
sudo $(history | tail -n 2 | head -n 1 | awk '{$1=""; print $0}')
|
||||
else
|
||||
sudo $@
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
# rech
|
||||
function rech(){
|
||||
python3 -c "print($@)"
|
||||
}
|
||||
|
||||
|
||||
# map
|
||||
function map(){
|
||||
if [ "$1" == "" ]
|
||||
then
|
||||
bash ~/work/virtchord/reset
|
||||
xmodmap \
|
||||
-e "clear control" \
|
||||
-e "clear mod1" \
|
||||
-e "keycode 64 = Control_L" \
|
||||
-e "keycode 37 = Alt_L" \
|
||||
-e "add control = Control_L" \
|
||||
-e "add mod1 = Alt_L"
|
||||
|
||||
xset r rate 130 85
|
||||
|
||||
elif [ "$1" != "" ]
|
||||
then
|
||||
echo -en "set-map $1" > ~/work/config/virtchord/pipe1
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
# cf - copy file
|
||||
function cf() { cat "$1" | cb; }
|
||||
|
||||
|
||||
# shorter zathura
|
||||
function zath(){
|
||||
zathura "$@" 2>/dev/null &
|
||||
}
|
||||
|
||||
|
||||
# shorter mupdf
|
||||
function mu(){
|
||||
mupdf "$@" 1>/dev/null 2>/dev/null &
|
||||
}
|
||||
|
||||
|
||||
# ipaa
|
||||
function ipaa(){
|
||||
ip -json addr show $1 | jq -r '.[] | .addr_info[] | select(.family == "inet") | .local'
|
||||
}
|
||||
|
||||
|
||||
#################### completions ####################
|
||||
complete -cf sudo
|
||||
complete -cf sd
|
||||
complete -W "start stop restart status daemon-reload" stl
|
||||
|
||||
# run
|
||||
complete -W "mnt-wechner sync-school wstunnel hibernate p speed-test-nixos-iso bat bstat mnt-files-local mnt-lan-local mnt-files-remote mnt-lan-remote" ru
|
||||
|
||||
|
||||
'';
|
||||
};
|
||||
}
|
||||
6
common/programms/emacs.nix
Normal file
6
common/programms/emacs.nix
Normal file
@@ -0,0 +1,6 @@
|
||||
{ inputs, ... }:
|
||||
{
|
||||
home-manager.users.me.programms.emcas = {
|
||||
enable = true;
|
||||
};
|
||||
}
|
||||
11
common/programms/git.nix
Normal file
11
common/programms/git.nix
Normal file
@@ -0,0 +1,11 @@
|
||||
{ ... }:
|
||||
{
|
||||
home-manager.users.me.programms.git = {
|
||||
enable = true;
|
||||
userName = "Sebastian Moser";
|
||||
userEmail = "sewi.moser@gmail.com";
|
||||
|
||||
extraConfig.core.editor = "nvim";
|
||||
extraConfig.core.excludesfile = "gitignore";
|
||||
};
|
||||
}
|
||||
38
common/programms/lf/default.nix
Normal file
38
common/programms/lf/default.nix
Normal file
@@ -0,0 +1,38 @@
|
||||
{ pkgs, ... }:
|
||||
{
|
||||
home-manager.users.me.programs.lf = {
|
||||
package = pkgs.lf.overrideAttrs (final: prev: {
|
||||
patches = (prev.patches or [ ]) ++ [
|
||||
lib/patches/lf-filter.patch
|
||||
];
|
||||
checkPhase = "";
|
||||
});
|
||||
|
||||
enable = true;
|
||||
commands = {
|
||||
dragon-out = ''%${pkgs.xdragon}/bin/xdragon -a -x "$fx"'';
|
||||
editor-open = ''$$EDITOR $f'';
|
||||
mkdir = ''
|
||||
''${{
|
||||
printf "Directory Name: "
|
||||
read DIR
|
||||
mkdir $DIR
|
||||
}}
|
||||
'';
|
||||
};
|
||||
settings = {
|
||||
preview = true;
|
||||
drawbox = true;
|
||||
icons = true;
|
||||
};
|
||||
keybindings = {
|
||||
"." = "set hidden!";
|
||||
"<enter>" = "open";
|
||||
do = "dragon-out";
|
||||
"gh" = "cd";
|
||||
"g/" = "/";
|
||||
ee = "editor-open";
|
||||
V = ''$${pkgs.bat}/bin/bat --paging=always --theme=gruvbox "$f"'';
|
||||
};
|
||||
|
||||
}
|
||||
13
common/programms/lf/lf-filter.patch
Normal file
13
common/programms/lf/lf-filter.patch
Normal file
@@ -0,0 +1,13 @@
|
||||
diff --git a/nav.go b/nav.go
|
||||
index c32fc97..95cc2ce 100644
|
||||
--- a/nav.go
|
||||
+++ b/nav.go
|
||||
@@ -1774,7 +1774,7 @@ func searchMatch(name, pattern string) (matched bool, err error) {
|
||||
if gOpts.globsearch {
|
||||
return filepath.Match(pattern, name)
|
||||
}
|
||||
- return strings.Contains(name, pattern), nil
|
||||
+ return strings.HasPrefix(name, pattern), nil
|
||||
}
|
||||
|
||||
func (nav *nav) searchNext() (bool, error) {
|
||||
504
common/programms/neovim.nix
Normal file
504
common/programms/neovim.nix
Normal file
@@ -0,0 +1,504 @@
|
||||
{ pkgs, ... }:
|
||||
{
|
||||
home-manager.users.me.programms.neovim = {
|
||||
enable = true;
|
||||
withPython3 = true;
|
||||
withNodeJs = true;
|
||||
plugins = with pkgs.vimPlugins; [
|
||||
haskell-vim
|
||||
plenary-nvim
|
||||
# typst ... TODO
|
||||
rust-vim
|
||||
dracula-vim
|
||||
];
|
||||
|
||||
coc.enable = true;
|
||||
coc.settings = {
|
||||
"rust-analyzer.server.path" = "/etc/profiles/per-user/me/bin/rust-analyzer";
|
||||
"coc.preferences.extensionUpdateCheck" = "never";
|
||||
"cSpellExt.enableDictionaries" = [ "german" ];
|
||||
"cSpell.language" = "en,de";
|
||||
"rust-analyzer.enable" = true;
|
||||
"rust-analyzer.diagnostics.enable" = true;
|
||||
"rust-analyzer.checkOnSave.enable" = false;
|
||||
"languageserver" = {
|
||||
"vhdl" = {
|
||||
"command" = "/home/sebastian/work/config/nvim/language-servers/vhdl/vhdl-tool";
|
||||
"args" = [ "lsp" ];
|
||||
"filetypes" = [ "vhdl" ];
|
||||
};
|
||||
"csharp-ls" = {
|
||||
"command" = "csharp-ls";
|
||||
"filetypes" = [ "cs" ];
|
||||
"rootPatterns" = [ "*.csproj" ".vim/" ".git/" ".hg/" ];
|
||||
};
|
||||
"nix" = {
|
||||
"command" = "nil";
|
||||
"filetypes" = [ "nix" ];
|
||||
"rootPatterns" = [ "flake.nix" ];
|
||||
};
|
||||
};
|
||||
"svelte.enable-ts-plugin" = true;
|
||||
};
|
||||
|
||||
extraConfig = ''
|
||||
|
||||
syntax enable
|
||||
filetype plugin indent on
|
||||
|
||||
" the nord colorscheme
|
||||
"source ~/.config/nvim/plugins/nord-vim/colors/nord.vim
|
||||
colorscheme dracula
|
||||
|
||||
autocmd BufReadPost * call Setup()
|
||||
|
||||
function Setup()
|
||||
if index(["typst", "haskell", "tex", "c", "rust", "js", "vhdl"], &syntax) >= 0
|
||||
execute "call Setup_" . &syntax . "()"
|
||||
endif
|
||||
endfunction
|
||||
|
||||
""""""""""""""""""""""""""""" mappings """""""""""""""""""""""""""""
|
||||
nmap <LEFT> gT
|
||||
map <RIGHT> gt
|
||||
imap <LEFT> <ESC>gT
|
||||
imap <RIGHT> <ESC>gt
|
||||
|
||||
map <C-l> gt
|
||||
map <C-h> gT
|
||||
imap <C-l> <ESC>gt
|
||||
imap <C-h> <ESC>gT
|
||||
|
||||
:tnoremap <Esc> <C-\><C-n>
|
||||
:tmap <C-h> <Esc><C-h>
|
||||
:tmap <C-l> <Esc><C-l>
|
||||
|
||||
|
||||
cnoreabbrev ta Te
|
||||
cnoreabbrev hh TSHighlightCapturesUnderCursor
|
||||
|
||||
nnoremap ga :call CocActionAsync('doHover')<ENTER>
|
||||
nnoremap gd :call CocActionAsync('jumpDefinition')<ENTER>
|
||||
|
||||
nmap <C-,> A;<Esc>
|
||||
|
||||
nmap <C-d> <C-d>zz
|
||||
nmap <C-u> <C-u>zz
|
||||
|
||||
nmap # *
|
||||
|
||||
nmap ' /aöeiääääaöfj<ENTER>:<ESC>
|
||||
|
||||
nmap j gj
|
||||
nmap k gk
|
||||
nmap 0 g0
|
||||
nmap $ g$
|
||||
inoremap <C-BS> <ESC>bcw
|
||||
|
||||
cnoreabbrev s set filetype=javascriptreact
|
||||
|
||||
nnoremap <C-n> <cmd>lua require('renamer').rename()<cr>
|
||||
|
||||
"cmap t <TAB>
|
||||
"cmap <C-j> <C-i>
|
||||
"cnoremap <C-k> <S-TAB>
|
||||
"cnoremap <C-i> <C-n>
|
||||
"cnoremap <TAB> <C-n>
|
||||
"cnoremap <C-j> <C-i>
|
||||
"cnoremap <C-j> <TAB>
|
||||
"cnoremap <C-n> <TAB>
|
||||
noremap <ENTER> i<ENTER>
|
||||
set nohlsearch
|
||||
set backupdir=~/.local/state/nvim/backup
|
||||
|
||||
cnoreabbrev cdf :lcd %:p:h
|
||||
cnoreabbrev tspell call CocAction('toggleExtension', 'coc-spell-checker')
|
||||
|
||||
|
||||
|
||||
""""""""""""""""""""""""""""" neovide """""""""""""""""""""""""""""
|
||||
|
||||
" Being able to paste system clipboard in neovide
|
||||
imap <C-v> <ESC>"+pi
|
||||
nmap <C-v> "+p
|
||||
|
||||
vmap <C-c> "+y
|
||||
|
||||
|
||||
let g:neovide_cursor_vfx_mode = "wireframe"
|
||||
set guifont=Hack:h10
|
||||
"set guifont=Monospace:h6
|
||||
|
||||
|
||||
|
||||
""""""""""""""""""""""""""""" coc """""""""""""""""""""""""""""
|
||||
|
||||
imap <C-k> <UP>
|
||||
imap <C-j> <DOWN>
|
||||
imap <C-ENTER> <C-j><ENTER>
|
||||
imap <C-s> <C-j><C-j><ENTER>
|
||||
|
||||
"let g:coc_snippet_next = ${"''"}
|
||||
"let g:coc_snippet_prev = ${"''"}
|
||||
|
||||
"inoremap <expr> <c-j>
|
||||
"\ pumvisible() ? "\<DOWN>" :
|
||||
"\ coc#jumpable() ? "\<c-r>=coc#rpc#request('snippetNext', [])<cr>" :
|
||||
"\ "\<c-j>"
|
||||
"inoremap <expr> <c-k>
|
||||
"\ pumvisible() ? "\<UP>" :
|
||||
"\ coc#jumpable() ? "\<c-r>=coc#rpc#request('snippetPrev', [])<cr>" :
|
||||
"\ "\<c-k>"
|
||||
|
||||
" use enter for completing with coc
|
||||
inoremap <silent><expr> <CR> coc#pum#visible() ? coc#pum#confirm() : "\<CR>"
|
||||
|
||||
|
||||
function! s:TernimalRun(cmd)
|
||||
execute '5new'
|
||||
call termopen(a:cmd, {
|
||||
\ 'on_exit': 's:OnExit',
|
||||
\ 'buffer_nr': bufnr('%'),
|
||||
\})
|
||||
execute 'wincmd p'
|
||||
endfunction
|
||||
|
||||
|
||||
|
||||
""""""""""""""""""""""""""""" languages """""""""""""""""""""""""""""
|
||||
|
||||
" ###### typst ###### "
|
||||
"Typst highlight customisation
|
||||
function Setup_typst()
|
||||
" set highlight of Headings to not be underlined
|
||||
"autocmd TermClose * echo v:shell_error
|
||||
"au TermClose * call feedkeys("ii")
|
||||
:hi! link typstMarkupHeading markdownH1
|
||||
:hi markdownH1 cterm=bold, gui=bold
|
||||
|
||||
" to keep indent the same when making a "-" list
|
||||
set cindent
|
||||
|
||||
cnoreabbrev c call SaveAndCompile_typst()
|
||||
|
||||
function! OnExit(job_id, exit_code, event) dict
|
||||
let lines = line("$")
|
||||
if a:exit_code == "0"
|
||||
"echo "good"
|
||||
call feedkeys("ii")
|
||||
else
|
||||
"echo "bad"
|
||||
endif
|
||||
|
||||
|
||||
endfunction
|
||||
|
||||
endfunction
|
||||
|
||||
|
||||
function! SaveAndCompile_typst()
|
||||
:silent w
|
||||
"execute '5new'
|
||||
let path = expand('%:p')
|
||||
:belowright new 20split
|
||||
":belowright 20split call termopen("echo hello")
|
||||
call termopen("typst --root ~/work/config/typst --font-path ~/config/typst/fonts compile " . path . " out.pdf", {
|
||||
\ 'on_exit': 'OnExit',
|
||||
\ 'buffer_nr': bufnr('%'),
|
||||
\})
|
||||
"execute 'wincmd p'
|
||||
":execute '!typst compile ' . expand('%:p')
|
||||
":belowright 20split term://typst compile doku.typ
|
||||
":belowright 20split
|
||||
"s:TernimalRun("!echo hello")
|
||||
endfunction
|
||||
|
||||
|
||||
|
||||
|
||||
" ###### js ###### "
|
||||
set tabstop=3 shiftwidth=3
|
||||
function Setup_js()
|
||||
|
||||
"autocmd Filetype js set tabstop=2 shiftwidth=2 expandtab
|
||||
set tabstop=4 shiftwidth=4
|
||||
cnoreabbrev c echo JSSSSSSSSSSSSSSSSSS is interpreted.....
|
||||
" autocmd Filetype setlocal ts=2 sw=2 expandtab
|
||||
|
||||
endfunction
|
||||
|
||||
|
||||
|
||||
" ###### c ###### "
|
||||
function Setup_c()
|
||||
cnoreabbrev c call SaveAndCompile_c()
|
||||
endfunction
|
||||
|
||||
|
||||
function! SaveAndCompile_c()
|
||||
:w
|
||||
execute '!gcc main.c -o main.out; if [ $? -ne 0 ]; then echo ======= ERROR =======; exit; fi ; echo "======= NO ERROR = PROGRAMM ======="; ./main.out'
|
||||
endfunction
|
||||
|
||||
|
||||
|
||||
" ###### latex ###### "
|
||||
|
||||
let g:UltiSnipsExpandTrigger = '<tab>'
|
||||
let g:UltiSnipsJumpForwardTrigger = '<c-j>'
|
||||
let g:UltiSnipsJumpBackwardTrigger = '<c-k>'
|
||||
|
||||
function Setup_tex()
|
||||
set tabstop=2 shiftwidth=2
|
||||
"command SaveAndCompilelatex
|
||||
cnoreabbrev c call SaveAndCompile_latex()
|
||||
cnoreabbrev o call Open_latex()<ENTER>
|
||||
|
||||
function Latex_toggle_comment()
|
||||
let line=getline('.')
|
||||
let chars = split(line, '\zs')
|
||||
let index = 0
|
||||
while 1
|
||||
if len(chars) == 0
|
||||
return
|
||||
break
|
||||
endif
|
||||
if chars[index] == " "
|
||||
let index += 1
|
||||
else
|
||||
break
|
||||
endif
|
||||
endwhile
|
||||
if chars[index] == "%"
|
||||
execute 's@^%@@g'
|
||||
else
|
||||
execute 's/^/%/g'
|
||||
endif
|
||||
endfunction
|
||||
|
||||
vnoremap s :call Latex_toggle_comment()<Enter>
|
||||
endfunction
|
||||
|
||||
function SaveAndCompile_latex()
|
||||
:w
|
||||
execute '!pdflatex --output-directory=' . expand('%:p:h') . " " . expand('%:p')
|
||||
endfunction
|
||||
|
||||
function Open_latex()
|
||||
execute '!zathura ./main.pdf 1>/dev/null 2>/dev/null &'
|
||||
endfunction
|
||||
" end latex
|
||||
|
||||
|
||||
" ###### vhdl ###### "
|
||||
|
||||
function Setup_vhdl()
|
||||
function Vhdl_toggle_comment()
|
||||
let line=getline('.')
|
||||
let chars = split(line, '\zs')
|
||||
let index = 0
|
||||
while 1
|
||||
if len(chars) == 0
|
||||
return
|
||||
break
|
||||
endif
|
||||
if chars[index] == " "
|
||||
let index += 1
|
||||
else
|
||||
break
|
||||
endif
|
||||
endwhile
|
||||
if chars[index] == "-"
|
||||
execute 's@^--@@g'
|
||||
else
|
||||
execute 's/^/--/g'
|
||||
endif
|
||||
endfunction
|
||||
|
||||
vnoremap s :call Vhdl_toggle_comment()<Enter>
|
||||
|
||||
endfunction
|
||||
|
||||
" ###### haskell ###### "
|
||||
|
||||
function Setup_haskell()
|
||||
set tabstop=4 shiftwidth=4 expandtab
|
||||
|
||||
"command SaveAndCompile_haskell
|
||||
cnoreabbrev c call SaveAndCompile_haskell()
|
||||
"command Debugger_haskell
|
||||
cnoreabbrev d call Debugger_haskell()
|
||||
endfunction
|
||||
|
||||
|
||||
function SaveAndCompile_haskell()
|
||||
:w
|
||||
execute '!ghc ' . @%
|
||||
endfunction
|
||||
|
||||
|
||||
function Debugger_haskell()
|
||||
:w
|
||||
execute '!ghci ' . @%
|
||||
endfunction
|
||||
|
||||
let g:haskell_classic_highlighting = 0
|
||||
let g:haskell_indent_if = 3
|
||||
let g:haskell_intdent_disable = 0
|
||||
let g:haskell_indent_case = 2
|
||||
let g:haskell_indent_let = 4
|
||||
let g:haskell_indent_where = 6
|
||||
let g:haskell_indent_before_where = 2
|
||||
let g:haskell_indent_after_bare_where = 2
|
||||
let g:haskell_indent_do = 3
|
||||
let g:haskell_indent_in = 1
|
||||
let g:haskell_indent_guard = 2
|
||||
let g:haskell_indent_case_alternative = 1
|
||||
let g:cabal_indent_section = 2
|
||||
|
||||
|
||||
|
||||
" ###### rust ###### "
|
||||
|
||||
function Setup_rust()
|
||||
|
||||
vnoremap s :call Rust_toggle_comment()<Enter>
|
||||
|
||||
cnoreabbrev c call Cargo_ceck()
|
||||
cnoreabbrev r call Cargo_run()
|
||||
cnoreabbrev b call Cargo_build()
|
||||
|
||||
endfunction
|
||||
|
||||
function Cargo_build()
|
||||
:w
|
||||
":term cargo build
|
||||
:belowright 20split term://cargo build
|
||||
endfunction
|
||||
|
||||
function Cargo_run()
|
||||
:w
|
||||
":term cargo run
|
||||
:belowright 20split term://cargo run
|
||||
endfunction
|
||||
|
||||
"tnoremap J :call Cargo_jump()
|
||||
augroup MyTermMappings
|
||||
autocmd!
|
||||
autocmd TermOpen * nnoremap <buffer> J :lua Cargo_jump()<Enter>
|
||||
augroup END
|
||||
|
||||
function Cargo_ceck()
|
||||
:w
|
||||
:belowright 20split term://cargo check
|
||||
endfunction
|
||||
|
||||
function Rust_toggle_comment()
|
||||
let line=getline('.')
|
||||
let chars = split(line, '\zs')
|
||||
let index = 0
|
||||
while 1
|
||||
if len(chars) == 0
|
||||
return
|
||||
break
|
||||
endif
|
||||
if chars[index] == " "
|
||||
let index += 1
|
||||
else
|
||||
break
|
||||
endif
|
||||
endwhile
|
||||
if chars[index] == "/"
|
||||
execute 's@^//@@g'
|
||||
else
|
||||
execute 's/^/\/\//g'
|
||||
endif
|
||||
endfunction
|
||||
'';
|
||||
|
||||
extraLuaConfig = ''
|
||||
function Cargo_jump()
|
||||
local line,c = unpack(vim.api.nvim_win_get_cursor(0))
|
||||
local lines = vim.api.nvim_buf_get_lines(0, 0, -1, false)
|
||||
|
||||
local line_iter = line
|
||||
local line_to_jump = nil
|
||||
local file_to_jump = nil
|
||||
while true do
|
||||
if (lines[line_iter]:sub(1,6) == "error[") then
|
||||
local split_line = mysplit(lines[line_iter +1], ":")
|
||||
line_to_jump = split_line[2]
|
||||
file_to_jump = split_line[1]:sub(6, -1)
|
||||
break
|
||||
end
|
||||
line_iter = line_iter - 1
|
||||
end
|
||||
|
||||
local buffers = get_buffers()
|
||||
local abs_file_to_jump = vim.fn.getcwd() .. "/" .. file_to_jump
|
||||
|
||||
for i,buf in pairs(buffers) do
|
||||
local name = vim.api.nvim_buf_get_name(buf)
|
||||
if name == abs_file_to_jump then
|
||||
local tab_num = get_tab(name)
|
||||
--vim.cmd("tabn 2")
|
||||
return
|
||||
else
|
||||
end
|
||||
end
|
||||
vim.cmd(":tabnew" .. abs_file_to_jump)
|
||||
end
|
||||
|
||||
function get_tab(name)
|
||||
print("there")
|
||||
local listing = vim.api.nvim_command_output("tabs")
|
||||
for i,line in pairs(mysplit(listing, "\n")) do
|
||||
if line:sub(1,8) == "Tab page" then
|
||||
local tab = line:sub(-1)
|
||||
print("tab:", tab)
|
||||
else
|
||||
local file = line:sub(5,-1)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function mysplit (inputstr, sep)
|
||||
if sep == nil then
|
||||
sep = "%s"
|
||||
end
|
||||
local t={}
|
||||
for str in string.gmatch(inputstr, "([^"..sep.."]+)") do
|
||||
table.insert(t, str)
|
||||
end
|
||||
return t
|
||||
end
|
||||
|
||||
|
||||
function dump(o)
|
||||
if type(o) == 'table' then
|
||||
local s = '{ '
|
||||
for k,v in pairs(o) do
|
||||
print(k)
|
||||
if type(k) ~= 'number' then k = '"'..k..'"' end
|
||||
s = s .. '['..k..'] = ' .. dump(v) .. ','
|
||||
end
|
||||
return s .. '} '
|
||||
else
|
||||
return tostring(o)
|
||||
end
|
||||
end
|
||||
|
||||
function get_buffers()
|
||||
local buffers = {}
|
||||
|
||||
for buffer = 1, vim.fn.bufnr('$') do
|
||||
local is_listed = vim.fn.buflisted(buffer) == 1
|
||||
table.insert(buffers, buffer)
|
||||
end
|
||||
|
||||
return buffers
|
||||
end
|
||||
|
||||
'';
|
||||
};
|
||||
}
|
||||
14
common/programms/rofi.nix
Normal file
14
common/programms/rofi.nix
Normal file
@@ -0,0 +1,14 @@
|
||||
{ ... }:
|
||||
{
|
||||
home-manager.users.me.programs.rofi = {
|
||||
enable = true;
|
||||
theme = "Ark-Dark by leofa";
|
||||
extraConfig = ''
|
||||
modi: "run,filebrowser";
|
||||
color-normal: "#1c2023, #919ba0, #1c2023, #a4a4a4, #1c2023";
|
||||
color-urgent: "argb:00000000, #f43753, argb:00000000, argb:00000000, #e29a49";
|
||||
color-active: "argb:00000000, #49bbfb, argb:00000000, argb:00000000, #e29a49";
|
||||
color-window: "#1c2023, #919ba0, #1c2023";
|
||||
'';
|
||||
};
|
||||
}
|
||||
148
common/programms/ssh.nix
Normal file
148
common/programms/ssh.nix
Normal file
@@ -0,0 +1,148 @@
|
||||
{ secretsDir, ... }:
|
||||
{
|
||||
home-manager.users.me.programms.ssh = {
|
||||
enable = true;
|
||||
includes = [ "./current_rpi_config" ];
|
||||
matchBlocks = {
|
||||
hpm = {
|
||||
hostame = "192.168.1.56";
|
||||
use = "root";
|
||||
};
|
||||
|
||||
servers = {
|
||||
hostname = "192.168.1.3";
|
||||
user = "server";
|
||||
extraConfig = ''
|
||||
AddKeysToAgent yes
|
||||
'';
|
||||
identityFile = "${secretsDir}/private-key-main";
|
||||
};
|
||||
|
||||
server = {
|
||||
hostname = "192.168.1.3";
|
||||
user = "admin";
|
||||
extraConfig = ''
|
||||
AddKeysToAgent yes
|
||||
'';
|
||||
identityFile = "${secretsDir}/private-key-main";
|
||||
};
|
||||
|
||||
ocia = {
|
||||
hostname = "140.238.212.229";
|
||||
user = "root";
|
||||
identityFIle = "${secretsDir}/private-key-ocia";
|
||||
};
|
||||
|
||||
ocib = {
|
||||
hostname = "140.238.211.43";
|
||||
user = "root";
|
||||
identityFIle = "${secretsDir}/private-key-ocib";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
home-manager.users.me.home.".ssh/rpi/local".text = ''
|
||||
Host config
|
||||
HostName 192.168.1.2
|
||||
User config
|
||||
Port 49388
|
||||
AddKeysToAgent yes
|
||||
#UseKeychain yes
|
||||
IdentityFile ${secretsDir}/private-key-main
|
||||
#RemoteCommand cd /svn/config; bash
|
||||
|
||||
Host rpi
|
||||
HostName 192.168.1.2
|
||||
User admin
|
||||
Port 49388
|
||||
AddKeysToAgent yes
|
||||
#UseKeychain yes
|
||||
IdentityFile ${secretsDir}/private-key-main
|
||||
|
||||
Host files
|
||||
HostName 192.168.1.2
|
||||
User files
|
||||
Port 49388
|
||||
AddKeysToAgent yes
|
||||
#UseKeychain yes
|
||||
IdentityFile ${secretsDir}/private-key-main
|
||||
|
||||
Host rpis
|
||||
HostName 192.168.1.2
|
||||
User server
|
||||
Port 49388
|
||||
AddKeysToAgent yes
|
||||
#UseKeychain yes
|
||||
IdentityFile ${secretsDir}/private-key-main
|
||||
'';
|
||||
|
||||
home-manager.users.me.home.".ssh/rpi/remote".text = ''
|
||||
Host config
|
||||
HostName sebastian.dns.army
|
||||
User config
|
||||
Port 49388
|
||||
AddKeysToAgent yes
|
||||
#UseKeychain yes
|
||||
IdentityFile ${secretsDir}/private-key-main
|
||||
#RemoteCommand cd /svn/config; bash
|
||||
|
||||
Host rpi
|
||||
HostName sebastian.dns.army
|
||||
User admin
|
||||
Port 49388
|
||||
AddKeysToAgent yes
|
||||
#UseKeychain yes
|
||||
IdentityFile ${secretsDir}/private-key-main
|
||||
|
||||
Host files
|
||||
HostName sebastian.dns.army
|
||||
User files
|
||||
Port 49388
|
||||
AddKeysToAgent yes
|
||||
#UseKeychain yes
|
||||
IdentityFile ${secretsDir}/private-key-main
|
||||
|
||||
Host rpis
|
||||
HostName sebastian.dns.army
|
||||
User server
|
||||
Port 49388
|
||||
AddKeysToAgent yes
|
||||
#UseKeychain yes
|
||||
IdentityFile ${secretsDir}/private-key-main
|
||||
'';
|
||||
|
||||
home-manager.users.me.home.".ssh/rpi/wstunnel".text = ''
|
||||
Host config
|
||||
HostName localhost
|
||||
User config
|
||||
Port 55555
|
||||
AddKeysToAgent yes
|
||||
#UseKeychain yes
|
||||
IdentityFile ${secretsDir}/private-key-main
|
||||
#RemoteCommand cd /svn/config; bash
|
||||
|
||||
Host rpi
|
||||
HostName localhost
|
||||
User admin
|
||||
Port 55555
|
||||
AddKeysToAgent yes
|
||||
#UseKeychain yes
|
||||
IdentityFile ${secretsDir}/private-key-main
|
||||
|
||||
Host files
|
||||
HostName localhost
|
||||
User files
|
||||
Port 55555
|
||||
AddKeysToAgent yes
|
||||
#UseKeychain yes
|
||||
IdentityFile ${secretsDir}/private-key-main
|
||||
|
||||
Host rpis
|
||||
HostName localhost
|
||||
User server
|
||||
Port 55555
|
||||
AddKeysToAgent yes
|
||||
#UseKeychain yes
|
||||
IdentityFile ${secretsDir}/private-key-main
|
||||
'';
|
||||
}
|
||||
41
common/programms/zathura.nix
Normal file
41
common/programms/zathura.nix
Normal file
@@ -0,0 +1,41 @@
|
||||
{ ... }:
|
||||
{
|
||||
home-manager.users.me.programms.zathura = {
|
||||
enable = true;
|
||||
options = {
|
||||
selection-clipboard = "clipboard";
|
||||
roll-step = 40;
|
||||
};
|
||||
mappings = {
|
||||
"<C-y>" = ''scroll down'';
|
||||
"<C-x>" = ''scroll up'';
|
||||
"<C-o>" = ''scroll left'';
|
||||
"<C-p>" = ''scroll right'';
|
||||
|
||||
"j" = ''feedkeys "4<C-y>"'';
|
||||
"k" = ''feedkeys "4<C-x>"'';
|
||||
"h" = ''feedkeys "4<C-o>"'';
|
||||
"l" = ''feedkeys "4<C-p>"'';
|
||||
|
||||
"J" = ''feedkeys "<C-y>"'';
|
||||
"K" = ''feedkeys "<C-x>"'';
|
||||
"H" = ''feedkeys "<C-o>"'';
|
||||
"L" = ''feedkeys "<C-p>"'';
|
||||
|
||||
"y" = ''zoom in'';
|
||||
"+" = ''feedkeys "yyy"'';
|
||||
"*" = ''feedkeys "y"'';
|
||||
|
||||
"x" = ''zoom out'';
|
||||
"-" = ''feedkeys "xxx"'';
|
||||
"_" = ''feedkeys "x"'';
|
||||
|
||||
"n" = ''navigate next'';
|
||||
"p" = ''navigate previous'';
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user