diff options
author | Johannes Ranke <jranke@uni-bremen.de> | 2016-10-26 12:58:45 +0200 |
---|---|---|
committer | Johannes Ranke <jranke@uni-bremen.de> | 2016-10-26 15:05:52 +0200 |
commit | de43eb36413ac4f2d4705e619c829c0f117adce7 (patch) | |
tree | 7447904c130ab53c3785bb7862292d5f5dae5241 |
Initial commit
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | Makefile | 3 | ||||
-rw-r--r-- | bashrc | 135 | ||||
-rwxr-xr-x | bin/a4copy | 26 | ||||
-rwxr-xr-x | bin/pdfscan | 33 | ||||
-rwxr-xr-x | install | 24 | ||||
-rw-r--r-- | vimrc | 124 |
7 files changed, 346 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..e5f7a48 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +bak diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..8f9447e --- /dev/null +++ b/Makefile @@ -0,0 +1,3 @@ +.PHONY: install +install: + ./install @@ -0,0 +1,135 @@ +# vim: foldmethod=marker ts=4 sw=4 +# editor {{{ +# Prefer neovim over vim over vi +if [ -e /usr/bin/nvim ] +then + EDITOR=/usr/bin/nvim +else + if [ -e /usr/bin/vim ] + then + EDITOR=/usr/bin/nvim + else + EDITOR=/usr/bin/vi + fi +fi +# }}} +# private bin {{{ +if [ -d ~/bin ] ; then + PATH=~/bin:"${PATH}" +fi +# }}} +# R {{{ +# littler scripts distributed with the littler package +PATH=/usr/local/lib/R/site-library/littler/examples:"${PATH}" + +# RPython +export RPYTHON_PYTHON_VERSION=3 + +# Vim-R-plugin +# From r-plugin-bash-setup help page in Vim-R-plugin (Debian package 1.2-1) +# Change the TERM environment variable (to get 256 colors) and make Vim +# connect to th X Server even if running in a terminal emulator (many of +# the plugin features depend on this). Now only needed for "old" vim +# like vim 7.4 from Debian stable +if [ "x$DISPLAY" != "x" ] +then + if [ "screen" = "$TERM" ] + then + export TERM=screen-256color + else + export TERM=xterm-256color + fi + alias vim='vim --servername VIM' +fi + +alias tarxz='tar --use-compress-program=pxz -c -v -f' + +# Path where the R sources are +export RTOP=~/svn/R +# }}} +# debian {{{ +export DEBEMAIL=jranke@uni-bremen.de +export DEBFULLNAME="Johannes Ranke" +# }}} +# rdkit {{{ +# RDKIT (commented out on 2015-10-02 as I am using the Debian package python-rdkit +#export RDBASE="$HOME/git/rdkit" +#export LD_LIBRARY_PATH="$RDBASE/lib" +#export PYTHONPATH="${PYTHONPATH}:$RDBASE:$HOME/ariance/aeras/libreoffice:$HOME/py" +# }}} +# prompt {{{ +force_color_prompt=yes + +# identify the current chroot +if [ -z "$debian_chroot" ] && [ -r /etc/debian_chroot ]; then + debian_chroot=$(cat /etc/debian_chroot) +fi + +if [ -n "$force_color_prompt" ]; then + if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then + # We have color support; assume it's compliant with Ecma-48 + # (ISO/IEC-6429). (Lack of such support is extremely rare, and such + # a case would tend to support setf rather than setaf.) + color_prompt=yes + else + color_prompt= + fi +fi + +source ~/.git-prompt.sh + +if [ "$color_prompt" = yes ]; then + PS1="${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$(__git_ps1)\$ " +else + PS1="${debian_chroot:+($debian_chroot)}\u@\h:\w\$(__git_ps1)\$ " +fi +unset color_prompt force_color_prompt +# }}} +# history {{{ +# See bash(1) for more options +HISTCONTROL=ignoredups:ignorespace +shopt -s histappend +HISTSIZE=1000 +HISTFILESIZE=2000 +# }}} +# ls, dir and grep {{{ +# enable color support of ls and also add handy aliases +if [ -x /usr/bin/dircolors ]; then + test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)" + alias ls='ls --color=auto' + alias dir='dir --color=auto' + alias vdir='vdir --color=auto' + + alias grep='grep --color=auto' + alias fgrep='fgrep --color=auto' + alias egrep='egrep --color=auto' +fi + +# some more ls aliases +alias ll='ls -alF' +alias la='ls -A' +alias l='ls -CF' +alias lh='ls -lh' +# }}} +# alert {{{ +# Add an "alert" alias for long running commands. Use like so: +# sleep 10; alert +alias alert='notify-send --urgency=low -i "$([ $? = 0 ] && echo terminal || echo error)" "$(history|tail -n1|sed -e '\''s/^\s*[0-9]\+\s*//;s/[;&|]\s*alert$//'\'')"' +# }}} +# bash completion {{{ +# enable programmable completion features (you don't need to enable +# this, if it's already enabled in /etc/bash.bashrc and /etc/profile +# sources /etc/bash.bashrc). +if [ -f /etc/bash_completion ] && ! shopt -oq posix; then + . /etc/bash_completion +fi +# }}} +# {{{varia +# check the window size after each command and, if necessary, +# update the values of LINES and COLUMNS. +shopt -s checkwinsize + +# make less more friendly for non-text input files, see lesspipe(1) +[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)" +# }}} +export EDITOR PATH diff --git a/bin/a4copy b/bin/a4copy new file mode 100755 index 0000000..de45664 --- /dev/null +++ b/bin/a4copy @@ -0,0 +1,26 @@ +#!/bin/sh + +usage() +{ +echo "Usage: a4copy [Lineart|Gray|Color]" +} + +#test to see if the mode and a filename have been entered +if [ $# -lt 1 ] ; then usage ; exit 1 ; fi +mode=$1 + +echo Now scanning your A4 document to pdf + +#scan the A4 binary(b&w) file uncompressed at 300dpi to temporary file +scanimage \ + --mode $mode \ + -x 210 -y 296 \ + --resolution 300 \ + --format=tiff > temp-copy.tif + +#convert to pdf with G4 compression +tiff2pdf temp-copy.tif -p A4 -q G4 -o temp-copy.pdf +rm temp-copy.tif + +#print pdf +lpr temp-copy.pdf diff --git a/bin/pdfscan b/bin/pdfscan new file mode 100755 index 0000000..5b71b30 --- /dev/null +++ b/bin/pdfscan @@ -0,0 +1,33 @@ +#!/bin/sh + +usage() +{ +echo "Usage: pdfscan [Lineart|Gray|Color] [resolution] <nameofimage>" +} + +#test to see if the mode and a filename have been entered +if [ $# -lt 3 ] ; then usage ; exit 1 ; fi +mode=$1 +resolution=$2 +name=$3 + +#read output of help command to get scanner device name +#scanner=`scanimage --help | tail --lines=1 ` + +echo Now scanning your A4 document to pdf +#echo Now scanning your A4 document on $scanner + +#scan the A4 binary(b&w) file uncompressed at 300dpi to temporary file +#scanimage -d $scanner \ +scanimage \ + --mode $mode \ + -x 210 -y 296 \ + --resolution $resolution \ + --format=tiff > temp-$name.tif + +#convert to pdf with G4 compression +tiff2pdf temp-$name.tif -p A4 -q G4 -o $name.pdf +rm temp-$name.tif + +#display pdf +okular $name.pdf @@ -0,0 +1,24 @@ +#!/bin/bash +# run this script as ./install as we set its working dir from $BASH_SOURCE +cd $(dirname $BASH_SOURCE) + +# the path of the working dir +BASE=$(pwd) + +# dotfiles to install +for dotfile in bashrc vimrc; do + mkdir -pv bak + [ -e ~/.$dotfile ] && mv -v ~/.$dotfile bak/.$dotfile + ln -sfv $BASE/$dotfile ~/.$dotfile +done + +# git-prompt +if [ ! -e ~/.git-prompt.sh ]; then + curl https://raw.githubusercontent.com/git/git/master/contrib/completion/git-prompt.sh -o ~/.git-prompt.sh +fi + +# scripts +mkdir -pv ~/bin +for bin in $BASE/bin/*; do + ln -svf $bin ~/bin +done @@ -0,0 +1,124 @@ +" vim: foldmethod=marker foldlevel=0 ts=2 sw=2 + +" default settings (much is handled by tpope/sensible) {{{1 +set ts=2 +set sw=2 +set expandtab +filetype plugin on +filetype indent on + +" to ease the use of plugin mappings +let maplocalleader = "," +let mapleader = ";" + +" Plugins managed by vim-plug {{{1 +call plug#begin('~/.vim/plugged') + +Plug 'tpope/vim-fugitive' +Plug 'tpope/vim-sensible' +Plug 'tpope/vim-scriptease' " gives me K for looking up docs in vim scripts +Plug 'hrp/EnhancedCommentify' +Plug 'jalvesaq/R-Vim-runtime' +Plug 'jranke/vim-pandoc', { 'branch': 'rmd' } +Plug 'vim-pandoc/vim-pandoc-syntax' + +if !has('nvim') + Plug 'jranke/Vim-R-plugin' " for my vim version 7.4, legacy plugin not maintained by Jakson any more +else + Plug 'jalvesaq/Nvim-R' +endif + +call plug#end() + +" legacy Vim-R-plugin plugin {{{1 +if !has('nvim') + "let vimrplugin_vsplit = 0 + "let vimrplugin_rconsole_width = 100 + + "let vimrplugin_pdfviewer = "/usr/bin/okular" + "let vimrplugin_openpdf = 0 + let vimrplugin_assign = 0 + "let vimrplugin_objbr_place = "script,left" + let r_syntax_folding = 1 + let rmd_syn_hl_chunk = 1 + + let vimrplugin_map_r = 1 " is silent per default, therefore tried + "vnoremap r *@<Esc>:call SendSelectionToR("echo", "down")<CR> + " but this does not work as expected +else + vmap r <Esc>:call SendSelectionToR("echo", "down")<CR> + "let R_source_args = "print.eval = TRUE" + let R_vsplit = 1 + let R_assign = 0 +endif + +" R syntax {{{1 +let r_syntax_folding = 0 +let rmd_syn_hl_chunk = 1 + +" Search {{{1 +set infercase +"set hlsearch +set incsearch + +" Showmarks {{{1 +let marksCloseWhenSelected = 0 +let showmarks_include="abcdefghijklmnopqrstuvwxyz" + +" Syntax folding for tex and markdown {{{1 +" for syntax/tex.vim +let g:tex_fold_enabled=1 +" for syntax/markdown.vim +let g:rmd_syn_fold=1 + +" Beamer/tex environments - should go to some after/tex.vim script {{{1 +noremap \bf i\begin{frame}{}<Space>%{{{3<CR><CR>\end{frame}<CR><ESC>3k14li +noremap \bi i\begin{itemize}[<+->]<CR>\item <CR>\end{itemize}<ESC>k8li +noremap \bc i\begin{center}<CR><CR>\end{center}<CR><ESC>2ki +noremap \bt i\begin{table}\begin{tabular}{}<CR><CR>\end{tabular}\end{table}<CR><ESC>3ki +noremap \bo i\begin{columns}<CR>\begin{column}{}<CR>\end{column}<CR>\end{columns}<CR><ESC>3k17li +noremap \bs i\source{}<ESC>li +noremap \eq i\question[2]<CR>\begin{solution}[2cm]<CR>\end{solution}<CR><ESC>3kA + +" EnhancedCommentify {{{1 +vmap + <Plug>Comment +vmap - <Plug>DeComment + +" pandoc {{{1 +let pandoc#folding#fold_yaml=1 +let pandoc#folding#level=2 +let pandoc#folding#fdc=0 +let pandoc#syntax#conceal#use=0 + +" Show syntax highlighting under the cursor {{{1 +" http://vim.wikia.com/wiki/Identify_the_syntax_highlighting_group_used_at_the_cursor +map <F10> :echo "hi<" . synIDattr(synID(line("."),col("."),1),"name") . '> trans<' + \ . synIDattr(synID(line("."),col("."),0),"name") . "> lo<" + \ . synIDattr(synIDtrans(synID(line("."),col("."),1)),"name") . ">"<CR> + +" Show syntax highlighting group in status line +" http://vim.wikia.com/wiki/Showing_syntax_highlight_group_in_statusline +function! SyntaxItem() + return synIDattr(synID(line("."),col("."),1),"name") +endfunction + +" Status line {{{1 +if has('statusline') + set statusline=%#Question# " set highlighting + set statusline+=%-2.2n\ " buffer number + set statusline+=%#WarningMsg# " set highlighting + set statusline+=%f\ " file name + set statusline+=%#Question# " set highlighting + set statusline+=%h%m%r%w\ " flags + set statusline+=%{strlen(&ft)?&ft:'none'}, " file type + set statusline+=%{(&fenc==\"\"?&enc:&fenc)}, " encoding + set statusline+=%{((exists(\"+bomb\")\ &&\ &bomb)?\"B,\":\"\")} " BOM + set statusline+=%{&fileformat}, " file format + set statusline+=%{&spelllang}, " language of spelling checker + set statusline+=%{SyntaxItem()} " syntax highlight group under cursor + set statusline+=%= " ident to the right + set statusline+=0x%-8B\ " character code under cursor + set statusline+=%-7.(%l,%c%V%)\ %<%P " cursor position/offset +endif + +set laststatus=2 |