System Configuration

Destroy another computer?  Got a new one?  No matter.  Here's what you need.


General Desktop

1. Get Google Chrome.

2. Setup Passwords for Google Two-Step Verification (You'll have to enter your Google password to continue through that link to the destination.)
You'll want application passwords for Chrome Sync and others.

3. Get Pure Text.
Never suffer the unwanted formatted text paste into Outlook again. Windows+V is your new friend.
Put the executable in a permanent location, run it, and right-click on the System Tray icon and select Options... to customize.

4. Windows 7 Configuration


5. FTP with FileZilla, and compress/extract with 7 Zip.

6. Get Paint.NET
Don't forget the plugins you like:

Also consider the other plugins you mentioned. Here is a backup of the effects.


Porting Documents

1. The Usual Suspects: For every user account, including Public: "My Documents", "Downloads", "Music", "Pictures", "ThrowMeAway"

2. APPDATA: See what needs to be copied from %APPDATA%, for example Minecraft saves.

3. The Registry: PuTTY save files are at [HKEY_CURRENT_USER\Software\SimonTatham]. Speaking of PuTTY, don't forget to copy your public keys. (You know where they are.)

4. The Root: See what needs to be copied from the root, for example:

5. Individual App Setting Exports: IDEs, like UltraEdit and Eclipse may have custom ways to export settings. (In UltraEdit, go to Advanced -> Export Settings... and Backup/Restore User Customizations....)

6. Task Scheduler: Copy the scheduling of the encryption and backup tasks you've set for yourself.

7. The Cloud: Done. Makes you grateful for the cloud, eh?

8. Deauthorize the Old Computer: Steam, iTunes, stuff like that.


Development Environment

1. Get Python and a compatible win32all module and editor.
If that win32all link went stale, try sourceforge.
Consider one of these IDEs, depending on the target.

Some modules you may be interested in:

2. Get Cygwin.

Module to consider installing:

  • Archive:
    • unzip
  • Net:
    • curl
    • rsync
    • libssh2-devel
    • libssh2_1
    • openssh
  • Editors: vim
  • Devel:
    • ctags
    • cscope
    • gcc-core
    • gcc-g++
    • gcc4 (req. for compiling matplotlib)
    • git
    • mingw-gcc-core
    • mingw-gcc-g++
    • libgfortran3 (req. by numpy)
    • libjpeg8 (req. for PIL and maybe pillow)
    • liblapack0 (req. by numpy)
    • libquadmath0 (req. by numpy)
    • libncurses-devel
    • libncursesw-devel (not there for 64-bit version?)
    • make
    • mercurial
  • Libs:
    • librsync-devel (for Duplicityi)
    • librsync1 (for Duplicity)
    • libuuid-devel (for cygwin64 pip. binutils also needed.)
    • libX11-devel (for PIL and Pillow)
  • Python:
    • python
    • python3
    • numpy
    • python-setuptools (req. by numpy)
  • Utils:
    • patch

Right-click on the Cygwin window, select Looks→Cursor→Block.

To install boto and Pillow (if PIL is a problem because of X11/Xlib.h)...

$ curl https://bootstrap.pypa.io/get-pip.py > get-pip.py
$ python get-pip.py
$ pip install Pillow
$ pip install boto

Use cygcheck to check dependencies.

If you're going to install cpanm, for installing CPAN modules, make sure you have some of the tools it uses, like "make".

.bashrc (or .bash_profile if you don't need it for ssh, for example)
export PS1="\W\$ "

add_to_path() {
    if [ -d "$1" ] && [[ ! $PATH =~ (^|:)$1(:|$) ]]; then
        PATH+=:$1
    fi
}

# if this is a CygWin .bashrc, then set CygWin's commands first in PATH
# because link.exe and find.exe exist in Windows's path.
# Add /usr/lib/lapack at the end so python's numpy can find lapack_lite
# (Note: BSD bash, used by OS X doesn't have the "substr" test for expr.)
if [[ $(uname -s) == CYGWIN* ]]; then
        PATH=/usr/local/bin:/usr/bin:$PATH
	PATH=${PATH//":/usr/local/bin:/usr/bin"/} # delete any instances in middle
	add_to_path /usr/lib/lapack
	ulimit -n 1024 # for "duplicity"
	alias ls='ls --color=auto'
elif [[ $(uname -s) == Darwin* ]]; then
	export LSCOLORS=gxfxcxdxbxegedabagacad
	export CLICOLOR=1
fi

# If you think this is hard to read,
# change the color of directories in the ls command 
#
# After executing: dircolors -p > .dircolors
# And changing the following line in .dircolors:
# DIR 00;36 # directory
if [ "$TERM" != "dumb" ]; then
	[ -e "$HOME/.dircolors" ] && DIR_COLORS="$HOME/.dircolors"
	[ -e "$DIR_COLORS" ] || DIR_COLORS=""
	eval "`dircolors -b $DIR_COLORS`"
fi

# Add to PATH only if not already in PATH.
add_to_path $HOME/bin

alias findinchppfiles="find . -type f \( -name \*.[ch]pp -or -name \*.[ch] \) -print0 | xargs -0 grep -nI"
alias findinpyfiles="find . -name \*.py -print0 | xargs -0 grep -nI"
  • Maybe get and run startxnosh.bat if you install the xinit module. Then running tools like xcalc from a PuTTY ssh connection with X11 forwarding checked will work. An alternative to that is Xming.

3. Configure or Install vim. (Here's a vim Cheat Sheet)

Ensure that vim supports the Python interpreter. (YouTube video.)

$ vim --version | grep +python

If it doesn't, then ensure you've got the required modules. (Mostly the same as listed above for PuTTY.) Then execute the following:

$ git clone --depth 1 https://github.com/vim/vim.git
$ cd vim/src
$ ./configure --enable-pythoninterp --with-features=huge --prefix=$HOME/opt/vim
$ make && make install
$ mkdir -p $HOME/bin 
$ cd $HOME/bin
$ ln -s $HOME/opt/vim/bin/vim; ln -s $HOME/opt/vim/bin/vim vi
$ which vim
$ vim --version | grep +python

Note: If you choose to install the gvim binary onto a Microsoft Windows machine, the .vimrc file is named, _vimrc, and might reside in C:\Program Files\Vim. The colors, autoload and bundle directories reside within a vimfiles directory there.

Make the .vim_undo directory with one of the two following commands. The last one is for GVim on Windows, since Windows won't let you start a directory name with a dot. Run the command from cygwin.

$ mkdir $HOME/.vim_undo
$ mkdir `cygpath -u $USERPROFILE`/.vim_undo

Set the font by editing your .gvimrc (or _gvimrc) file like so: :e $MYGVIMRC

" set guifont=Consolas:h10
set guifont=Courier\ New:h10
.vimrc (Even more tips.)

Install or download your .vimrc file from the dotfiles git repo.

" Version 2015-08-12.1 - Leader-n = number! Leader-e = nerdtree (:Explore)
" Version 2015-06-24.1 - Added tab to listchars for 'set list'
" Version 2015-02-04.1 - Added link to custom desert theme
" Version 2014-09-03.1 - Commented out ignorecase
set nocompatible    " Use Vim defaults, forget compatibility with vi.
set bs=2            " allow backspacing over everything in insert mode
set wildmenu        " Allows command-line completion with tab
set autoindent      " Copy indent from current line when starting a new line
set smartindent     " Do smart auto indenting when starting  new line
set smarttab        " Honor 'shiftwidth', 'tabstop' or 'softtabstop'
set hlsearch        " highlight all matches for previous search
set nofoldenable    " start unfolded
set foldlevel=0
set nowrap          " no wrapping text lines on the screen (exceptions below)
set sidescroll=5
set listchars+=tab:>-,precedes:<,extends:> " indicators of long lines

if v:version >= 703
  " Do save the undo tree to file, but not in the local directory.
  " Don't forget to mkdir ~/.vim_undo
  set undodir=~/.vim_undo,.
  set undofile        " undo even after closing and reopening a file
endif

" The following two lines set the use of perl regex, aka "very magic"
nnoremap / /\v
vnoremap / /\v

" nnoremap <cr> :noh<cr><cr>     " clear search highlights

" Commented out because I want tags searches to always be case sensitive.
" Override with \c anywhere in your search.
"set ignorecase      " If you enter all lowercase, it's case insensitive,
"set smartcase       " if you use mixed-case terms, it's case sensitive.

syntax on

" If you think this is hard to read,
" change the color of comments in vim, or
" use another color scheme like desert or peaksea
"
set t_Co=256
if v:version >= 703
  set colorcolumn=80
endif
if has('gui_running') " Didn't work: if &term != 'builtin_gui'
  " Light backgrounds for GUI experiences
  set background=light
  " colorscheme peaksea                        " install peaksea
  colorscheme tolerable                        " install tolerable
  if v:version >= 703
    highlight ColorColumn ctermbg=255 guibg=#F6F6F6
  endif
  highlight StatusLine   ctermfg=17 ctermbg=Gray " override scheme (overridden by powerline)
  highlight StatusLineNC ctermfg=20 ctermbg=LightGray" override scheme
  set lines=50 columns=100
else
  " Dark backgrounds for tty experiences
  set background=dark
  colorscheme desert                           " install desert
  if v:version >= 703
    highlight ColorColumn ctermbg=234 guibg=Black " dark gray (or 17, dark blue)
  endif
  highlight StatusLine   ctermfg=20 ctermbg=Gray " override scheme (overridden by powerline)
  highlight StatusLineNC ctermfg=17 ctermbg=DarkGray" override scheme
endif
" highlight Comment     term=bold ctermfg=Blue ctermbg=0 guifg=SlateBlue guibg=Black

" set mouse=v     " visual mode, not working great for PuTTY

set tags=tags;/

set history=50
set ruler
if has('statusline')
  set laststatus=2
  set statusline=%<%f\   " Filename
  set statusline+=%w%h%m%r " Options
  "set statusline+=%{fugitive#statusline()} " Git
  "set statusline+=\ [%{&ff}/%Y]            " filetype
  "set statusline+=\ [%{getcwd()}]          " current dir
  "set statusline+=\ [A=\%03.3b/H=\%02.2B]  " ASCII / Hexadecimal value of char
  set statusline+=%=%-14.(%l,%c%V%)\ %p%%   " Right aligned file nav info
endif

set encoding=utf-8

" I don't set comma for mapleader because it's useful for reverse-finding.
" let mapleader = ","
" let g:mapleader = ","

nmap <leader>w :w!<cr>         " Fast saving
" I use relative number for cursor movement.
nmap <leader>r :set relativenumber!<cr>
nmap <leader>n :set number!<cr>


" Useful mappings for managing tabs
"
nmap <leader>th <esc>:tabprevious<cr>
nmap <leader>tl <esc>:tabnext<cr>
nmap <leader>tn :tabnew
nmap <leader>to :tabonly<cr>
nmap <leader>tc :tabclose<cr>
nmap <leader>tm :tabmove
" Opens a new tab with the current buffer's path
nmap <leader>te :tabedit <c-r>=expand("%:p:h")<cr>/

" pastetoggle
nmap <leader>p :set invpaste paste?<cr>

nmap <leader>e :NERDTreeToggle<cr>    " install nerdtree (e for Explore)
nmap <leader>l :TlistToggle<cr>       " install taglist
nmap <leader>bd :Bdelete<cr>          " install vim-bbye

" Visual mode mappings
"""

" map sort function to a key
vnoremap <leader>s :sort<cr>

"easier moving of code blocks
vnoremap < <gv  " better indentation
vnoremap > >gv  " better indentation

" If too many file system events are getting triggered.
set nobackup       " ~ files
set nowritebackup  " Don't write buff to temp, delete orig, rename temp to orig
set noswapfile     " .swp files

" Allow tags to open another buffer even if this one is modified
set hidden

" Switch between source and header files
function! SwitchSourceHeader()
  let s:ext  = expand("%:e")
  let s:base = expand("%:t:r")
  let s:cmd  = "find " . s:base
  if (s:ext == "cpp" || s:ext == "c")
    if findfile(s:base . ".h"  ) != "" | exe s:cmd . ".h"   | return | en
    if findfile(s:base . ".hpp") != "" | exe s:cmd . ".hpp" | return | en
  else
    if findfile(s:base . ".cpp") != "" | exe s:cmd . ".cpp" | return | en
    if findfile(s:base . ".c"  ) != "" | exe s:cmd . ".c"   | return | en
  endif
endfunc

" Demonstrates a way to look in a mirror directory
" function! OpenOther()
"    if expand("%:e") == "cpp"
"      exe "split" fnameescape(expand("%:p:r:s?src?include?").".h")
"    elseif expand("%:e") == "h"
"      exe "split" fnameescape(expand("%:p:r:s?include?src?").".cpp")
"    endif
" endfunc

" Delete trailing white space on save, useful for Python and CoffeeScript ;)
function! DeleteTrailingWS()
  exe "normal mz"
  %s/\s\+$//ge
  exe "normal `z"
endfunc

if has("autocmd")
  autocmd! BufWritePost .vimrc source %           " re-source this file when saved.
  autocmd BufWrite *.py :call DeleteTrailingWS()  " Delete trailing whitespace
  " Don't let smartindent unindent the # character in Python files
  autocmd FileType python  inoremap # X<c-h>#
  autocmd FileType python  set expandtab          " Use spaces instead of tabs
  autocmd Filetype make    setl noexpandtab       " ...not for files that use tabs.

  " Use the vim command %retab before applying the following
  " two with files that have 8-space tabs.
  autocmd FileType c,cpp,python  set tabstop=4
  autocmd FileType c,cpp,python  set shiftwidth=4

  autocmd FileType python  set foldmethod=indent  " 'za' to fold
  autocmd FileType python  set foldlevel=99

  autocmd Filetype c,cpp nmap <buffer> <leader>s :call SwitchSourceHeader()<cr>
  autocmd FileType c,cpp set foldmethod=syntax

  if v:version >= 703
    " I toggle out of relative number when Vim's focus is lost, because
    " if I'm not editing, then I may be referring to errors with line numbers.
    autocmd FocusLost * if &relativenumber | set number | endif
    autocmd FocusGained * if &number | set relativenumber | endif
  endif

  " Since I have the undo tree saved to disk now (see above), I might prefer to
  " automatically save the file when focus is lost.
  " autocmd FocusLost * silent! wa

  autocmd BufRead *.txt set tw=78                  " Limit width of text to 78 chars
  autocmd BufRead *.txt set wrap linebreak nolist  " "soft" wrap of existing lines
  autocmd BufRead README set wrap linebreak nolist " "soft" wrap of existing lines

  autocmd BufRead *.c,*.cpp,*.python,*.h,*.hpp,*.js set nowrap

  " When editing a file, always jump to the last cursor position
  autocmd BufReadPost *
  \ if line("'\"") > 0 && line ("'\"") <= line("$") |
  \   exe "normal! g'\"" |
  \ endif
endif

" This requires vim to be compiled with +python
" Use auto complete in insert mode with ctrl-x, ctrl-o
" See :help new-omni-completion for more.
filetype plugin on
set omnifunc=syntaxcomplete#Complete
" Auto completion via ctrl-space (instead of ctrl-x ctrl-o)
" set omnifunc=pythoncomplete#Complete
" inoremap <Nul> <C-x><C-o>

" This function attempts to reuse the same scratch
" buffer over and over, so you always see output in 
" the same location in your window layout.
function! ExecuteFileIntoScratchBuffer()
  write
  let f=expand("%:p")
  let cur_win = winnr()
  if buflisted("_vim_output")
    exe bufwinnr("_vim_output") . "wincmd w"
    enew
  else
    vnew
    let cur_win = cur_win+1
  endif
  setlocal buftype=nofile
  setlocal bufhidden=delete
  setlocal noswapfile
  silent file _vim_output
  execute '.! "'.f.'"'
  exe cur_win . "wincmd w"
endfunc
nmap <F5> :call ExecuteFileIntoScratchBuffer()<cr>

" Execute a selection of code
" Use Visual to select a range and then hit ctrl-h to execute it.
if has("python")
python << EOL
import vim
def EvaluateCurrentRange():
    eval(compile('\n'.join(vim.current.range),'','exec'),globals())
EOL
vnoremap <C-h> :py EvaluateCurrentRange()<cr>
endif

" Install Pathogen for this next call to work
call pathogen#infect()

Use a color scheme you like, like desert, peaksea or tolerable.

$ mkdir -p ~/.vim/colors
$ curl -LSso ~/.vim/colors/desert.vim \
  https://raw.githubusercontent.com/dblume/desert.vim/master/desert.vim
$ curl -LSso ~/.vim/colors/peaksea.vim \
  http://www.vim.org/scripts/download_script.php?src_id=15675
$ curl -LSso ~/.vim/colors/tolerable.vim \
  http://vim.sourceforge.net/scripts/download_script.php?src_id=3741

Install some modules. Start with Pathogen to manage the modules.

$ mkdir -p ~/.vim/autoload ~/.vim/bundle
$ curl -LSso ~/.vim/autoload/pathogen.vim \
  https://raw.github.com/tpope/vim-pathogen/HEAD/autoload/pathogen.vim

Now you can install any plugin into a .vim/bundle/plugin-name/ folder.

For example, install powerline.

$ cd ~/.vim/bundle
$ git clone --depth 1 git://github.com/Lokaltog/vim-powerline.git
$ cd ~/.vim/bundle/vim-powerline/doc; vim -c ":helptags ."

If you use a light background, put this colorscheme in bundle/vim-powerline/autoload/Powerline/Colorschemes/default.vim.

taglist is indispensable. Check the link for further instructions regarding interaction with ctags if you don't already have it set up. (To do: See why Mir Nazim recommended tagbar instead. Also investigate Jedi.)

$ cd ~/.vim/bundle
$ curl http://vim.sourceforge.net/scripts/download_script.php?src_id=7701 > taglist_45.zip
$ unzip taglist_45.zip -d taglist
$ rm taglist_45.zip
$ cd ~/.vim/bundle/taglist/doc; vim -c ":helptags ."

nerdtree is another good candidate.

$ cd ~/.vim/bundle
$ curl -OL https://github.com/scrooloose/nerdtree/archive/master.zip
$ unzip master.zip
$ rm master.zip
$ mv nerdtree-master/ nerdtree
$ cd ~/.vim/bundle/nerdtree/doc; vim -c ":helptags ."

Install :Bdelete from vim-bbye. vim-bbye installs an improved :Bclose script for deleting buffers without losing your window layout.

$ cd ~/.vim/bundle
$ curl -OL https://github.com/moll/vim-bbye/archive/master.zip
$ unzip master.zip
$ rm master.zip
$ mv vim-bbye-master/ bbye

If you want the ability to open files with a line number as given by grep -n, use file-line. And if you want to use * and # in visual mode, use visual-star-search.

$ mkdir ~/.vim/plugin
$ curl -LSso ~/.vim/plugin/file-line.vim \
  http://www.vim.org/scripts/download_script.php?src_id=17417
$ curl -LSso ~/.vim/plugin/visual-star-search.vim \
  https://raw.githubusercontent.com/nelstrom/vim-visual-star-search/master/plugin/visual-star-search.vim

command-t was recommended by Steve Losh. But it requires vim to have been compiled with Ruby support.

$ vim --version | grep +ruby

Most filetypes should have correct syntax coloring, but just in case, you could add it yourself. For example, for yaml, you'd get yaml.vim. You'll need to create a new filetype in your .vimrc file, and add an entry to read your syntax file, too.

  autocmd BufRead,BufNewFile *.yaml set filetype=yaml
  autocmd! Syntax yaml source $VIM/yaml.vim

And install the syntax file...

$ curl -LSso ~/.vim/yaml.vim \
  http://www.vim.org/scripts/download_script.php?src_id=2249

4. Configure Sublime Text.

  1. Register it with your key. (See your email or wiki page.)
  2. Install Package Control.
  3. Install CTags support.
  4. Install Open-Include.
  5. Consider GutterColor for CSS files.
Preferences.sublime-settings
{
    "color_scheme": "Packages/Color Scheme - Default/Slush & Poppies.tmTheme",
    "draw_white_space": "none",
    "draw_indent_guides": false,
    "line_numbers": false,
    "default_line_ending": "unix",
    "word_wrap": false,
    "translate_tabs_to_spaces": true
}
Default.sublime-keymap - User
[
    { "keys": ["ctrl+l"],
      "command": "toggle_setting",
      "args": { "setting": "line_numbers" }
    }
]

CTags.sublime-settings
{
    "tag_file" : "tags",
}
sample.sublime-project
{
    "folders":
    [
        {
            "path": "src",
            "folder_exclude_patterns": ["obj"],
            "file_exclude_patterns": ["tags"]
        }
    ],
    "build_systems":
    [
        {
            "name": "Custom Make",
            "shell_cmd": "make all -j8",
	    "working_dir": "$project_path",
	    "file_regex": "^(...*?):([0-9]*):?([0-9]*)",
	    "windows": { 
		"shell_cmd": "C:/cygwin64/bin/bash --login $project_base_name/build"
	    }
        }
    ]
}

5. Get WinMerge.

6. Get Eclipse.

7. Get SVN for home.

8. Get Fiddler2 for a web debugging proxy outside Firefox.

9. To Access SharePoint from FireFox.
Go to your Firefox address bar and type about:config.  Find the key called network.automatic-ntlm-auth.trusted-uris. Set that key's value to a comma separated list of servers for which you want NTLM authentication.


Discretionary

1. Get Mozilla Firefox.
Your favorite themes were Winestripe or StrataStripe, but things are different in Firefox 4.  Get the Add-ons you love:

Consider some of these good ideas. Consider setting the following about:config parameters:
browser.tabs.tabMinWidth 75
browser.tabs.closeButtons 3
browser.urlbar.hideGoButton true

2. Inkscape for vector graphics. (I need to test this out.)

3. PDF creation: PDF Creator and reading: Foxit.

4. Fraps for recording desktop video.

5. Use Soluto to check boot speed and crash problems.

6. Sync Outlook to Google Calendar with gSyncit. ( Calendar Sync by pppindia is an alternative.)

7. Microsoft Security Essentials, as mentioned in a 2011-11-24 email exchange with Alan Henry.

8. Enable Remote Desktop.

9. Prey. (If your new computer is a laptop, that is.) Remember to leave a Guest Account available for the thief to use, so that Prey has a chance to checkin.



© 2006-2014, David Blume