Added screenshot filenamesEmacs:- Added yasnippet- Added company- Added flycheck- Added htmlize for reveal.js- Changed tabbing- Fixed org-insert-structure-template shortcut- display line numbers in c/cpp-mode

clean_emacs
TuDatTr 2020-12-14 04:57:42 +01:00
parent 293bf29e49
commit 78945a969d
15 changed files with 166 additions and 28 deletions

View File

@ -1,13 +1,13 @@
u:/home/tuan/Documents/Uni/Studium 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/Arbeit a:/home/tuan/Documents/Uni/Studium/2020&2021 Wintersemseter/Programmierung in C-C++/Exercise/03/tran_3030462_ex03/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/.dotfiles/emacs/.emacs.d/snippets ':/home/tuan/.emacs.d/snippets/c++-mode
e:/home/tuan/Documents/CTF/TryHackMe/Ice/2_Recon e:/home/tuan/Documents/CTF/TryHackMe/Ice/2_Recon

24
config/.scripts/project.sh Executable file
View File

@ -0,0 +1,24 @@
#!/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

@ -6,22 +6,23 @@ type xclip >/dev/null 2>&1 || { echo >&2 "I require xclip but it's not installed
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 +%G-%m);
fd=$(date +%G-%m-%d_%H-%M-%S)
case $1 in case $1 in
"screen"*) "screen"*)
filename=$(cat /proc/$(xdotool getwindowpid $(xdotool getwindowfocus))/comm)_$(date +%G-%m-%d_%H-%M-%S).png; filename=$fd-$(cat /proc/$(xdotool getwindowpid $(xdotool getwindowfocus))/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=$(cat /proc/$(xdotool getwindowpid $(xdotool getwindowfocus))/comm)_$(date +%G-%m-%d_%H-%M-%S).png filename=$fd-$(cat /proc/$(xdotool getwindowpid $(xdotool getwindowfocus))/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=$(cat /proc/$(xdotool getwindowpid $(xdotool getwindowfocus))/comm)_$(date +%G-%m-%d_%H-%M-%S).png; filename=$fd-$(cat /proc/$(xdotool getwindowpid $(xdotool getwindowfocus))/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

@ -141,9 +141,37 @@
=A template system for Emacs= =A template system for Emacs=
#+begin_src emacs-lisp #+begin_src emacs-lisp
(use-package yasnippet) (use-package yasnippet
:config
(setq yas-snippet-dirs '("~/.emacs.d/snippets/"))
(yas-global-mode 1))
#+end_src #+end_src
*** [[https://github.com/company-mode/company-mode][company-mode]]
=Modular in-buffer completion framework for Emacs=
#+begin_src emacs-lisp
(use-package company
:config
(global-company-mode))
#+end_src
*** [[https://github.com/flycheck/flycheck][flycheck]]
=On the fly syntax checking for GNU Emacs=
#+begin_src emacs-lisp
(use-package flycheck
:config
(global-flycheck-mode))
#+end_src
*** [[https://github.com/hniksic/emacs-htmlize][htmlize.el]]
=Convert buffer text and decorations to HTML.=
#+begin_src emacs-lisp
(use-package htmlize)
#+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.
@ -183,15 +211,27 @@
(setq vc-follow-symlinks t) (setq vc-follow-symlinks t)
#+end_src #+end_src
** Tab Behavior (spaces > tabs)
#+BEGIN_SRC emacs-lisp
(setq-default indent-tabs-mode nil)
#+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
(add-hook 'org-mode-hook (add-hook 'org-mode-hook
(lambda () (lambda ()
(org-bullets-mode 1))) (org-bullets-mode 1)
(setq org-pretty-entities t)
(setq org-src-fontify-natively t)))
#+end_src #+end_src
*** Keybindings
#+begin_src emacs-lisp
(define-key org-mode-map (kbd "C-c ,") 'org-insert-structure-template)
#+end_src
Enables specific languages for org-babel, so those languages can be used and compiled in code blocks and disable the compilation concirmation. The code afterwords enables proper indentation inside those source blocks. Enables specific languages for org-babel, so those languages can be used and compiled in code blocks and disable the compilation concirmation. The code afterwords enables proper indentation inside those source blocks.
#+begin_src emacs-lisp #+begin_src emacs-lisp
@ -207,3 +247,16 @@
(setq org-confirm-babel-evaluate nil) (setq org-confirm-babel-evaluate nil)
(setq org-src-tab-acts-natively t) (setq org-src-tab-acts-natively t)
#+end_src #+end_src
** C-Mode
#+begin_src emacs-lisp
(add-hook 'c-mode-hook
(lambda ()
(display-line-numbers-mode 1)))
#+end_src
** C++-Mode
#+begin_src emacs-lisp
(add-hook 'c++-mode-hook
(lambda ()
(display-line-numbers-mode 1)))
#+end_src

View File

@ -1,2 +1,15 @@
(org-babel-load-file "~/.emacs.d/config.org") (org-babel-load-file "~/.emacs.d/config.org")
(put 'upcase-region 'disabled nil) (put 'upcase-region 'disabled nil)
(custom-set-variables
;; custom-set-variables was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
'(package-selected-packages
'(go-mode yasnippet use-package theme-magic rainbow-mode rainbow-delimiters ox-twbs ox-reveal ox-hugo org-bullets no-littering moe-theme magit ivy-prescient god-mode evil-collection diminish counsel auctex)))
(custom-set-faces
;; custom-set-faces was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
)

View File

@ -0,0 +1,9 @@
# -*- mode: snippet -*-
# name: template
# key: template
# --
#include <stdio>
int main(int argc, char *argv[]){
$0
}

View File

@ -1,6 +1,6 @@
# -*- mode: snippet -*- # -*- mode: snippet -*-
# name: template # name: template
# key: templat # key: template
# -- # --
#include <stdio.h> #include <stdio.h>

View File

@ -1,16 +0,0 @@
# -*- mode: snippet -*-
# name: template
# key: template
# --
CC = gcc
CFLAGS =
RM = rm
TARGET = $0
all: ${TARGET}
${TARGET}: ${TARGET}.c
${CC} ${CFLAGS} -o ${TARGET} ${TARGET}.c
clean:
${RM} ${TARGET}

View File

@ -0,0 +1,19 @@
# -*- mode: snippet -*-
# name: templatec
# key: templatec
# expand-env: ((yas-indent-line 'fixed) (yas-wrap-around-region 'nil))
# --
CC = gcc
SRC = \$(wildcard *.c)
OBJ = \$(SRC:.c=.o)
CFLAGS =
RM = rm
TARGET = $1
all: \$(TARGET)
\$(TARGET): \$(OBJ)
\$(CC) \$(CFLAGS) -o \$@ \$^
clean:
\$(RM) \$(TARGET) \$(OBJ)

View File

@ -0,0 +1,19 @@
# -*- mode: snippet -*-
# name: templatecxx
# key: templatecxx
# expand-env: ((yas-indent-line 'fixed) (yas-wrap-around-region 'nil))
# --
CXX = g++
SRC = \$(wildcard *.cpp)
OBJ = \$(SRC:.cpp=.o)
CFLAGS =
RM = rm
TARGET = $1
all: \$(TARGET)
\$(TARGET): \$(OBJ)
\$(CXX) \$(CFLAGS) -o \$@ \$^
clean:
\$(RM) \$(TARGET) \$(OBJ)

View File

@ -0,0 +1,5 @@
# -*- mode: snippet -*-
# name: leftarrow
# key: <-
# --
\leftarrow{}$0

View File

@ -0,0 +1,5 @@
# -*- mode: snippet -*-
# name: rightarrow
# key: ->
# --
\rightarrow{}$0

View File

@ -3,4 +3,4 @@
# key: template # key: template
# -- # --
#+TITLE: $0 #+TITLE: $0
#+SETUPFILE: $HOME/Templates/Org-Mode/setupfile.org #+SETUPFILE: ~/Templates/Org-Mode/setupfile.org

View File

@ -0,0 +1,6 @@
# -*- mode: snippet -*-
# name: template
# key: template
# --
if __name__ == '__main__':
$0

View File

@ -1,6 +1,6 @@
# Paths # Paths
export ZSH="$HOME/.oh-my-zsh" export ZSH="$HOME/.oh-my-zsh"
export PATH="$PATH:$HOME/.go/bin:$HOME/.local/bin:$HOME/.cargo/bin:$HOME/.dotnet/tools" export PATH="$PATH:$HOME/.go/bin:$HOME/.local/bin:$HOME/.cargo/bin:$HOME/.dotnet/tools:$HOME:.scripts/"
export DOTNET_CLI_TELEMETRY_OPTOUT=1 export DOTNET_CLI_TELEMETRY_OPTOUT=1
export PenTestTools=$HOME/Local/PenTesting/ export PenTestTools=$HOME/Local/PenTesting/
export CTF=$HOME/Documents/CTF/ export CTF=$HOME/Documents/CTF/