Commits

firefly committed 7d7deb3

Added 'dotlink.sh' utility script, and also some minor changes.

  • Participants
  • Parent commits 88dc381

Comments (0)

Files changed (4)

+#!/bin/bash
+
+##-- Helper functions -------------------------------------
+# Prints usage, and exits with the specified exit code (or 2 if no exit code is
+# explicitly provided).
+function print_usage_and_exit {
+  echo >&2 <<END
+Usage: $0 <target> [source]"
+  target: Name for the dotfile in ~ without leading dot, e.g. 'vimrc'.
+  source: Relative path to the dotfile in \$DOTFILES, e.g. 'vim/vimrc'.  Default is \`target\`".
+
+Environment variables:
+  \$DOTFILES: points to the source directory to copy files from (defaults to
+          ~/local/dotfiles).
+END
+
+  if [ $# -eq 1 ]; then
+    exit $1
+  else
+    exit 2
+  fi
+}
+
+# Fatally exits with the given error message.  Used in assertions for important
+# commands.
+function die {
+  echo >&2 "$1"
+  exit 1
+}
+
+
+##-- Entry point ------------------------------------------
+# Make sure that we received enough parameters.
+if [ $# -lt 1 -o $# -gt 2 ]; then
+  print_usage_and_exit
+fi
+
+## Process parameters.
+# `sourcerel` is the relative path from $DOTFILES to the file to link to.
+# $2 if provided, otherwise $1.
+[ $# -ge 2 ] && sourcerel="$2" || sourcerel="$1"
+
+## Process env variables.
+# If $DOTFILES is empty or not provided, set it to its default value.
+if [ "x$DOTFILES" = "x" ]; then
+  DOTFILES="${HOME}/local/dotfiles"
+fi
+
+## Locals
+homename="$HOME/.$1"
+homebak="${homename}~"
+sourcename="$DOTFILES/$sourcerel"
+
+if [ -e "$homename" -o -L "$homename" ]; then
+  if [ -e "$homebak" -o -L "$homebak" ]; then
+    # Make sure that we're not overwriting someone's backup file.
+    echo >&2 "Error: both the target file $homename and its backup name $homebak" \
+             'exist already!  Refuses to continue; manually remove the backup file.'
+    exit 3
+  fi
+
+  # Backup the already-existing target file.
+  echo >&2 "Warning: target $homename already exists. Backing it up as ${homebak}."
+  mv "$homename" "$homebak" || die 'Error while backing up! Refuses to continue.'
+fi
+
+# All right, ready to do the actual linking.
+ln -s "$sourcename" "$homename" || die 'Error while linking! Refuses to continue.'

File herbstluftwm/autostart

 PATH="$XDG_CONFIG_HOME/herbstluftwm:$XDG_CONFIG_PATH/herbstluftwm:$PATH"
 
 function hc() {
-    herbstclient "$@"
+  herbstclient "$@"
 }
 
 hc emit_hook reload
 
 xsetroot -solid '#111111'
 #feh --bg-fill $HOME/annat/diverse/wallpapers/internet-nodes.jpg
+feh --bg-fill "$HOME/pics/copland-os/copland-os_768.png"
 
 
 # remove all existing keybindings
 #hc set window_border_active_color '#9fbc00'
 #hc set window_border_active_color '#00ff00'
 
-hc set frame_border_active_color '#aa5500'
-hc set window_border_active_color '#aa5500'
-hc set frame_bg_active_color '#080808'
+#hc set frame_border_active_color   '#AA5500'
+#hc set window_border_active_color  '#AA5500'
+#hc set frame_bg_active_color       '#080808'
+#hc set frame_border_normal_color   '#222222'
+#hc set window_border_normal_color  '#222222'
+#hc set frame_bg_normal_color       '#111111'
 
-hc set frame_border_normal_color '#222222'
-hc set window_border_normal_color '#222222'
-hc set frame_bg_normal_color '#111111'
+hc set frame_border_active_color   '#3366AA'
+hc set window_border_active_color  '#3366AA'
+hc set frame_bg_active_color       '#000000'
+hc set frame_border_normal_color   '#021433'
+hc set window_border_normal_color  '#222222'
+hc set frame_bg_normal_color       '#111111'
 
 hc set focus_follows_shift 1
 
 hc set frame_bg_transparent 1
 hc set frame_border_width 1
 hc set window_border_width 1
-hc set window_border_inner_width 0
-#hc set always_show_frame 1
+hc set window_border_inner_width 1
+hc set always_show_frame 0
 hc set frame_gap 8
 # add overlapping window borders
 hc set window_gap -1

File vim/doc/tags

 'solarized_termtrans'	solarized.txt	/*'solarized_termtrans'*
 'solarized_underline'	solarized.txt	/*'solarized_underline'*
 'solarized_visibility'	solarized.txt	/*'solarized_visibility'*
-AnsiEsc	AnsiEsc.txt	/*AnsiEsc*
-AnsiEsc-contents	AnsiEsc.txt	/*AnsiEsc-contents*
-AnsiEsc-copyright	AnsiEsc.txt	/*AnsiEsc-copyright*
-AnsiEsc-history	AnsiEsc.txt	/*AnsiEsc-history*
-AnsiEsc-manual	AnsiEsc.txt	/*AnsiEsc-manual*
-AnsiEsc.txt	AnsiEsc.txt	/*AnsiEsc.txt*
 before	solarized.txt	/*before*
 learnvim-Additional-Plugins	learnvim.txt	/*learnvim-Additional-Plugins*
 learnvim-Advanced	learnvim.txt	/*learnvim-Advanced*
 
 """" Mappings """""""""""""""""""""""""""""""""""""""""""""""""""""""
 "let mapleader = ","
-"let mapleader = " "
 let mapleader = "-"
 
 noremap ä :
 " Switch to last (alternate) buffer with <Leader><Leader>, and reload current
 " file with <Leader>e.
 nnoremap <Leader><Leader> <C-^>
-nnoremap <Leader>e :e%<CR>
+nnoremap <Leader>e :silent e%<CR>
+nnoremap <Leader>re :silent e ~/.vimrc<CR>
+nnoremap <Leader>rs :silent source ~/.vimrc<CR>
 
 
 " Switch to buffer N with <Leader>N
 
 
 """" Formatting etc. """"""""""""""""""""""""""""""""""""""""""""""""
+set formatoptions+=ro           " Auto-continue comments on <CR>/o/O
 set formatoptions+=n            " Indent numbered lists in comments better
 set formatoptions+=l            " Don't wrap lines that were already long
 set formatoptions+=j            " Remove comment leaders when joining
 
+set comments=s1:/*,mb:*,ex:*/,O://,bO:#,:%,n:>,fb:-
+
 
 """" Visuals, aesthetics """"""""""""""""""""""""""""""""""""""""""""
 "set number                      " Use line numbering
-set ruler                       " Show scroll percentage in statusline
+set ruler                       " Show scroll percentage even if no statusline
 set cursorline                  " Highlight cursor's line
 
 set textwidth=80
 au BufRead,BufNewFile {*.om}                 setf om
 au BufRead            {*/xchatlogs/*.log}    setf irclog | set ro noma
 
-" Add custom filetype-dependent metadata
+" Custom filetype-dependent metadata
 au FileType lua  setlocal comments=:--
 
 
 "end
 
 "color Tomorrow-Night-Bright-ff
-let g:jellybeans_background_color_256 = "16"
-let g:jellybeans_background_color     = "000"
+"let g:jellybeans_background_color_256 = "16"
+let g:jellybeans_background_color_256 = "NONE"
+"let g:jellybeans_background_color     = "000"
 let g:jellybeans_overrides =
-\     { 'CursorLine'   : { '256ctermbg' : '233', 'guibg': '090909' }
-\     , 'StatusLine'   : { '256ctermfg' : '3',   'guifg': 'C93',
-\                          '256ctermbg' : '236', 'guibg': '222'    }
-\     , 'StatusLineNC' : { '256ctermfg' : '242', 'guifg': '999',
-\                          '256ctermbg' : '234', 'guibg': '111'    }
-\     , 'ColorColumn'  : { '256ctermbg' : '233', 'guibg': '090909' }
-\     , 'LineNr'       : { '256ctermfg' : '238'  }
-\     , 'Folded'       : { '256ctermbg' : '234'  }
-\     , 'CursorLineNr' : { '256ctermfg' : '3'
-\                        , '256ctermbg' : '234'  }
-\     , 'Conceal'      : { '256ctermfg' : '14'
-\                        , '256ctermbg' : 'NONE' }
-\     , 'ModeMsg'      : { 'attr'       : 'bold',
-\                          '256ctermfg' : '2',   'guifg': '9C3'    }
+\     { 'CursorLine':    { '256ctermbg': '232'  }
+\     , 'ColorColumn':   { '256ctermbg': '233'  }
 \
-\     , 'Operator'     : { '256ctermfg' : '73'   }
-\     , 'markdownCode' : { '256ctermfg' : '175'  }
-\     , 'markdownCodeBlock' : { '256ctermfg' : '175'  }
+\     , 'VertSplit':     { '256ctermbg': 'NONE' }
+\
+\     , 'StatusLine':    { '256ctermbg': '236',  '256ctermfg': '3'   }
+\     , 'StatusLineNC':  { '256ctermbg': '234',  '256ctermfg': '242' }
+\
+\     , 'LineNr':        {                       '256ctermfg': '238' }
+\     , 'CursorLineNr':  { '256ctermbg': '234',  '256ctermfg': '3'   }
+\     , 'SignColumn':    { '256ctermbg': '233'  }
+\     , 'Folded':        { '256ctermbg': '233'  }
+\
+\     , 'Conceal':       { '256ctermbg': 'NONE', '256ctermfg': '14'  }
+\     , 'ModeMsg':       { 'attr'      : 'bold', '256ctermfg': '2'   }
+\
+\     , 'Operator':      {                       '256ctermfg': '73'  }
+\     , 'markdownCode':  {                       '256ctermfg': '175' }
+\     , 'markdownCodeBlock': {                   '256ctermfg': '175' }
 \     }
-"\                          '256ctermfg' : '253'
 color jellybeans
 
 
 
 
 """" Status line """"""""""""""""""""""
-"set laststatus=1                " Only display status line if >1 window
-set laststatus=2                " Never mind.  Always display status line.
+set laststatus=0
+"set laststatus=2                " Never mind.  Always display status line.
 
 set statusline=
 set statusline+=%*              " --> highlight
 set statusline+=\ %P\           " space, percentage in file, space
 
 " Make the ruler also display the bufno
-set rulerformat=%2*[%2n]\ %-8.(%l,%c%V%)\ %P\ 
+set rulerformat=%2*%2n\ %-8.(%l,%c%V%)\ %P
 
 " Title string
 set titlestring="hello"
 "au! BufRead,BufWrite,BufWritePost,BufNewFile *.org  " Remove existing autocommands
 "au  BufEnter *.org  call org#SetOrgFileType()       " Init VimOrganizer
 
-"NERDTree
+" NERDTree
 let g:NERDTreeMinimalUI=1
 nnoremap <F10> :<C-u>NERDTreeToggle<CR>
 
 " gundo
 nnoremap <F9> :GundoToggle<CR>
 
-"netrw
+" netrw
 let g:netrw_bufsettings = 'noma nomod nu nobl nowrap ro'
 
+" svndiff
+let g:svndiff_autoupdate = 1
 
-""" Plugin keymappings """"""""""""""""
+""" Update in svndiff.vim:
+"sign define svndiff_add    text=+ texthl=diffAddSign
+"sign define svndiff_delete text=− texthl=diffDeleteSign
+"sign define svndiff_change text=~ texthl=diffChangeSign
+
+hi diffAddSign    cterm=bold ctermfg=70  ctermbg=233
+hi diffDeleteSign cterm=bold ctermfg=160 ctermbg=233
+hi diffChangeSign cterm=bold ctermfg=178 ctermbg=233
+
+" Tabularize
 noremap <Leader>a= :Tabularize /=<CR>
 noremap <Leader>a: :Tabularize /:<CR>
 noremap <Leader>a\| :Tabularize /\|<CR>