Added visual-replace and smartcompile (+keybinds) to emacs, also added c version of polybar-spotify script

clean_emacs
Tuan-Dat Tran 2018-04-05 09:46:48 +02:00
parent 0212d21755
commit c2b78bff38
9 changed files with 67 additions and 35 deletions

2
.gitignore vendored
View File

@ -3,6 +3,6 @@
*.log
.#*
emacs/.emacs.d/*
config/.scripts/playstate
!emacs/.emacs.d/snippets*
!emacs/.emacs.d/config.org
!emacs/.emacs.d/init.el

View File

@ -448,7 +448,7 @@ underline_char="-"
#
# Display colors 0-15 in the blocks. (16 colors)
# neofetch --block_range 0 15
block_range=(0 7)
block_range=(0 15)
# Toggle color blocks
#

View File

@ -1,2 +1,5 @@
set preview_images true
set vcs_aware true
EDITOR='emacsclient -nw'
DEFAULT_EDITOR='emacsclient -nw'

View File

@ -94,20 +94,27 @@ def lock_config():
# Color of seperator | Color: dark-blue
lock_sep_color = '--separatorcolor 0000D1FF'
# Right Text
lock_right_text = '--veriftext="\.\.\."'
lock_right_text = '--veriftext="..."'
# Wrong Text
lock_wrong_text = '--wrongtext="Noope"'
# Text Size
lock_text_size = '--textsize=20'
# Ring Position
lock_texts = '{} {}'.format(lock_right_text, lock_wrong_text)
lock_pos = '--indpos={}:{}'.format(int(clock_x)+350, int(clock_y+90))
lock_texts = '{} {} {}'.format(lock_right_text, lock_wrong_text,
lock_text_size)
lock_pos = '--indpos={}:{}'.format(int(clock_x)+380, int(clock_y+90))
# Ring size
ring_size = 40
lock_radius = '--radius {}'.format(ring_size)
lock_stats = '{} {}'.format(lock_pos, lock_radius)
indicator_outer_ring = "{} {} {} {} {} {} {} {}".format(lock_ring, lock_ring_w,
lock_ring_v, lock_press,
lock_del, lock_sep_color,
lock_stats, lock_texts)
indicator_outer_ring = "{} {} {} {} {} {} {} {}".format(lock_ring,
lock_ring_w,
lock_ring_v,
lock_press,
lock_del,
lock_sep_color,
lock_stats,
lock_texts)
# done
indicator = "{} {}".format(indicator_inner, indicator_outer_ring)
@ -143,6 +150,7 @@ def log(start_time):
if __name__ == '__main__':
start_time = time.time()
screenshot()
pixelate()

View File

@ -53,8 +53,8 @@ string getfile(string file_path){
bool spotify_running(){
string dir = string("/proc/");
vector<string> procs = vector<string>();
getdir(dir, procs);
vector<string> processes = vector<string>();
getdir(dir, processes);
string proc_name = string("");
for (unsigned int i = 0; i < procs.size(); i++){
proc_name = dir + procs[i] + "/cmdline";
@ -66,6 +66,7 @@ bool spotify_running(){
}
int main(){
//
struct passwd *pw = getpwuid(getuid());
const char *homedir = pw->pw_dir;
int state = -1;
@ -73,6 +74,8 @@ int main(){
string playstate_file = "";
playstate_file += homedir + string("/.scripts/playstate");
while (spotify_running()){
usleep(100000);
// cout << spotify_running() << endl;
playstate = stoi(getfile(playstate_file));
if(playstate != state){
state = playstate;
@ -85,6 +88,6 @@ int main(){
system("playerctl play");
}
}
usleep(100);
}
cout << endl;
}

Binary file not shown.

View File

@ -31,7 +31,6 @@ A list of installed packages and details about them.
(require 'use-package)
(setq use-package-always-ensure t)
;; (use-package aggressive-indent) is a dep
(use-package anaconda-mode)
(use-package auctex
:defer t
@ -50,20 +49,13 @@ A list of installed packages and details about them.
(use-package ox-twbs)
(use-package rainbow-delimiters)
(use-package rainbow-mode)
(use-package smart-compile)
(use-package smartparens)
(use-package swiper)
(use-package powerline)
;; (use-package yasnippet) is a dep
(use-package php-mode)
(use-package visual-regexp)
#+END_SRC
#+BEGIN_SRC emacs-lisp
(custom-set-variables
'(package-selected-packages
(quote
(powerline ledger-mode smartparens rainbow-mode rainbow-delimiters ox-twbs material-theme google-this flycheck eclim counsel auto-complete-auctex auto-complete auctex anaconda-mode use-package)))
'(truncate-lines t))
#+END_SRC
* Appearance
Using the [[https://github.com/cpaulik/emacs-material-theme][Material]]-Theme.
#+BEGIN_SRC emacs-lisp
@ -198,6 +190,25 @@ Using Anaconda-mode as default python development mode
(add-hook 'python-mode-hook 'anaconda-mode)
(add-hook 'python-mode-hook 'anaconda-eldoc-mode)
#+END_SRC
** C++
My exec doesnt quite work yet.
#+BEGIN_SRC emacs-lisp
;;(defun my-exec ()
;; (interactive)
;; (let ((exe (smart-compile-string "%n")))
;; (with-current-buffer "*eshell*"
;; (goto-char (point-max))
;; (insert "./")
;; (insert exe)
;; (eshell-send-input))
;; (switch-to-buffer-other-window "*eshell*")))
(add-hook
'c++-mode-hook
(lambda()
(local-set-key (kbd "C-c C-c") #'smart-compile)
(local-set-key (kbd "C-c /") #'comment-region)))
#+END_SRC
** LaTeX
Some default settings for LaTeX-Mode.
AucTeX is needed.
@ -207,11 +218,6 @@ AucTeX is needed.
(setq-default TeX-master nil)
#+END_SRC
** Org
Enable a Twitter Bootstrap mode as an export mode for Org-mode.
#+BEGIN_SRC emacs-lisp
;; (require 'ox-twbs)
#+END_SRC
Use Evince as default pdf viewer.
#+BEGIN_SRC emacs-lisp
(add-hook 'org-mode-hook
@ -247,6 +253,13 @@ Handy shortcuts
(setq org-log-done t)
#+END_SRC
GNU Plot
#+BEGIN_SRC emacs-lisp
(add-hook 'org-mode-hook
'(lambda ()
(local-set-key (kbd "C-c c") #'org-plot/gnuplot)))
#+END_SRC
Enabled languages:
#+BEGIN_SRC emacs-lisp
(org-babel-do-load-languages
@ -255,6 +268,7 @@ Enabled languages:
(sh . t)
(emacs-lisp . t)
(C . t)
(gnuplot . t)
))
#+END_SRC
@ -284,11 +298,7 @@ Globaly highlight the current line in a slightly darker shade of grey.
(yas-global-mode 1)
#+END_SRC
** Ledger
#+BEGIN_SRC emacs-lisp
(org-babel-load-file "~/.emacs.d/ledger.org")
#+END_SRC
** Personal
** Personal Global
#+BEGIN_SRC emacs-lisp
(defvar my-keys-minor-mode-map
(let ((map (make-sparse-keymap)))
@ -297,6 +307,7 @@ Globaly highlight the current line in a slightly darker shade of grey.
(define-key map (kbd "C-c C-w") 'cut-to-xclipboard)
(define-key map (kbd "C-c M-y") 'paste-from-xclipboard)
(define-key map (kbd "C-c w") 'copy-word)
(define-key map (kbd "C-c r") 'vr/query-replace)
map)
"my-keys-minor-mode keymap.")

View File

@ -0,0 +1,7 @@
# -*- mode: snippet; -*-
#contributor: Xah Lee (XahLee.org)
#name: add-hook
#key: add-hook
#key: ah
# --
(add-hook '${1:name}-hook ${2:'${3:function}})$0

View File

@ -30,12 +30,12 @@ POWERLEVEL9K_TIME_FORMAT="%D{%H:%M:%S}"
alias df="df -h"
alias mkvirtenv="python -m virtualenv --system-site-packages"
alias e="emacsclient -t"
alias ed="emacs --daemon"
alias nyan="nyancat"
alias rm="rm -i"
alias -s tex=e
alias -s cpp=e
alias org="e ~/Nextcloud/orgs/man.org"
alias neofetch="neofetch --block_range 0 16"
alias diff="diff -s"
alias budget="e ~/Nextcloud/orgs/Budget/MyBudget.ledger"
alias q="exit"