Skip to content

talha131/dotfiles

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Guide on Setting Up Development Environment

This guide is written to help me setup new Windows and Mac machines.

1. Windows

1.1. Prerequisites

1.1.1. Windows Installer Flash Drive

  1. Use Rufus to create bootable USB.

  2. Use en_windows_10_multiple_editions_version_1511_x64_dvd_7223712.iso

1.1.2. Windows 10 Anniversary Update

Make sure you have Windows 10 Anniversary Update available for offline installation.

1.1.3. Drivers

For installing Windows on MacBook Pro, you need to download Bootcamp.

  1. Clone Brigadier

    git clone --depth 1  https://github.com/timsutton/brigadier.git
  2. Use EveryMac online tool to find your MacBook model identifier using serial number

  3. Download Bootcamp

    mkdir MacBookPro10-1
    ./brigadier -m MacBookPro10,1 -o MacBookPro10-1

1.1.4. Password database

Make sure you have a copy of your password database stored outside Dropbox so that it can be accessed on a fresh system which does not have Dropbox setup.

1.2. Install Windows 10

Install a fresh copy of Windows 10. Make sure you do not enable network connection during or after installation until drivers have been installed.

  1. Select custom settings and disable all settings related to Cortana etc

  2. Attach flash drive with Windows 10 Anniversary Update iso and install update from it

  3. Again disable all Cortana related options in settings

  4. Attach flash drive with Bootcamp on it, click on Setup.exe to start driver installation

  5. Restart machine

1.2.1. Configure Bootcamp

  1. Under Keyboard, enable Use all F1, F2…​ option

  2. Under Trackpad, enable Tap To Click and Secondary Tap__

1.2.2. Change Computer Name

  1. Open Advanced System Settings using

    rundll32.exe shell32.dll,Control_RunDLL sysdm.cpl,,1
  2. Click on Change button

  3. Rename

Now restart machine and connect to internet.

1.3. Post Installation Configuration

1.3.1. Set Time

  1. Open time and date settings using

    control timedate.cpl
  2. Set time zone

  3. Use 24 hour time format

1.3.2. Disable Cortana

  1. Run

    gpedit.msc
  2. Go to Computer ConfigurationAdministrative TemplatesSearch

  3. Disable all Cortana related settings

1.3.3. Disable OneDrive

  1. Run

    gpedit.msc
  2. Go to Computer ConfigurationAdministrative TemplatesOneDrive

  3. Disable all OneDrive related settings

1.3.4. Turn off bluetooth

  1. Run

    ms-settings:bluetooth
  2. Turn off bluetooth

1.3.5. Configure Edge

  1. Install ublock origin for Edge from Store.

  2. In Edge settings,

    1. Open Microsoft Edge with Previous pages

    2. Open new tabs with A blank page

    3. Disable offer to save password

    4. Enable Send Do Not Track requests

    5. Change search engine to Google

1.3.6. Map Keys

Note
My Windows machine is a MacBook. Left Win is actually Left Cmd key which is right next to the space bar.
  1. Download and install SharpKeys

Use SharpKeys to,

  1. Map Caps Lock to Left Ctrl key

  2. Map Left Ctrl to Left Win key

  3. Map Left Win to Right Ctrl key

1.3.7. Track Pad

To invert the direction of scrolling (natural scrolling on macOS), run following command in PowerShell with administrative privileges.

Get-ItemProperty HKLM:\SYSTEM\CurrentControlSet\Enum\HID\__\__\Device` Parameters FlipFlopWheel -EA 0 | ForEach-Object { Set-ItemProperty $_.PSPath FlipFlopWheel 1 }
Get-ItemProperty HKLM:\SYSTEM\CurrentControlSet\Enum\HID\__\__\Device` Parameters FlipFlopHScroll  -EA 0 | ForEach-Object { Set-ItemProperty $_.PSPath FlipFlopHScroll 1 }

See SuperUser answer for details.

Natural direction of scrolling is how you scroll on iPhone, Android and other touch devices. Content scrolls in the direction of your fingers.

Natural Scrolling

Sometimes I have a hard time to wrap my head around natural versus traditional scrolling. Following is a simple test to figure out if we have been successful in inverting the scroll direction. Basically, content scrolls oppositely to the direction in which you move your fingers on the trackpad. For example, moving fingers up will make content scroll downward.

To test natural vertical scrolling is working,

  1. Scroll to the bottom

  2. Move your fingers upward on the trackpad

  3. If scroll bar does not budge, then vertical scrolling is natural

To test natural horizontal scrolling is working,

  1. Scroll to extreme right

  2. Move your fingers towards left on the trackpad

  3. If scroll bar does not budge then horizontal scrolling is natural

1.3.8. Mouse Properties

Open mouse properties using control main.cpl.

  1. In Buttons tab, turn on ClickLock

    1. In Settings, set duration to the shortest possible

  2. In Pointer Options tab, enable Show Location of Pointer

  3. In Wheel tab, change scroll speed to 1

1.4. Install Password Manager

Install following applications

1.4.1. Post Installation tasks

  1. Enter 1Password license key

  2. Login to Dropbox and start syncing

  3. Enter Windows key and activate your copy

1.4.2. Check Windows activation status

  1. Type following command in Powershell

    slmgr /xpr

A window will pop up that will show Windows activation status.

1.5. Install Applications using Scoop

1.5.1. Install Scoop

Install Scoop.

  1. Open Powershell

  2. Run

    Set-ExecutionPolicy RemoteSigned -scope CurrentUser
    iex (new-object net.webclient).downloadstring('https://get.scoop.sh')

Add scoop "extras" bucket.

scoop bucket add extras

Add scoop "versions" bucket.

scoop bucket add versions

This bucket is help for running multiple versions of Python and Ruby on the same machine. For details see Switching Ruby and Python Versions.

1.5.2. Install applications

Use scoop install to install following applications,

  1. 7zip

  2. bitwarden

  3. calibre

  4. clink

  5. conemu

  6. curl

  7. dont-sleep

  8. fd

  9. ffmpeg

  10. fzf

  11. git

  12. gitextensions

  13. github

  14. gpg4win

  15. llvm

  16. neovim

  17. nodejs

  18. openssh

  19. ripgrep

  20. ruby

  21. sharex

  22. shasum

  23. slack

  24. SumatraPDF

  25. synctrayzor

  26. vim

  27. vlc

  28. vscode

  29. wget

  30. yarn

  31. youtube

1.5.3. Configure Applications Post Install

Add ConEmu to context menu
  1. Open SettingsIntegration

    1. Click on Register to add ConEmu to context menu

  2. Select Keys & Macro

    1. Search for number

    2. Change all Win+[0-9] hotkey to RCtrl

  3. Select Keyboard

    1. Check Win+Numbers - activate console

  1. Open cmd

  2. Run

    clink autorun install

1.5.5. Configure SSH keys for Git

Generate SSH Keys

After installing git and openssh, run ssh-keygen command in Powershell.

PS> mkdir .ssh
PS> ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (/c/Users/you//.ssh/id_rsa): [press enter]
Enter passphrase (empty for no passphrase): [type your password]
Enter same passphrase again: [and once more]
...

Add new SSH key to Github account settings. For details see this help article.

Use Pshazz to remember SSH password

Pshazz includes a plugin for SSH that can save your SSH key password in Windows Credential Manager so you don’t need to re-type it every time you push to your Github repo. Install it like this:

scoop install pshazz

You should see a popup asking for your SSH key password. Enter it and check the box to save your password. Back in your Powershell session, you should see an Identity Added message.

Whenever you start a Powershell session from now on, Pshazz will make sure the ssh-agent is running and load your private key using your saved password

Test SSH connection

To make sure everything’s working, restart Powershell and then run this command

After a warning or two, you should see a message like this:

Hi <username>! You've successfully authenticated, but GitHub does not provide shell access.

Visit Github help for details.

1.5.6. Download Synced Settings

Login to sync account of

  1. Firefox Sync account

  2. Rambox sync account

  3. Install Visual Studio Code Settings Sync Extension by Shan Khan

    1. Download synced settings

  4. Install Atom sync settings package

    1. Download synced settings

1.5.7. Add Firefox Addons

  1. Install 1Password extension

  2. Login to RescueTime plugin

  3. Configure Pray Times plugin

1.5.8. Install Asciidoctor

After ruby is installed, install Asciidoctor

gem install asciidoctor

Update Asciidoctor using

gem update asciidoctor

1.5.9. Install Docsets

Open Zeal and install following docsets,

  1. Download Qt5 documentation in ZealDocs

1.5.10. Configure ShareX

  1. Open ShareX

  2. Click on Destinations

  3. Select Imgur for Image Uploader

  4. Click on Destination settings…​

    1. Authorize Imgur

    2. Refresh album list

    3. Select your album

    4. Check Upload images to selected album

    5. Press OK

  5. Click on After capture tasks

  6. Select only

    1. Upload image to host

    2. Delete file locally

  7. Click After upload tasks

  8. Select only

    1. Copy URL to clipboard

  9. Click on Hotkey settings…​

    1. Capture region to Ctrl+Shift_4

    2. Capture entire screen to Ctrl+Shift+3

    3. Capture active window to Ctrl+Shift+Space

1.5.11. Configure Don’t Sleep

  1. Click Options, check

    1. Start Minimized

    2. Start with Windows

  2. Click Don’t Sleep, check

    1. Minimize to tray if Minimize

    2. Minimize to tray if Close

1.5.12. Add VS Code to Context Menu

See instructions in Add gVim to Context Menu.

1.6. Install Fonts

1.7. Dotfiles

Create a Repos directory in %HOMEPATH%. Clone dotfiles repository.

git clone https://github.com/talha131/dotfiles.git

1.7.1. Git

Start a cmd tab with administrative privilege in ConEmu. Create symbolic links thusly,

mklink %HOMEPATH%\.gitconfig %HOMEPATH%\Repos\dotfiles\git\gitconfig
mklink %HOMEPATH%\.githelper %HOMEPATH%\Repos\dotfiles\git\githelper
mklink %HOMEPATH%\bin\diff-highlight %HOMEPATH%\Repos\dotfiles\bin\diff-highlight

1.7.2. ConEmu

Start a cmd tab with administrative privilege in ConEmu. Create symbolic links thusly,

mklink %APPDATA%\ConEmu.xml %HOMEPATH%\Repos\dotfiles\conemu\ConEmu.xml

1.7.3. Vim

Python for Vim

To compile LeaderF plugin, I had

  1. Install Windows 10 SDK

  2. Install Visual C++ Compiler for Python 2.7

You should make sure that the installed Python has the same build and version that Vim has in the output of :version command.

Install Python 3.5.3.

Check Interpreters

Open Vim and check you have Python2, Python3, Ruby, and Lua working, using following commands,

:echo has('python3')
:echo has('python')
:echo has('ruby')
:echo has('lua')

Start cmd with administrative privilege in ConEmu. Create symbolic links thusly,

mklink %HOMEPATH%\.vimrc %HOMEPATH%\Repos\dotfiles\vim\vimrc
mklink /d %HOMEPATH%\.vim\ %HOMEPATH%\Repos\dotfiles\vim\vim\
mklink %LOCALAPPDATA%\nvim\init.vim %HOMEPATH%\Repos\dotfiles\vim\vimrc
mklink /d %LOCALAPPDATA%\nvim\colors %HOMEPATH%\Repos\dotfiles\vim\vim\colors
Install Vim-Plug

I use Vim-Plug to manage my Vim plugins. To install Vim-Plug, open Powershell and type these commands,

md ~\.vim\autoload
$uri = 'https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim'
(New-Object Net.WebClient).DownloadFile($uri, $ExecutionContext.SessionState.Path.GetUnresolvedProviderPathFromPSPath("~\.vim\autoload\plug.vim"))
Install Plugins

Open Vim, ignore errors and issue :PlugInstall! to install all plugins and themes.

Restart Vim. This time there should be no errors.

Add gVim to Context Menu

Portable version of Vim from Tuxproject which does not come with an installer. It is not automatically added to the Windows context.

To add gVim to context menu, open registry using regedit.

  1. Navigate to HKEY_CLASSES_ROOT\*\shell.

  2. Add new key gVim under it.

  3. Change value of Default to Open with gVim

  4. Add a new string value, named Icon. Set it’s value to gVim executable, in this case "C:\Users\talha\scoop\apps\vim\current\gvim.exe"

  5. Add a new sub key under gVim. Name it command

  6. Set command default value to gVim executable, in this case "C:\Users\talha\scoop\apps\vim\current\gvim.exe" "%1"

See this link for details.

1.7.4. AutoHotKey

To auto start the AutoHotKey script every time windows starts. Start cmd with administrative privilege in ConEmu. Create symbolic links thusly,

mklink "%APPDATA%\Microsoft\Windows\Start Menu\Programs\Startup\init.ahk" %HOMEPATH%\Repos\dotfiles\autohotkey\init.ahk

1.8. Install Applications

1.8.1. Configure Applications Post Install

  1. Setup sync with other computers using SyncTrayzor

Configure Qt Creator
  1. Open Options

  2. Click on Environment

    1. Click on Keyboard tab

      1. Set shortcut for Options to Ctrl+,

  3. Click on Build & Run

    1. Click on General tab

      1. Set project directory to ~\Repos

      2. Check Save all files before build

    2. Click on Qt Versions

      1. Add Qt version by clicking Add and navigating to qmake.exe. For example, C:\Qt\Qt5.6.2\5.6\msvc2013\bin\qmake.exe

    3. Click on Compilers tab

      1. Make sure MSVC compilers have been auto detected. Otherwise add them manually.

    4. Click on Debuggers tab

      1. If CDB has has not bee auto detected, then add it manually. For example, C:\Program Files (x86)\Windows Kits\10\Debuggers\x86\cdb.exe

    5. Click on Kits tab

      1. Configure Kit for your project

  4. Click on FakeVim

    1. General Tab

      1. Enable Fake Vim

      2. Enable Automatic indentation

      3. Smart indentation

      4. Expand tabulators

      5. Incremental search

      6. Use search dialog

      7. Use ignore case

      8. Show line numbers relative to cursor

      9. Check Pass control key

Gruvbox theme for Qt Creator

Download Gruvbox theme for Qt Creator

  1. Restart Qt Creator

  2. Select Gruvbox theme

  3. Set font to Inconsolata

  4. Set font size

C++ Beautifier
  1. Click on Help

  2. Click on About Plugins

  3. Enable C++ Beautifier

  4. Restart Qt Creator

  5. Open Options

  6. Click on Beautifier

  7. Click on General tab

    1. Enable Auto Format on Save

    2. Set tool to Clang Format

  8. Click on Clang Format tab

    1. Clink on Use predefined style

    2. Select File

    3. Select Format entire file if no text is selected

1.9. Urdu Support

1.9.1. Add Urdu Language

  1. Use the Windows key + I keyboard shortcut to open the Settings app

  2. Click Time & language

  3. Click Region & language

  4. Under Languages, click Add a language

  5. Add Urdu Pakistan

  6. Install language pack

1.9.2. Install Phonetic Keyboard

  1. Download Phonetic Keyboard

  2. Install keyboard

  3. Remove default Urdu keyboard

    1. Use the Windows key + I keyboard shortcut to open the Settings app

    2. Click Time & language

    3. Click Region & language

    4. Under Languages, click Urdu → Options

    5. Click on non-phonetic Urdu keyboard

    6. Click Remove

1.10. Deprecated Notes

Notes under this section are currently not in use. I keep them around for probable future use.

1.10.1. Disable Automatic Updates

Warning
This section is not relevant after Windows 10 anniversary update. I did not face issue with Windows update after anniversary update.

Windows 10 automatic updates messed up device drivers, rendering my machine unstable. I had to reinstall Windows 10 at least 10 times before learning my lesson to not to trust Windows 10 automatic updates.

Disable Windows Update Service
  1. Open services.msc

  2. Stop and disable Windows Update Service

Disable Windows Driver Update
  1. Open driver update setting, using

    rundll32.exe shell32.dll,Control_RunDLL sysdm.cpl,,2
  2. Click on Device Installation Settings and disable drivers updates

Help article on How to temporarily prevent a driver update from reinstalling in Windows 10 may be useful, though it didn’t do much for me.

Edit Group Policy
  1. Open gpedit.msc

  2. Computer ConfigurationAdministrative TemplatesWindows ComponentsWindows UpdateConfigure Automatic Updates

  3. Enable Configure Automatic Updates

  4. Choose Notify to download and notify to install

Update Windows Manually

Install Windows Update MiniTool and use it to update Windows manually.

1.10.2. Install Applications

Warning
Following applications have been replaced by their alternatives or scoop manages them.
  1. ConEmu Windows Terminal

  2. Clink

  3. Install Rambox

    1. Enable and Setup

      1. Slack

      2. Inbox (Personal)

      3. Inbox (Work)

      4. Gmail (University)

      5. WhatsApp

      6. Telegram

      7. IRC Cloud

    2. Setup auto reload for Slack

    3. Setup Google Calendar

    4. Setup Google Spreadsheets

  4. Install Chocolatey Packages

    1. Install Chocolatey

  5. Sumatra PDF

  6. Install Python2 and Python3

  7. Install Ruby

  8. Git for Windows

  9. CDB debugger for Qt

    1. Offline installer is not available

      1. Either install it directly or choose to download only

      2. Installer will present a menu of features. Select Debugging Tools for Windows (~100MB)

      3. Install it manually from download folder, if you had opted for download option

  10. Win32 OpenSSL 1.0.1 Light into Windows System folders

  11. AutoHotKey

1.10.3. Download Portable Applications

  1. Vim

  2. Lua

    1. Navigate and download from Windows Libraries/Dynamic folder

  3. Don’t Sleep Utility

1.10.4. diff.exe for Vim

Important
Tuxproject Vim does not include a diff.exe. diff or Gdiff (in Vim Fugitive) may not work. On the other hand, Vim Win32 Installer is shipped with diff.

Check output of

:!where diff

If the result is empty or Gdiff is not working then add diff.exe from Git installation to your %PATH%.

Open your Environment Variables, edit %PATH% to add C:\Program Files\Git\usr\bin.

See this Github issue for details.

1.10.5. Install AutoJump

Note
pshazz comes with z that is AutoJump for Powershell.

You must have Clink installed before you install AutoJump

  1. Clone AutoJump

  2. Add patch

  3. Open cmd

  4. Make sure Clink is working in cmd

  5. Switch to AutoJump directory

  6. Install AutoJump using python install.py

  7. Successful installation will output a path, add this path your %PATH%.

You can view Clink settings and configuration directory using clink set command.

1.10.7. Color Codes

To have Gruvbox dark theme like background in cmd or Git shell, use following color codes:

Table 1. Color Codes
Color Values Red Green Blue

Screen Background,

44

44

44

Screen Text

218

198

144

1.10.8. Download Portable Applications

Create a folder bin in %HOMEPATH%,

mkdir %HOMEPATH%\bin

This folder is referred to as bin henceforth.

Download following apps and extract them in bin folder,

Add their path to %PATH% variable.

To edit %PATH% variable, open Environment Variables using

rundll32.exe shell32.dll,Control_RunDLL sysdm.cpl,,3

You can check path of each command using where command. For example,

> where gvim C:\Users\talha\bin\complete-x64\gvim.exe

You can use it to test each downloaded program is available from %PATH%.

2. Mac

2.1. Install macOS

macOS Recovery installs different versions of macOS depending on the key combination you press while starting up.

Hold down one of these combinations immediately after pressing the power button to turn on your Mac. Release when you see the Apple logo or a spinning globe.

Shortcut Description

command-R

Reinstall the latest macOS that was installed on your Mac, without upgrading to a later version.1

Option-Command-R

Upgrade to the latest macOS that is compatible with your Mac.2

Shift-Option-Command-R

Requires macOS Sierra 10.12.4 or later Reinstall the macOS that came with your Mac, or the version closest to it that is still available.

After finishing installation you may have to download and install macOS Sierra from App Store.

2.2. Post Installation Configuration

  1. Right click on battery icon and select Show Percentage

  2. Download Xcode from the App Store

2.2.1. Configure Trackpad

  1. Open System ConfigurationTrackpad

  2. Point & Click

    1. Enable Tap to Click

    2. Set Click to Light

    3. Set Tracking speed to Fast

  3. Now open Accessibility

    1. Mouse & TrackpadTrackpad Options…​

    2. Enable dragging with three finger drag

2.2.2. Configure Applications Post Install

  1. Login to Dropbox

  2. Activate 1Password using license key

  3. Enable Firefox sync

  4. Make Firefox default browser

  5. Sync Visual Studio Code settings

  6. Install 1Password browser extension

  7. Login to RescueTime

Configure iterm2
  1. Open Preferences

  2. General → Preferences → Load preferences from a custom folder

  3. Browser to Dropbox folder

  4. If asked Do not copy local settings to the folder

  5. Restart iTerm2

  6. Check if settings have been loaded perfectly

Make fish default shell
  1. sudo vi /etc/shells

  2. Add /usr/local/bin/fish

  3. Quit and run

    chsh -s /usr/local/bin/fish
Install Python version
pyenv versions
pyenv install 2.7.14
pyenv install 3.7.2
pyenv global 3.7.2 2.7.14
pip Packages
pip2 install --upgrade pip
pip3 install --upgrade pip
pip2 install --upgrade neovim
pip3 install --upgrade neovim virtualfish pip-autoremove pre-commit
gem packages
gem install asciidoctor
gem install neovim
Yarn packages

Use yarn global add to install following packages,

  1. ffmpeg-concat

  2. gifify

  3. neovim

  4. npm-check

  5. tiddlywiki

2.3. Dot Files

Create a Repos directory in ~. Clone dotfiles repository.

git clone https://github.com/talha131/dotfiles.git

Then issue following commands

rm -r ~/.hammerspoon/
ln -s ~/Repos/dotfiles/hammerspoon/ ~/.hammerspoon/
ln -s ~/Repos/dotfiles/git/gitconfig ~/.gitconfig
ln -s ~/Repos/dotfiles/git/githelper ~/.githelper
ln -s ~/Repos/dotfiles/bin/diff-highlight ~/bin/diff-highlight
ln -s ~/Repos/dotfiles/vim/vimrc ~/.vimrc
ln -s ~/Repos/dotfiles/vim/vim ~/.vim
ln -s ~/Repos/dotfiles/spacemacs/spacemacs ~/.spacemacs
mkdir ~/.config/nvim
ln -s ~/Repos/dotfiles/vim/vimrc ~/.config/nvim/init.vim
ln -s ~/Repos/dotfiles/vim/coc-settings.json ~/.config/nvim/coc-settings.json

2.3.1. Install Vim Plug

curl -fLo ~/.vim/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
curl -fLo ~/.local/share/nvim/site/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim

2.4. Emacs key bindings for OS X

Create file

mkdir ~/Library/KeyBindings/
touch DefaultKeyBinding.dict

Add to file DefaultKeyBinding.dict

{
    "~d" = "deleteWordForward:";
    "^w" = "deleteWordBackward:";
    "~f" = "moveWordForward:";
    "~b" = "moveWordBackward:";
}

Restart applications to use these shortcuts.

About

My configurations for different tools

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published