-
Notifications
You must be signed in to change notification settings - Fork 319
Closed
Description
I have Set-PSReadLineOption -HistoryNoDuplicates
in my profile file, and Get-PSReadlineOption
shows HistoryNoDuplicates : True
. But duplicated entries are being added to the ConsoleHost_history.txt
file. I'm using version 1.0.0.13
. The following is all the options I have for PSReadLine:
Import-Module PSReadLine
Set-PSReadLineOption -HistoryNoDuplicates
Set-PSReadLineOption -HistorySearchCursorMovesToEnd
Set-PSReadLineOption -HistorySaveStyle SaveIncrementally
Set-PSReadLineOption -MaximumHistoryCount 4000
# history substring search
Set-PSReadlineKeyHandler -Key UpArrow -Function HistorySearchBackward
Set-PSReadlineKeyHandler -Key DownArrow -Function HistorySearchForward
# Tab completion
Set-PSReadlineKeyHandler -Chord 'Shift+Tab' -Function Complete
Set-PSReadlineKeyHandler -Key Tab -Function MenuComplete
# automatic quotation
Set-PSReadlineKeyHandler -Chord 'Oem7','Shift+Oem7' `
-BriefDescription SmartInsertQuote `
-LongDescription "Insert paired quotes if not already on a quote" `
-ScriptBlock {
param($key, $arg)
$line = $null
$cursor = $null
[PSConsoleUtilities.PSConsoleReadline]::GetBufferState([ref]$line, [ref]$cursor)
if ($line[$cursor] -eq $key.KeyChar) {
# Just move the cursor
[PSConsoleUtilities.PSConsoleReadline]::SetCursorPosition($cursor + 1)
}
else {
# Insert matching quotes, move cursor to be in between the quotes
[PSConsoleUtilities.PSConsoleReadline]::Insert("$($key.KeyChar)" * 2)
[PSConsoleUtilities.PSConsoleReadline]::GetBufferState([ref]$line, [ref]$cursor)
[PSConsoleUtilities.PSConsoleReadline]::SetCursorPosition($cursor - 1)
}
}
Metadata
Metadata
Assignees
Labels
No labels