Added Datefunction in emacs, added vimconfig, using global molokai theme, switched to default vim

clean_emacs
Tuan-Dat Tran 2018-06-24 13:25:59 +02:00
parent 977c3a6266
commit b684590825
No known key found for this signature in database
GPG Key ID: 0DA1B0B23302CA72
15 changed files with 1720 additions and 74 deletions

View File

@ -1,36 +1,36 @@
! special
*.foreground: #eceff1
*.background: #263238
*.cursorColor: #eceff1
*.foreground: #f1ebeb
*.background: #272822
*.cursorColor: #f1ebeb
! black
*.color0: #263238
*.color8: #37474f
*.color0: #48483e
*.color8: #76715e
! red
*.color1: #ff9800
*.color9: #ffa74d
*.color1: #dc2566
*.color9: #fa2772
! green
*.color2: #8bc34a
*.color10: #9ccc65
*.color2: #8fc029
*.color10: #a7e22e
! yellow
*.color3: #ffc107
*.color11: #ffa000
*.color3: #d4c96e
*.color11: #e7db75
! blue
*.color4: #03a9f4
*.color12: #81d4fa
*.color4: #55bcce
*.color12: #66d9ee
! magenta
*.color5: #e91e63
*.color13: #ad1457
*.color5: #9358fe
*.color13: #ae82ff
! cyan
*.color6: #009688
*.color14: #26a69a
*.color6: #56b7a5
*.color14: #66efd5
! white
*.color7: #cfd8dc
*.color15: #eceff1
*.color7: #acada1
*.color15: #cfd0c2

View File

@ -0,0 +1,23 @@
-- Theme generated by vim2theme
Description = "vim molokai"
Default = { Colour="#F8F8F2" }
Canvas = { Colour="#272822" }
Number = { Colour="#AE81FF" }
Escape = { Colour="#66D9EF" , Italic=true}
String = { Colour="#E6DB74" }
BlockComment = { Colour="#75715E" }
StringPreProc = String
LineComment = BlockComment
Operator = Default
LineNum = BlockComment
PreProcessor = { Colour="#defa25" }
Interpolation = Escape
Keywords = {
{ Colour="#F92672" , Bold=true},
{ Colour="#66D9EF" },
{ Colour="#95f067" },
{ Colour="#25faac" },
}

View File

@ -91,8 +91,9 @@ for_window [class="Timeset-gui"] floating enable border normal
for_window [class="(?i)virtualbox"] 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 [title="(?i)termite"] border pixel 3
for_window [title="(?i)ranger"] border pixel 3
# switch to workspace with urgent window automatically
for_window [urgent=latest] focus
@ -114,6 +115,7 @@ for_window [class="^com-intellij-updater-Runner$" title="^Update$"] floating ena
for_window [instance="^sun-awt-X11-XDialogPeer$" title="^Complete Installation$"] floating enable
###############################################################################
############################ Startup Applications #############################
###############################################################################
@ -161,8 +163,8 @@ bindsym $mod+e exec source ~/.zshrc && termite -e 'ranger'
bindsym $mod+m exec thunderbird
bindsym Print exec --no-startup-id scrot
bindsym Shift+Print --release exec --no-startup-id scrot -f
bindsym control+Shift+Print --release exec --no-startup-id scrot -s
bindsym control+Shift+Print --release exec --no-startup-id scrot -f
bindsym Shift+Print --release exec --no-startup-id scrot -s
bindsym $mod+Ctrl+x --release exec --no-startup-id xkill
# change focus

View File

@ -35,8 +35,8 @@ font-1 = unifont:fontformat=truetype:size=8:antialias=false;0
font-2 = siji:pixelsize=10;1
font-3 = FontAwesome:style=Regular:pixelsize=10
modules-left = spotify
modules-center = spotify-prev spotify-play spotify-stop spotify-next
modules-left = spotify
modules-center = spotify-prev spotify-play spotify-stop spotify-next
modules-right = xkeyboard volume xbacklight wlan eth battery1 date
cursor-click = pointer
@ -70,7 +70,7 @@ font-1 = unifont:fontformat=truetype:size=8:antialias=false;0
font-2 = siji:pixelsize=10;1
font-3 = FontAwesome:style=Regular:pixelsize=10
modules-left =
modules-left = airvpn
modules-center = i3
modules-right = powermenu
@ -124,6 +124,13 @@ exec = echo ""
tail = true
click-left = bash -c "playerctl stop && echo '0'>/home/$USER/.scripts/playstate"
[module/airvpn]
type = custom/script
exec-if =
exec = "if [[ $(ip addr | grep tun) ]]; then echo 'VPN: connected'; else echo 'VPN: disconnectd'; fi"
tail = true
[module/i3]
type = internal/i3
@ -181,7 +188,7 @@ label-urgent-padding = 4
[module/xbacklight]
type = internal/xbacklight
format = <label>
format = <label>
label =  %percentage%%
label-underline = ${colors.yellow}
@ -214,9 +221,9 @@ date =
date-alt = " %Y-%m-%d"
time = " %H:%M:%S"
time-alt =
time-alt =
format-prefix =
format-prefix =
format-prefix-foreground = ${colors.foreground-alt}
format-underline = ${colors.magenta}

View File

@ -1,2 +1,6 @@
set preview_images true
set vcs_aware true
map f console scout -ftsea%space
map gg console mkdir%space
map np shell cp -r ~/Templates/LaTeX/Protokoll $(date +%g.%m.%%d)

View File

@ -55,6 +55,7 @@
# install a rare browser, you probably use it. Firefox/konqueror/w3m on the
# other hand are often only installed as fallback browsers.
ext x?html?, has waterfox, X, flag f = waterfox -- "$@"
ext x?html?, has firefox, X, flag f = firefox -- "$@"
ext x?html?, has surf, X, flag f = surf -- file://"$1"
ext x?html?, has qutebrowser, X, flag f = qutebrowser -- "$@"
ext x?html?, has dwb, X, flag f = dwb -- "$@"
@ -69,7 +70,6 @@ ext x?html?, has chromium-browser, X, flag f = chromium-browser -- "$@"
ext x?html?, has chromium, X, flag f = chromium -- "$@"
ext x?html?, has google-chrome, X, flag f = google-chrome -- "$@"
ext x?html?, has opera, X, flag f = opera -- "$@"
ext x?html?, has firefox, X, flag f = firefox -- "$@"
ext x?html?, has seamonkey, X, flag f = seamonkey -- "$@"
ext x?html?, has iceweasel, X, flag f = iceweasel -- "$@"
ext x?html?, has epiphany, X, flag f = epiphany -- "$@"

View File

@ -42,52 +42,39 @@ scrollbar = off
[colors]
# special
foreground = #eceff1
foreground_bold = #eceff1
cursor = #eceff1
background = rgba(38, 50, 56, 1.0)
foreground = #f1ebeb
foreground_bold = #f1ebeb
cursor = #f1ebeb
background = #272822
# black
color0 = #263238
color8 = #37474f
color0 = #48483e
color8 = #76715e
# red
color1 = #ff9800
color9 = #ffa74d
color1 = #dc2566
color9 = #fa2772
# green
color2 = #8bc34a
color10 = #9ccc65
color2 = #8fc029
color10 = #a7e22e
# yellow
color3 = #ffc107
color11 = #ffa000
color3 = #d4c96e
color11 = #e7db75
# blue
color4 = #03a9f4
color12 = #81d4fa
color4 = #55bcce
color12 = #66d9ee
# magenta
color5 = #e91e63
color13 = #ad1457
color5 = #9358fe
color13 = #ae82ff
# cyan
color6 = #009688
color14 = #26a69a
color6 = #56b7a5
color14 = #66efd5
# white
color7 = #cfd8dc
color15 = #eceff1
[hints]
#font = Monospace 12
#foreground = #dcdccc
#background = #3f3f3f
#active_foreground = #e68080
#active_background = #3f3f3f
#padding = 2
#border = #3f3f3f
#border_width = 0.5
#roundness = 2.0
# vim: ft=dosini cms=#%s
color7 = #acada1
color15 = #cfd0c2

View File

@ -0,0 +1,93 @@
[options]
allow_bold = true
audible_bell = false
clickable_url = true
#dynamic_title = false
font = Droid Sans Mono for Powerline
#fullscreen = true
#geometry = 640x480
#icon_name = terminal
mouse_autohide = true
#scroll_on_output = false
#scroll_on_keystroke = true
# Length of the scrollback buffer, 0 disabled the scrollback buffer
# and setting it to a negative value means "infinite scrollback"
scrollback_lines = -1
search_wrap = true
#urgent_on_bell = true
hyperlinks = true
# $BROWSER is used by default if set, with xdg-open as a fallback
#browser = xdg-open
# "system", "on" or "off"
cursor_blink = system
# "block", "underline" or "ibeam"
cursor_shape = ibeam
# Hide links that are no longer valid in url select overlay mode
#filter_unmatched_urls = true
# Emit escape sequences for extra modified keys
#modify_other_keys = false
# set size hints for the window
#size_hints = false
# "off", "left" or "right"
scrollbar = off
[colors]
# special
foreground = #eceff1
foreground_bold = #eceff1
cursor = #eceff1
background = rgba(38, 50, 56, 1.0)
# black
color0 = #263238
color8 = #37474f
# red
color1 = #ff9800
color9 = #ffa74d
# green
color2 = #8bc34a
color10 = #9ccc65
# yellow
color3 = #ffc107
color11 = #ffa000
# blue
color4 = #03a9f4
color12 = #81d4fa
# magenta
color5 = #e91e63
color13 = #ad1457
# cyan
color6 = #009688
color14 = #26a69a
# white
color7 = #cfd8dc
color15 = #eceff1
[hints]
#font = Monospace 12
#foreground = #dcdccc
#background = #3f3f3f
#active_foreground = #e68080
#active_background = #3f3f3f
#padding = 2
#border = #3f3f3f
#border_width = 0.5
#roundness = 2.0
# vim: ft=dosini cms=#%s

2
config/.scripts/API Normal file
View File

@ -0,0 +1,2 @@
2928810
2d21e104b96f47db7733be5c94828ad0

1363
config/.scripts/a.json Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,68 @@
import sys
from os import stat
import time
from datetime import datetime
import requests
import json
def get_info():
'Gather the City ID and API Key'
# First line of the API file in the same directory as this file is the city ID
# Second line of the API file in the same directory as this file is the openweathermap-API key
try:
with open('API', 'r') as f:
city_id = f.readline().strip('\n')
api_key = f.readline().strip('\n')
if city_id == '' or api_key == '':
raise FileNotFoundError
return [city_id, api_key]
except FileNotFoundError:
print("Create a file called 'API' and put your city id in the 1st and API-key in the 2nd line.")
def cache_weather():
'Cache the weatherinformation as json'
city_id, api_key = get_info()
url = 'http://api.openweathermap.org/data/2.5/forecast?id={}&APPID={}&units=metric'.format(city_id, api_key)
ob_weather = requests.get(url).text
with open('weather_cache.json','w') as f:
json.dump(ob_weather, f)
# Isn't needed at the moment, might change later
def conv_to_epoch(iso_time):
'Converts the dt_txt to epoch time(Or any ISO formatted timestamp)'
dt_obj = datetime.strptime(iso_time, "%Y-%m-%d %H:%M:%S")
return int(dt_obj.strftime("%s"))
def main():
# Only request new data, when data is older than 12h
# if (os.path.isfile('weather_chache.json')):
# if (time.time()-1800000>os.stat('weather_cache.json').st_mtime):
# cache_weather()
# else:
# cache_weather()
# Load cached file as dictionary
weather = json.loads(json.load(open('weather_cache.json')))
if(weather['cod']=='200'):
lowest_temp = sys.maxsize
lowest_time = ''
# Only check the next 24h
for i in weather['list']:
print(i['dt_txt'])
print(i['main']['temp'])
print(i['weather']['main'])
print(i['dt_txt'])
print('Time: {} \nTemp: {}'.format(i['dt_txt'], i['main']['temp']))
print('Time: {} \nDescription: {}'.format('\t', i['weather']['main']))
else:
print("Error.\nDo you have a working internet connection?\nIs your API Key correct?\nIs your city ID correct?")
if __name__ == '__main__':
print(main())

File diff suppressed because one or more lines are too long

View File

@ -40,12 +40,10 @@ A list of installed packages and details about them.
:defer t
:ensure t)
(use-package counsel)
(use-package eclim)
(use-package flycheck)
(use-package google-this)
(use-package ivy)
(use-package ledger-mode)
(use-package material-theme)
(use-package molokai-theme)
(use-package ox-gfm)
(use-package ox-twbs)
(use-package php-mode)
@ -58,9 +56,9 @@ A list of installed packages and details about them.
(use-package visual-regexp)
#+END_SRC
* Appearance
Using the [[https://github.com/cpaulik/emacs-material-theme][Material]]-Theme.
Using the Molokai-Theme.
#+BEGIN_SRC emacs-lisp
(load-theme 'monokai t)
(load-theme 'molokai t)
#+END_SRC
Changes the Emacs background to the terminals defaults. (Generally)
@ -89,6 +87,7 @@ Powerline for Emacs
(setq auto-save-file-name-transforms
'((".*" "~/.emacs-saves/" t)))
(setq custom-file "~/.emacs.d/config.el")
(setq auto-mode-alist (append '(("/tmp/mutt.*" . mail-mode)) auto-mode-alist))
#+END_SRC
Delete trailing spaces before saving
@ -96,7 +95,6 @@ Delete trailing spaces before saving
(add-hook 'before-save-hook 'delete-trailing-whitespace)
#+END_SRC
* Functions
All the functions I use.
** Cut/Copy and Paste by Boruch Baum
@ -187,6 +185,16 @@ Copy word
)
#+END_SRC
#+BEGIN_SRC emacs-lisp
(defun insert-current-date () (interactive)
(insert (shell-command-to-string "echo -n $(date +%d.%m.%Y)")))
#+END_SRC
#+BEGIN_SRC emacs-lisp
(defun insert-current-time () (interactive)
(insert (shell-command-to-string "echo -n $(date +%H:%M)")))
#+END_SRC
* Modes
** Window Modes
** Autocomplete
@ -289,11 +297,11 @@ Enabled languages:
(org-babel-do-load-languages
'org-babel-load-languages
'( (python . t)
(sh . t)
(emacs-lisp . t)
(C . t)
(gnuplot . t)
(latex . t)
(shell . t)
))
#+END_SRC
@ -338,6 +346,8 @@ Globaly highlight the current line in a slightly darker shade of grey.
(define-key map (kbd "C-c w") 'copy-word)
(define-key map (kbd "C-c r") 'vr/query-replace)
(define-key map (kbd "M-/") 'comment-region)
(define-key map (kbd "C-c d") 'insert-current-date)
(define-key map (kbd "C-c t") 'insert-current-time)
map)
"my-keys-minor-mode keymap.")

81
vim/.vimrc Normal file
View File

@ -0,0 +1,81 @@
" Plugins
set nocompatible
filetype off
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
Plugin 'VundleVim/Vundle.vim'
Plugin 'vim-pandoc/vim-pandoc'
Plugin 'vim-pandoc/vim-pandoc-syntax'
Plugin 'ledger/vim-ledger'
Plugin 'terryma/vim-multiple-cursors'
Plugin 'haya14busa/incsearch.vim'
call vundle#end()
" Functions
command! -complete=shellcmd -nargs=+ Shell call s:RunShellCommand(<q-args>)
function! s:RunShellCommand(cmdline)
echo a:cmdline
let expanded_cmdline = a:cmdline
for part in split(a:cmdline, ' ')
if part[0] =~ '\v[%#<]'
let expanded_part = fnameescape(expand(part))
let expanded_cmdline = substitute(expanded_cmdline, part, expanded_part, '')
endif
endfor
botright new
setlocal buftype=nofile bufhidden=wipe nobuflisted noswapfile nowrap
call setline(1, 'You entered: ' . a:cmdline)
call setline(2, 'Expanded Form: ' .expanded_cmdline)
call setline(3,substitute(getline(2),'.','=','g'))
execute '$read !'. expanded_cmdline
setlocal nomodifiable
1
endfunction
" Basics
syntax on
set encoding=utf-8
colorscheme monokai
set autowrite
" Tab behavior
set expandtab
set tabstop=4
set shiftwidth=3
"" New window positions
set splitbelow
set splitright
" Remaps
map / <Plug>(incsearch-forward)
map ? <Plug>(incsearch-backward)
map g/ <Plug>(incsearch-stay)
nnoremap <C-J> <C-W><C-J>
nnoremap <C-K> <C-W><C-K>
nnoremap <C-L> <C-W><C-L>
nnoremap <C-H> <C-W><C-H>
" Shortcuts
inoremap <Tab><Tab> <Esc>/<x_x><Enter>c5l
vnoremap <Tab><Tab> <Esc>/<x_x><Enter>c5l
map <Tab><Tab> <Esc>/<x_x><Enter>c5l
inoremap ;; <x_x>
"" Latex
autocmd FileType tex inoremap ;l \item
autocmd FileType tex inoremap ;beg \begin{<o_o>}<Enter><x_x><Enter>\end{<o_o>}<Enter><Enter><x_x><Esc>4k0:MultipleCursorsFind<Space><o_o><Enter>c
autocmd FileType tex inoremap ;sec \section{<x_x>}<Enter><Enter><x_x><Esc>2k<Tab><Tab>
autocmd FileType tex inoremap ;ssec \subsection{<x_x>}<Enter><Enter><x_x><Esc>2k<Tab><Tab>
autocmd FileType tex inoremap ;sssec \subsubsection{<x_x>}<Enter><Enter><x_x><Esc>2k<Tab><Tab>
""" Compile to pdf and open it in evince
autocmd FileType tex map <C-c><C-c> mx:silent !pdflatex % && evince %<.pdf &<Enter>ggGG`x
"" Ledger
autocmd FileType ledger inoremap ;a <C-R>=strftime("%Y/%m/%d")<Enter> * <x_x><Enter><Space><Space><Space><Space><x_x><Space><Space><Space><Space><x_x><Enter><Enter><x_x><Esc>3k0<Tab><Tab>
autocmd FileType ledger map <C-R>b :! ledger -f % reg Brieftasche$<Enter>
autocmd FileType ledger map <C-R>g :! ledger -f % reg Girokonto$<Enter>
autocmd FileType ledger map <C-R>p :! ledger -f % reg PayPal$<Enter>
"" Markdown
autocmd FileType markdown,rmd map map <C-c><C-c> mx:silet !pandoc -f % -t latex %<.pdf && evince %<.pdf &<Enter>ggGG`x

View File

@ -31,17 +31,21 @@ alias df="df -h"
alias mkvirtenv="python -m virtualenv --system-site-packages"
alias e="emacsclient -t"
alias ek="pkill emacs"
alias ed="emacs --daemon"
alias ej="emacs --daemon"
alias nyan="nyancat"
alias rm="rm -i"
alias -s tex=e
alias -s cpp=e
alias -s org=e
alias diff="diff -s"
alias stunden="e $HOME/Nextcloud/Arbeit/Stundenzettel.org"
alias budget="e $HOME/Nextcloud/orgs/Budget/MyBudget.ledger"
alias vudget="vim $HOME/Nextcloud/orgs/Budget/MyBudget.ledger"
alias q="exit"
alias ranger='ranger --choosedir=$HOME/.rangerdir; LASTDIR=`cat $HOME/.rangerdir`; cd "$LASTDIR"'
alias steam='steam -silent %U'
alias vrc='vim ~/.vimrc'
alias erc='e ~/.emacs.d/config.org'
source $ZSH/oh-my-zsh.sh
# Variables
@ -49,8 +53,9 @@ export TERM="xterm-256color" # in case you are using urxvt, to bypass an error d
export GPG_TTY=$(tty)
export LC_ALL=en_GB.UTF-8
PATH=$PATH:$HOME/.local/bin:/usr/lib/jvm/java-10-openjdk/bin
export EDITOR='emacsclient -t'
export DEFAULT_EDITOR='emacsclient -t'
export VISUAL='emacsclient -ct'
export VISUAL_EDITOR='emacsclient -ct'
export EDITOR='vim'
export DEFAULT_EDITOR=$EDITOR
export VISUAL=$EDITOR
export VISUAL_EDITOR=$EDITOR
export STEAM_FRAME_FORCE_CLOSE=1
export HIGHLIGHT_DATADIR="~/.config/highlight/"