1
0
mirror of https://github.com/aquatix/dotfiles.git synced 2025-12-06 20:35:11 +01:00

Merge branch 'master' of github.com:aquatix/dotfiles

This commit is contained in:
2018-04-04 16:10:02 +02:00
17 changed files with 304 additions and 41 deletions

1
.agignore Normal file
View File

@@ -0,0 +1 @@
*.pyc

View File

@@ -171,7 +171,7 @@ if [ -e ~/.ssh/config.d ]; then
#if find ~/.ssh/config.d -mindepth 1 -print -quit | grep -q .; then
# Do we have config files in that directory?
if find ~/.ssh/config.d -print -quit | grep -q .; then
newestconfig=$(find ~/.ssh/config.d/* -printf '@T+ %p\n' | sort -r | head -n1 | awk '{print $2}')
newestconfig=$(find ~/.ssh/config.d/* -printf '%Tc %p\n' | sort -r | head -n1 | awk '{print $3}')
if [ "$newestconfig" -nt ~/.ssh/config ]; then
# We found a config that's newer than the generated config file, re-generate
[ -e ~/.ssh/config ] && mv ~/.ssh/config ~/.ssh/config.bak.$(date -Ins)
@@ -214,3 +214,5 @@ export NVM_DIR="${HOME}/.nvm"
# QT autoscaling, helpful for hidpi systems
export QT_AUTO_SCREEN_SCALE_FACTOR=1
[ -f ~/.fzf.bash ] && source ~/.fzf.bash

View File

@@ -5,8 +5,14 @@ set EDITOR vim
eval (python -m virtualfish compat_aliases)
# Theme options for bobthefish
set -g theme_nerd_fonts yes
set -g theme_show_exit_status yes
set -g theme_date_format "+%a %Y-%m-%d %H:%M:%S"
set -g theme_avoid_ambiguous_glyphs yes
#set -g theme_color_scheme "zenburn"
# If you use virtualenv, you will probably need to disable the default virtualenv prompt, since it doesn't play nice with fish
set -x VIRTUAL_ENV_DISABLE_PROMPT 1
# grc colouriser
set -U grcplugin_ls --color
@@ -33,6 +39,12 @@ end
# QT autoscaling, helpful for hidpi systems
set -x QT_AUTO_SCREEN_SCALE_FACTOR 1
# SilverSearcher 'ag' ('ack' and 'grep' replacement)
#set -gx FZF_DEFAULT_COMMAND 'ag -g ""'
set -gx FZF_DEFAULT_COMMAND 'rg --files --no-ignore --hidden --follow --glob "!.git/*" --glob "!*.pyc"'
set -gx FZF_CTRL_T_COMMAND "$FZF_DEFAULT_COMMAND"
set -gx FZF_ALT_C_COMMAND "$FZF_DEFAULT_COMMAND"
# Aliases
## Listing
alias ll 'ls -alF'
@@ -53,6 +65,11 @@ alias gl "git log"
alias gt 'git tag|less'
#alias gad 'git log --pretty='"'"'%at'"'"' | while read d; do date -d "@$d"; done | awk '"'"'{print $1}'"'"' | sort | uniq -c'
alias ffnightly 'env MOZ_USE_XINPUT2=1 /usr/local/bin/firefoxnightly/firefox'
## SSH, for compatibility, as our terminfo now is non-standard 'tmux-256color-italic' in tmux
alias ssh 'env TERM=xterm-256color ssh'
## Grepping
alias findfile 'find . | grep -v .svn | grep -v .hg | grep -v .git | grep'
alias findphp 'find . -name "*.php" | xargs grep --color=auto'

View File

@@ -1,7 +1,11 @@
fisherman/await
edc/bass
oh-my-fish/theme-bobthefish
fisherman/fzf
fisherman/get
fisherman/getopts
oh-my-fish/plugin-grc
fisherman/last_job_id
fisherman/nvm
fisherman/shark
fisherman/z

Binary file not shown.

View File

@@ -0,0 +1,13 @@
# A xterm-256color based TERMINFO that adds the escape sequences for italic.
#
# Install:
#
# tic xterm-256color-italic.terminfo
#
# Usage:
#
# export TERM=xterm-256color-italic
#
tmux-256color-italic|tmux with 256 colors and italic,
sitm=\ePtmux;\e\E[3m\e\\, ritm=\ePtmux;\e\E[23m\e\\,
use=screen-256color,

View File

@@ -2,7 +2,7 @@
set -g bell-action any
# Default termtype. If the rcfile sets $TERM, that overrides this value.
set -g default-terminal screen-256color
set -g default-terminal tmux-256color-italic
# Keep your finger on ctrl, or don't
bind-key ^D detach-client

View File

@@ -32,3 +32,33 @@ Xylometazoline
gedehydrateerd
ofzo
dubbelaflevering
bolognese
penne
draagconsulente
verstikkingsgevaar
warmteregulerend
draagpop
chocoladehagel
standup
crappy
cogitorama
weekplanning
Trello
footer
slavink
meh
review
kudos
zevenen
planningsessie
aangeprutst
bapao
bapao's
thuiskantoor
grilham
paasontbijt
paaseitjes
schuifje
magneetjes
Vomar
weekplanner

Binary file not shown.

View File

@@ -32,9 +32,15 @@ highlight link todoComment Comment
" Heading (day) delimiters
syn region todoDay matchgroup=todoHeadingDelimiter start="==\@!" end="==*\s*$" keepend oneline
syntax region todoDay start=/\v\=\=\ / skip=/\v\\./ end=/\v\ \=\=\=\=\=\=/
hi def link todoHeadingDelimiter Delimiter
hi link todoDay Delimiter
" Show -scratched out- parts of a line as darker text (Delimiter colour)
syntax region scratchThis start=/\v -/ skip=/\v\\./ end=/\v-\ / oneline
hi link scratchThis Delimiter
" Generic operators
@@ -52,22 +58,24 @@ syntax match note "\v n .*$"
syntax match note "\v .*$"
highlight note ctermfg=Grey guifg=#eeeeee
syntax match todoStatusDone "\v^v "
syntax match todoStatusDone "\v v "
syntax match todoStatusDone "\v^x "
syntax match todoStatusDone "\v x "
syntax match todoStatusDone "\v^v " nextgroup=todoItem skipwhite
syntax match todoStatusDone "\v v " nextgroup=todoItem skipwhite
highlight todoStatusDone ctermfg=green guifg=#00ff00
syntax match todoStatusDoing "\v^d .*$"
syntax match todoStatusDoing "\v d .*$"
syntax match todoStatusCancelled "\v^x " nextgroup=todoItem skipwhite
syntax match todoStatusCancelled "\v x " nextgroup=todoItem skipwhite
highlight todoStatusCancelled ctermfg=DarkGreen
syntax match todoStatusDoing "\v^d .*$" nextgroup=todoItem skipwhite
syntax match todoStatusDoing "\v d .*$" nextgroup=todoItem skipwhite
highlight todoStatusDoing ctermfg=223 guifg=#f0dfaf
syntax match todoStatusTest "\v^t "
syntax match todoStatusTest "\v t "
syntax match todoStatusTest "\v^t " nextgroup=todoItem skipwhite
syntax match todoStatusTest "\v t " nextgroup=todoItem skipwhite
highlight todoStatusTest ctermfg=darkcyan guifg=#6666ff
syntax match todoStatusTodo "\v^- "
syntax match todoStatusTodo "\v - "
syntax match todoStatusTodo "\v^- " nextgroup=todoItem skipwhite
syntax match todoStatusTodo "\v - " nextgroup=todoItem skipwhite
highlight todoStatusTodo ctermfg=red guifg=#ff0000
syntax match todoStatusImportant "\v^\> .*$"
@@ -77,10 +85,20 @@ syntax match todoStatusImportant "\v ! .*$"
"highlight todoStatusImportant ctermfg=131 guifg=#af5f5f
highlight todoStatusImportant ctermfg=167 guifg=#d75f5f
syntax match todoStatusQuestion "\v^\? "
syntax match todoStatusQuestion "\v \? "
syntax match todoStatusQuestion "\v^\? " nextgroup=todoItem skipwhite
syntax match todoStatusQuestion "\v \? " nextgroup=todoItem skipwhite
highlight todoStatusQuestion ctermfg=darkcyan guifg=#6666ff
" Highlight matching brackets (for example a timeslot)
"syntax match brack /[\[\]]/ | hi brack ctermfg=DarkMagenta
syntax match timeslot "\v\[.*-.*\] " nextgroup=todoItem skipwhite
highlight timeslot ctermfg=Magenta
" A todoItem has a subject (e.g., a word that's followed by a ':')
syn match todoItem '\i\+:' contained
hi todoItem ctermfg=Blue
highlight link todoStatusDone PreProc
highlight link todoStatusDoing PreProc
highlight link todoStatusTodo PreProc

120
.vimrc
View File

@@ -6,6 +6,8 @@
set shell=/bin/bash
set encoding=utf-8
" change the <Leader> key from \ to ,
let mapleader=","
@@ -67,15 +69,21 @@ Plugin 'jnurmine/Zenburn.git'
" Quick file system tree, mapped to Ctrl+n for quick toggle
Plugin 'scrooloose/nerdtree'
map <C-n> :NERDTreeToggle<CR>
let NERDTreeIgnore = ['\.pyc$']
let NERDTreeIgnore = ['\.pyc$', 'tags']
" close vim if the only window left open is a NERDTree
autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTreeType") && b:NERDTreeType == "primary") | q | endif
" Rooter changes the working directory to the project root when you open a
" file or directory. Useful when using fzf for example.
Plugin 'airblade/vim-rooter'
" Do not echo the project directory
let g:rooter_silent_chdir = 1
" Full path fuzzy file, buffer, mru, tag, ... finder
" Quickly open files, fuzzy search on name
Plugin 'ctrlpvim/ctrlp.vim'
"let g:ctrlp_map = '<Leader>t'
let g:ctrlp_map = '<c-p>'
" Search in Files, Buffers and MRU files at the same time:
let g:ctrlp_cmd = 'CtrlPMixed'
@@ -86,6 +94,24 @@ let g:ctrlp_working_path_mode = 0
let g:ctrlp_dotfiles = 0
let g:ctrlp_switch_buffer = 0
" Run your favorite search tool from Vim, with an enhanced results list.
" Supports Silver Searcher `ag`. Use with:
" :Ack [options] {pattern} [{directories}]
Plugin 'mileszs/ack.vim'
" apt install silversearcher-ag
if executable('ag')
"let g:ackprg = 'ag --nogroup --nocolor --column'
let g:ackprg = 'ag --vimgrep'
endif
" fzf integration for fast fuzzy finding, better and faster than ctrl-p
set rtp+=~/workspace/projects/others/fzf
Plugin 'junegunn/fzf.vim'
nmap ; :Buffers<CR>
nmap <Leader>f :Files<CR>
nmap <Leader>t :Tags<CR>
nmap <Leader>c :Commits<CR>
" Web Development/Filetype icons
" Needs a font like found at
@@ -97,8 +123,22 @@ Plugin 'ryanoasis/vim-devicons'
" == Content convenience ======
" transparent editing of gpg encrypted files. The filename must have a .gpg,
" .pgp or .asc suffix.
Plugin 'jamessan/vim-gnupg'
" tcomment provides easy to use, file-type sensible comments for Vim. It
" can handle embedded syntax.
Plugin 'tomtom/tcomment_vim'
" Typescript syntax file and more
Plugin 'leafgarland/typescript-vim'
autocmd BufNewFile,BufRead *.ts setlocal filetype=typescript
" handling column separated data (csv)
Plugin 'chrisbra/csv.vim'
autocmd BufNewFile,BufRead *.csv setlocal filetype=csv
" Automatically insert matching close bracket where it belongs
"Plugin 'seletskiy/vim-autosurround'
"inoremap ( (<C-O>:call AutoSurround(")")<CR>
@@ -148,17 +188,32 @@ set complete+=kspell
" Also, vim-nox-py2 might be needed
Plugin 'davidhalter/jedi-vim'
"let g:jedi#force_py_version = 2
let g:ycm_server_python_interpreter = '/usr/bin/python'
" For example in termux, ycm does not want to compile, don't load it there
" with ~/.dot_no_ycm
let skip_ycm=fnamemodify(expand("$MYVIMRC"), ":p:h") . "/.dot_no_ycm"
if !filereadable(skip_ycm) " Only load YouCompleteMe if ~/.dot_no_ycm does not exist
" code-completion engine
" sudo apt-get install build-essential cmake
" sudo apt-get install python-dev
" cd ~/.vim/bundle/YouCompleteMe
" ./install.py # For C-style languages: ./install.py --clang-completer
Plugin 'Valloric/YouCompleteMe'
" YouCompleteMe interpreter version (should be the same as what YCM was
" compiled with):
"let g:ycm_server_python_interpreter = '/usr/bin/python'
let g:ycm_server_python_interpreter = '/usr/bin/python3'
" Debug stuff
"let g:ycm_server_keep_logfiles = 1
"let g:ycm_server_log_level = 'debug'
endif
" Improved Django handling
Plugin 'tweekmonster/django-plus.vim'
" Code checker. For python, install flake8 or pylint, preferably in the
" virtualenv. For Django support, install pylint-django
"Disabled, using ALE instead (see below); the settings here are not needed
"Plugin 'vim-syntastic/syntastic'
set statusline+=%#warningmsg#
set statusline+=%{SyntasticStatuslineFlag()}
@@ -201,12 +256,16 @@ let g:ale_fixers = {}
" Python specific settings
let g:ale_fixers.python = ['isort']
" No silly 80-char line limit. Sorry pep-8. Also, Django support. Disable 'invalid name', 'missing docstring'
let g:ale_python_pylint_options="--max-line-length=120 -d C0103,C0111"
if exists('b:is_django')
let g:ale_python_pylint_options="--max-line-length=120 --load-plugins pylint_django --disable=invalid-name,missing-docstring"
else
let g:ale_python_pylint_options="--max-line-length=120 --disable=invalid-name,missing-docstring"
endif
" Show errors or warnings in the statusline
let g:airline#extensions#ale#enabled = 1
" UI
let g:ale_sign_error = ''
let g:ale_sign_warning = ''
let g:ale_sign_error = 'x'
let g:ale_sign_warning = '>'
" Handy Markdown stuff
@@ -215,6 +274,9 @@ Plugin 'godlygeek/tabular'
Plugin 'plasticboy/vim-markdown'
" Do not fold markdown files by default
let g:vim_markdown_folding_disabled = 1
set nofoldenable
" Use filetype name as fenced code block languages for syntax highlighting
let g:vim_markdown_fenced_languages = ['c++=cpp', 'viml=vim', 'bash=sh', 'ini=dosini', 'python=python']
if v:version >= 704
" Pandoc, for stuff like autocompletion of citations from bibtex, other LaTeX
@@ -222,8 +284,30 @@ if v:version >= 704
Plugin 'vim-pandoc/vim-pandoc'
endif
" Distraction-free writing, start with <Leader>V (\V or ,V in this config)
Plugin 'mikewest/vimroom'
Plugin 'junegunn/goyo.vim'
let g:goyo_width = 120
" Help focus on text by dimming other parts a bit
Plugin 'junegunn/limelight.vim'
let g:limelight_conceal_ctermfg = 'Grey69'
let g:limelight_conceal_ctermfg = 145
" Helps with writing prose (better line breaks, agnostic on soft line wraps vs
" hard line breaks etc)
Plugin 'reedes/vim-pencil'
" Disable automatic formatting, as this automatically merges lines devided by
" 1 hard enter only, which can be annoying
let g:pencil#autoformat = 0
" Do not insert hard line breaks in the middle of a sentence
let g:pencil#wrapModeDefault = 'soft' " default is 'hard'
" Toggle Gogo with Limelight and Pencil together with Ctrl+F11
"map <C-F11> :Goyo <bar> :Limelight!! <bar> :TogglePencil <CR>
nmap <leader>V :Goyo <bar> :Limelight!! <bar> :TogglePencil <CR>
" undotree.vim : Display your undo history in a graph.
Plugin 'mbbill/undotree'
@@ -254,15 +338,22 @@ Plugin 'lepture/vim-jinja'
"Plugin 'chrisbra/csv.vim' " apparently doesn't work this way ;)
" Automatic generation of tags file (ctags), in a central place (~/.vimtags)
Plugin 'xolox/vim-misc'
Plugin 'xolox/vim-easytags'
"Plugin 'xolox/vim-misc'
"Plugin 'xolox/vim-easytags'
" easytags highlighting is slow
let g:easytags_auto_highlight = 0
"let g:easytags_auto_highlight = 0
" Automatic generation of tags file (ctags: Exhuberant Ctags)
Plugin 'ludovicchabant/vim-gutentags'
" know when Gutentags is generating tags (prints 'TAGS' in status-line)
set statusline+=%{gutentags#statusline()}
let g:gutentags_ctags_exclude = ["*.min.js", "*.min.css", "build", "vendor", ".git", "node_modules", "*.vim/bundle/*"]
" All of your Plugins must be added before the following line
call vundle#end() " required
filetype plugin indent on " required
"filetype plugin on
" Enable line numbers, highlighting of current line and syntax highlighting by default
set number
@@ -309,7 +400,7 @@ set hidden
set cryptmethod=blowfish2
" Ensure 256 colour support if the terminal supports it
if &term == "xterm" || &term == "xterm-256color" || &term == "screen-bce" || &term == "screen-256color" || &term == "screen"
if &term == "xterm" || &term == "xterm-256color" || &term == "screen-bce" || &term == "screen-256color" || &term == "screen" || &term == "tmux-256color-italic"
set t_Co=256
colorscheme zenburn
@@ -338,6 +429,9 @@ iab <expr> timeh strftime("## %Y%m%d %a %H:%M:%S")
" Fly through buffers instead of cycling
nnoremap <leader>l :ls<cr>:b<space>
" Close Location windows, if exist, switch to the previous view buffer, and then close the last switched buffer.
nnoremap <silent> <leader>q :lclose<bar>b#<bar>bd #<CR>
" Git and Mercurial 'blame' command. First select lines in visual modes, then
" hit the appropriate leader key sequence (e.g., \g for git blame)
" Update: For Git blame, just do :Gblame from vim-fugitive
@@ -371,3 +465,7 @@ set autoindent
" Django html template highlighting by default
au BufNewFile,BufRead *.html set filetype=htmldjango
" Italics
let &t_ZH = "\e[3m"
let &t_ZR = "\e[23m"

View File

@@ -1,14 +1,16 @@
dotfiles
========
After having my homedirs in subversion for years, move to Git.
After having my homedirs in subversion for years, moved this collection to Git in 2014 and standardised over all my machines.
To install:
```
mkdir ~/.dot
cd ~/.dot
clone <url>
cd dotfiles # this takes you to the freshly cloned ~/.dot/dotfiles
sh install.sh # install the files in the homedir
sh install.sh # follow the instructions and install the files in the homedir
```
# Fix for shift+F6 in tmux (and screen probably)
@@ -17,7 +19,7 @@ In tmux, do `infocmp > screen-256color`. Add the line `kf16=\E[17;2~,` and compi
# ~/.git_repos config file
The update_repos script takes the ~/.git_repos config file and lets you update and clone your projects automatically (or at least in a batch). In the example the first four repos are located in ~/workspace/projects/github, and the other two in workspace/projects/others and workspace/projects/private respectively; then the workspace and group are empty, so mydocs is cloned into the homedir. At the moment, only paths relative to the user's homedir are supported.
The `update_repos` script takes the `~/.git_repos` config file and lets you update and clone your projects automatically (or at least in a batch). In the example the first four repos are located in ~/workspace/projects/github, and the other two in workspace/projects/others and workspace/projects/private respectively; then the workspace and group are empty, so mydocs is cloned into the homedir. At the moment, only paths relative to the user's homedir are supported.
```
workspace=workspace/projects
@@ -38,3 +40,20 @@ workspace=
group=
ssh://myserver/srv/git/mydocs.git
```
# Interesting scripts
| ./bin/ | description |
|------------------|-----------------------------------------------------------------------------------------|
| calibre_update | Update (or install) ebook manager Calibre |
| clean_mac_files | Remove those DS_Store and other dirs |
| clean_project | Remove compiled Python files, vim swp files |
| clean_pyc | Remove compiled Python files |
| fixpermissions | chmod dirs to 755, files to 644 |
| fixpictimestamps | Change file ctime to datetime from EXIF |
| fontupdate | Update nerd-fonts; whole repo on server, link font files to ~/.local/share/fonts |
| fuz | Simple note-taking 'app' based on FZF and vim |
| git_autosave | Simple script to call from crontab or something to commit certain files in Git and push |
| git_clean | Clean the Git tree |
| sorter | Sort files in newly created subdirectories, based on pre- or postfixes |
| update_repos | Update a bunch of Git repos at once, like all your project. Config with ~/.git_repos |

12
bin/clean_project Executable file
View File

@@ -0,0 +1,12 @@
#!/bin/bash
read -p "Close vim and stop running (Python) processes. Type 'c' to continue after doing so, any other key to abort. " -n 1 -r
echo # (optional) move to a new line
if [[ $REPLY =~ ^[Cc]$ ]]
then
# do semi-dangerous stuff
find . -name "*.pyc" -type f -delete
find . -name "*.swp" -type f -delete
find . -name "*.swo" -type f -delete
else
echo "aborted"
fi

21
bin/fuz Executable file
View File

@@ -0,0 +1,21 @@
#!/usr/bin/env bash
# Taken from https://medium.com/adorableio/simple-note-taking-with-fzf-and-vim-2a647a39cfa
set -e
main() {
previous_file="$1"
file_to_edit=`select_file $previous_file`
if [ -n "$file_to_edit" ] ; then
"${EDITOR:-vim}" "$file_to_edit"
main "$file_to_edit"
fi
}
select_file() {
given_file="$1"
fzf --preview="cat {}" --preview-window=right:70%:wrap --query="$given_file"
}
main ""

View File

@@ -2,18 +2,13 @@
if [ -n "$1" ]; then
FIRSTFILE=$1
#echo $!
GITDIR=$(dirname ${FIRSTFILE})
#echo $GITDIR
cd $GITDIR
DATETIME=`date +%Y%m%d\ %H:%M:%S`
#echo $DATETIME
GITDIR=$(dirname "${FIRSTFILE}")
cd "$GITDIR" || exit
DATETIME=$(date +%Y%m%d\ %H:%M:%S)
#git pull
RESULT=`git commit $* -m "Autosave at $DATETIME"`
echo $RESULT
RESULT=$(git commit $* -m "Autosave at $DATETIME")
echo "$RESULT"
#zenity --info --text=$RESULT
#echo $?
#echo "git commit $* -m 'Autosave at $DATETIME'"
git push
else

33
bin/logfileinfo Executable file
View File

@@ -0,0 +1,33 @@
#!/usr/bin/env python3
from urllib.parse import urlparse
domains = {}
privacy_domains = {}
#with open('consent_20180227_1055.log', encoding='latin1') as pf:
with open('logfile.log') as pf:
logdata = pf.readlines()
for line in logdata:
url = line.split(' ')[10]
url = url[1:-1] # Strip quotes
domain = urlparse(url).netloc
if domain not in domains:
domains[domain] = 0
domains[domain] += 1
url = line.split(' ')[6]
#print(url)
domain = urlparse(url).netloc
if domain not in privacy_domains:
privacy_domains[domain] = 0
privacy_domains[domain] += 1
print('== Referrers ======')
for key in sorted(domains, key=domains.__getitem__, reverse=True):
print('{:6} {}'.format(domains[key], key))
print()
print('== Domains ======')
for key in sorted(privacy_domains, key=privacy_domains.__getitem__, reverse=True):
print('{:6} {}'.format(privacy_domains[key], key))

View File

@@ -2,4 +2,4 @@
cd ~/mydocs/work/sanoma
git pull
#vim -c ":vsp planning_2015.todo" notes_2015.md notes_2014.md
vim -c "set nofoldenable" planning_2017.todo cs_notes.md cs_howtos.md dcp_notes.md dcp_howtos.md
vim -c "set nofoldenable" planning_2018.todo cs_notes.md cs_howtos.md dcp_notes.md dcp_howtos.md planning_2017.todo