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
From [https://git-scm.com/docs/git-diff] ([https://git-scm.com/docs/git-diff):
--word-diff= plain:
Show words as [-removed-] and {+added+}. Makes no attempts to escape the delimiters if they appear in the input, so the output may be ambiguous.
Examples:
- git diff --word-diff=plain
NewerOlder