Cygwin: A `sudo` like command

You can run commands from Cygwin with elevated permissions. On Windows, you have something like Run as different user or Run as administrator. And on Linux, you probably use the sudo command for this. To get similar functionality on Cygwin, you can add a new alias to your shell’s config file. The following is for Zsh, but it should also work for other bash-like shells. ~/.zshrc alias sudo='cygstart --action=runas' Now you can run something like this to test the alias....

February 24, 2021

Cygwin: Change the default home directory

You can define the default home directory for all Cygwin users in the nsswitch.conf file. For example, the following sets your default home directory to /cygdrive/c/Users/{user_name}/home, or in Windows notation to C:\Users\{user_name}\home. /etc/nsswitch.conf db_home: /%H/home You can change it to whatever you like. See the Cygwin documentation for more information. Look here below the /path section for more on supported wildcard characters.

February 24, 2021

Cygwin: Using the clipboard with Vim

To use the Windows clipboard in Vim on Cygwin, add the following to your Vim config file. .vimrc set clipboard=unnamed Vim will now use the clipboard register * for yank, delete, change and put operations. The * register gets synced with the Windows clipboard automatically.

February 24, 2021