Added rust modes to emacs, changed theme to one-theme, changed scripts

clean_emacs
TuDatTr 2021-03-02 12:23:16 +01:00
parent a56233db18
commit 4732690351
16 changed files with 105 additions and 61 deletions

View File

@ -75,10 +75,8 @@ bindsym $mod+Shift+8 move container to workspace $ws8; workspace $ws8
bindsym $mod+Shift+9 move container to workspace $ws9; workspace $ws9 bindsym $mod+Shift+9 move container to workspace $ws9; workspace $ws9
# Open specific applications in floating mode # Open specific applications in floating mode
for_window [class="Nitrogen"] floating enable sticky enable border normal
for_window [class="(?i)virtualbox"] floating enable border normal for_window [class="(?i)virtualbox"] floating enable border normal
for_window [title="KeePassX$"] floating enable border normal for_window [title="KeePassX$"] floating enable border normal
for_window [title="Eddie - Settings"] floating enable border normal
for_window [class="^Thunderbird$" title="^.*Event:"] floating enable for_window [class="^Thunderbird$" title="^.*Event:"] floating enable
# https://github.com/z3ntu/dotfiles/blob/master/i3/.config/i3/config # https://github.com/z3ntu/dotfiles/blob/master/i3/.config/i3/config

View File

@ -2,12 +2,12 @@ u:/home/tuan/Documents/Uni/Studium/2020&2021 Wintersemseter
p:/home/tuan/Documents/Protokolle/FSE p:/home/tuan/Documents/Protokolle/FSE
o:/home/tuan/.dotfiles/config o:/home/tuan/.dotfiles/config
m:/run/media m:/run/media
a:/home/tuan/Documents/Uni/Studium/2020&2021 Wintersemseter/Programmierung in C-C++/Exercise/03/tran_3030462_ex03/task01 a:/home/tuan/.nextcloud/Documents/Uni/Studium/2020&2021 Wintersemseter/Programmierung in C-C++/Exercise/11/tran_3030462_ex11/task01
l:/home/tuan/Local l:/home/tuan/Local
c:/home/tuan/Documents/CTF c:/home/tuan/Documents/CTF
t:/home/tuan/Templates t:/home/tuan/Templates
w:/home/tuan/workspace_l/Projects w:/home/tuan/workspace_l/Projects
k:/home/tuan/Documents/Uni/Studium/2017&2018 Wintersemester/Rechnerstrukturen und Betriebssysteme [4,0]/Rechnerstrukturen k:/home/tuan/Documents/Uni/Studium/2017&2018 Wintersemester/Rechnerstrukturen und Betriebssysteme [4,0]/Rechnerstrukturen
q:/home/tuan/.nextcloud/Quick Drop q:/home/tuan/.nextcloud/Quick Drop
':/home/tuan/f/b ':/home/tuan/Pictures/Screenshots/2021-03
e:/home/tuan/Documents/CTF/TryHackMe/Ice/2_Recon e:/home/tuan/Documents/CTF/TryHackMe/Ice/2_Recon

View File

@ -1,24 +0,0 @@
#!/bin/sh
type xrandr >/dev/null 2>&1 || { echo >&2 "I require maim but it's not installed. Aborting."; exit 1; }
mon0=eDPI1
mon1=HDMI1
case $1 in
"mon0"*)
xrandr --output $mon0 --auto
xrandr --output $mon1 --off
;;
"duplicate"*)
xrandr --output $mon0 --auto
xrandr --output $mon1 --same-as $mon0
;;
"extend"*)
xrandr --output $mon0 --auto
xrandr --output $mon1 --left-of $mon0
;;
"mon1"*)
xrandr --output $mon0 --off
xrandr --output $mon1 --auto
;;
esac

View File

@ -5,24 +5,25 @@ type dunstify >/dev/null 2>&1 || { echo >&2 "I require dunstify but it's not ins
type xclip >/dev/null 2>&1 || { echo >&2 "I require xclip but it's not installed. Aborting."; exit 1; } type xclip >/dev/null 2>&1 || { echo >&2 "I require xclip but it's not installed. Aborting."; exit 1; }
type xdotool >/dev/null 2>&1 || { echo >&2 "I require xdotool but it's not installed. Aborting."; exit 1; } type xdotool >/dev/null 2>&1 || { echo >&2 "I require xdotool but it's not installed. Aborting."; exit 1; }
d=$HOME/Pictures/Screenshots/$(date +%G-%m); d=$HOME/Pictures/Screenshots/$(date +%Y-%m);
fd=$(date +%G-%m-%d_%H-%M-%S) fd=$(date +%G-%m-%d_%H-%M-%S)
case $1 in case $1 in
"screen"*) "screen"*)
filename=$fd-$(cat /proc/$(xdotool getwindowpid $(xdotool getwindowfocus))/comm).png; filename=$fd-$(cat /proc/$(xdotool getwindowfocus getwindowpid)/comm).png;
maim -f png $d/$filename; maim -f png $d/$filename;
dunstify -r 2 "Saved screenshot of screen in $d/$filename"; dunstify -r 2 "Saved screenshot of screen in $d/$filename";
xclip -selection clipboard -t image/png -i $d/$filename xclip -selection clipboard -t image/png -i $d/$filename
;; ;;
"window"*) "window"*)
filename=$fd-$(cat /proc/$(xdotool getwindowpid $(xdotool getwindowfocus))/comm).png filename=$fd-$(cat /proc/$(xdotool getwindowfocus getwindowpid)/comm).png
maim -u -i $(xdotool getactivewindow) -f png $d/$filename; maim -u -i $(xdotool getactivewindow) -f png $d/$filename;
dunstify -r 2 "Saved screenshot of window in $d/$filename"; dunstify -r 2 "Saved screenshot of window in $d/$filename";
xclip -selection clipboard -t image/png -i $d/$filename xclip -selection clipboard -t image/png -i $d/$filename
;; ;;
"area"*) "area"*)
dunstify -r 2 'Taking screenshot from area.'; # dunstify -r 2 'Taking screenshot from area.';
filename=$fd-$(cat /proc/$(xdotool getwindowpid $(xdotool getwindowfocus))/comm).png; filename=$fd-$(cat /proc/$(xdotool getwindowfocus getwindowpid)/comm).png;
maim -u -s -f png $d/$filename; maim -u -s -f png $d/$filename;
dunstify -r 2 "Saved in $d/$filename."; dunstify -r 2 "Saved in $d/$filename.";
xclip -selection clipboard -t image/png -i $d/$filename xclip -selection clipboard -t image/png -i $d/$filename

View File

@ -25,13 +25,13 @@ function kb_routine {
function battery_routine { function battery_routine {
capacity=$(< /sys/class/power_supply/BAT0/capacity) capacity=$(< /sys/class/power_supply/BAT0/capacity)
if [[ $capacity -lt lower_battery_threshold ]]; then if [[ $capacity -lt lower_battery_threshold ]]; then
acpi | grep -q 'Discharging' && dunstify "$capacity"; acpi | grep -q '0: Discharging' && dunstify "Battery at $capacity%";
fi fi
} }
while : while :
do do
kb_routine # kb_routine
battery_routine battery_routine
sleep 1; sleep 1;
done done

View File

@ -99,7 +99,7 @@ Host plex
User root User root
IdentityFile /mnt/veracrypt1/proxmox IdentityFile /mnt/veracrypt1/proxmox
Host plex-00 Host sshfs
HostName 10.1.11.107 HostName 10.1.11.107
Port 22 Port 22
User root User root

View File

@ -182,20 +182,37 @@
(ansible 1)) (ansible 1))
#+END_SRC #+END_SRC
*** [[https://github.com/flycheck/flycheck-rust][flycheck-rust]]
=Better Rust/Cargo support for Flycheck=
#+BEGIN_SRC emacs-lisp
(use-package flycheck-rust)
#+END_SRC
*** [[https://github.com/rust-lang/rust-mode][rust-mode]]
=Emacs configuration for Rust=
#+BEGIN_SRC emacs-lisp
(use-package rust-mode)
#+END_SRC
*** [[https://github.com/kwrooijen/cargo.el][cargo.el]]
#+BEGIN_SRC emacs-lisp
(use-package cargo)
#+END_SRC
* Appearance * Appearance
This section is for appearance customization. Either via packages or manually. This section is for appearance customization. Either via packages or manually.
** [[https://github.com/kuanyui/moe-theme.el][moe-theme]] ** [[https://github.com/balajisivaraman/emacs-one-themes][emacs-one-themes]]
=A customizable colorful eye-candy theme for Emacser. Moe, moe, kyun!= =A port of the Vim/Atom One Dark and Light themes to Emacs=
#+begin_src emacs-lisp ##+begin_src emacs-lisp
(use-package moe-theme # (use-package one-themes
:config # :init
(moe-dark)) # (load-theme 'one-dark t))
#+end_src ##+end_src
** Transparent Emacs (Commented out)
** Transparent Emacs #+begin_comment
Makes the default color of the background of emacs the same as the terminals color. Makes the default color of the background of emacs the same as the terminals color.
This is kind of a janky solution, but it works. This is kind of a janky solution, but it works.
@ -205,7 +222,7 @@
(if not (display-graphic-p) (if not (display-graphic-p)
(set-face-background 'default "unspecified-bg")))) (set-face-background 'default "unspecified-bg"))))
#+end_src #+end_src
#+end_comment
** Menubar ** Menubar
Remove the menu-bar at the top of the screen for better immersion. Remove the menu-bar at the top of the screen for better immersion.
@ -229,7 +246,7 @@
#+END_SRC #+END_SRC
* Mode Configuration * Mode Configuration
** Org-Mode ** Org-mode
Enable org-bullets and hide leading stars. Enable org-bullets and hide leading stars.
#+begin_src emacs-lisp #+begin_src emacs-lisp
@ -240,6 +257,12 @@
(setq org-src-fontify-natively t))) (setq org-src-fontify-natively t)))
#+end_src #+end_src
Enable utf8x on latex output
#+begin_src emacs-lisp
(setq org-latex-inputenc-alist '(("utf8" . "utf8x")))
#+end_src
*** Keybindings *** Keybindings
#+begin_src emacs-lisp #+begin_src emacs-lisp
(define-key org-mode-map (kbd "C-c ,") 'org-insert-structure-template) (define-key org-mode-map (kbd "C-c ,") 'org-insert-structure-template)
@ -260,17 +283,28 @@
(setq org-src-tab-acts-natively t) (setq org-src-tab-acts-natively t)
#+end_src #+end_src
** C-Mode ** C-mode
#+begin_src emacs-lisp #+begin_src emacs-lisp
(add-hook 'c-mode-hook (add-hook 'c-mode-hook
(lambda () (lambda ()
(display-line-numbers-mode 1))) (display-line-numbers-mode 1)))
#+end_src #+end_src
** C++-Mode ** C++-mode
#+begin_src emacs-lisp #+begin_src emacs-lisp
(add-hook 'c++-mode-hook (add-hook 'c++-mode-hook
(lambda () (lambda ()
(display-line-numbers-mode 1))) (display-line-numbers-mode 1)))
#+end_src #+end_src
** rust-mode
cargo.el
#+begin_src emacs-lisp
(add-hook 'rust-mode-hook 'cargo-minor-mode)
#+end_src
flycheck-rust
#+begin_src emacs-lisp
(add-hook 'flycheck-mode-hook #'flycheck-rust-setup)
#+end_src

View File

@ -7,7 +7,7 @@
;; If there is more than one, they won't work right. ;; If there is more than one, they won't work right.
'(auth-source-save-behavior nil) '(auth-source-save-behavior nil)
'(package-selected-packages '(package-selected-packages
'(ansible yasnippet use-package theme-magic rainbow-mode rainbow-delimiters ox-twbs ox-reveal ox-hugo org-bullets no-littering moe-theme magit ivy-prescient htmlize god-mode go-mode flycheck evil-collection diminish counsel company auctex))) '(flycheck-rust ansible yasnippet use-package theme-magic rainbow-mode rainbow-delimiters ox-twbs ox-reveal ox-hugo org-bullets no-littering moe-theme magit ivy-prescient htmlize god-mode go-mode flycheck evil-collection diminish counsel company auctex)))
(custom-set-faces (custom-set-faces
;; custom-set-faces was added by Custom. ;; custom-set-faces was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful. ;; If you edit it by hand, you could mess it up, so be careful.

View File

@ -0,0 +1,5 @@
# -*- mode: snippet -*-
# name: inline comment template
# key: /*!
# --
/*!< $0 */

View File

@ -2,8 +2,13 @@
# name: template # name: template
# key: template # key: template
# -- # --
#include <stdio> #include <iostream>
/**
@brief
@result
*/
int main(int argc, char *argv[]){ int main(int argc, char *argv[]){
$0 $0
} }

View File

@ -0,0 +1,10 @@
# -*- mode: snippet -*-
# name: function template
# key: /**
# --
/**
@brief $0
@param[in]
@result
*/

View File

@ -4,6 +4,11 @@
# -- # --
#include <stdio.h> #include <stdio.h>
/**
@brief
@result
*/
int main(int argc, char *argv[]){ int main(int argc, char *argv[]){
$0 $0
} }

View File

@ -4,10 +4,10 @@
# expand-env: ((yas-indent-line 'fixed) (yas-wrap-around-region 'nil)) # expand-env: ((yas-indent-line 'fixed) (yas-wrap-around-region 'nil))
# -- # --
CC = gcc CC = gcc
SRC = \$(wildcard *.c) SRC = \$(wildcard src/*.c)
OBJ = \$(SRC:.c=.o) OBJ = \$(SRC:.c=.o)
CFLAGS = CFLAGS =
RM = rm RM = rm -f
TARGET = $1 TARGET = $1
all: \$(TARGET) all: \$(TARGET)

View File

@ -4,16 +4,16 @@
# expand-env: ((yas-indent-line 'fixed) (yas-wrap-around-region 'nil)) # expand-env: ((yas-indent-line 'fixed) (yas-wrap-around-region 'nil))
# -- # --
CXX = g++ CXX = g++
SRC = \$(wildcard *.cpp) SRC = \$(wildcard src/*.cpp)
OBJ = \$(SRC:.cpp=.o) OBJ = \$(SRC:.cpp=.o)
CFLAGS = CXXFLAGS = --std=c++11
RM = rm RM = rm -f
TARGET = $1 TARGET = $1
all: \$(TARGET) all: \$(TARGET)
\$(TARGET): \$(OBJ) \$(TARGET): \$(OBJ)
\$(CXX) \$(CFLAGS) -o \$@ \$^ \$(CXX) \$(CXXFLAGS) -o \$@ \$^
clean: clean:
\$(RM) \$(TARGET) \$(OBJ) \$(RM) \$(TARGET) \$(OBJ)

View File

@ -0,0 +1,5 @@
# -*- mode: snippet -*-
# name: righttack
# key: |-
# --
⊢$0

View File

@ -0,0 +1,5 @@
# -*- mode: snippet -*-
# name: println!
# key: println
# --
println!("$0");