set listchars=trail:·,tab:>→,nbsp:% ",eol:¶
set list
highlight ExtraWhitespace ctermbg=green ctermfg=blue guibg=green guifg=blue
match ExtraWhitespace /\s\+$/
fun! TrimRight()
%s/\v\S\zs\s+$//
endfunction| Task | Emacs | Vim |
|---|---|---|
| Quit Editor with an error code | (kill-emacs <exitcode>) | :cq |
| Toggle whitespace visualization | M-x whitespace-mode | :set list! |
#!/bin/sh
git for-each-ref --sort=-committerdate --format '%(objectname:short) %(objecttype) %(refname) | %(committerdate:relative) %(if)%(authorname)%(then)(by %(authorname) %(authoremail))%(end)' "$@" | column -t -s\|Documentation: https://git-scm.com/docs/git-for-each-ref
Fields for the --format option
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function playNotificationSound() { | |
| # From http://scriptolog.blogspot.com/2007/09/playing-sounds-in-powershell.html | |
| $sound = New-Object System.Media.SoundPlayer; | |
| $sound.SoundLocation="c:\WINDOWS\Media\notify.wav"; | |
| $sound.Play(); | |
| } | |
| function p() { | |
| Param( | |
| $ComputerName="google.com" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # from http://stackoverflow.com/questions/3513650/timing-a-commands-execution-in-powershell | |
| function lastCommandTime() { | |
| $command = Get-History -Count 1 | |
| return $command.EndExecutionTime - $command.StartExecutionTime | |
| } | |
| set-alias lct lastCommandTime |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # from https://superuser.com/questions/880213/automatically-export-history-at-end-of-powershell-session | |
| $HistoryFilePath = Join-Path ([Environment]::GetFolderPath('UserProfile')) .ps_history | |
| Register-EngineEvent PowerShell.Exiting -Action { Get-History | Export-Clixml $HistoryFilePath } | out-null | |
| if (Test-path $HistoryFilePath) { Import-Clixml $HistoryFilePath | Add-History } |
IntelliJ Idea Live Templates
-
main
public static void main(String[] args){ $END$ }
-
printf
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # 3-way merge style | |
| git config merge.conflictstyle diff3 | |
| # 2-way merge style (by default) | |
| git config merge.conflictstyle merge |
NewerOlder