diff options
-rw-r--r-- | CHANGELOG.md | 2 | ||||
-rw-r--r-- | commands/history.go | 4 |
2 files changed, 5 insertions, 1 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index 7997db03..6ac429dd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). ### Changed - `:open-link` now supports link types other than HTTP(S) +- Running the same command multiple times only adds one entry to the command + history. ### Fixed diff --git a/commands/history.go b/commands/history.go index 77bb1553..1c0a1ec8 100644 --- a/commands/history.go +++ b/commands/history.go @@ -23,7 +23,9 @@ func (h *cmdHistory) Add(cmd string) { h.cmdList = h.cmdList[1:] } - h.cmdList = append(h.cmdList, cmd) + if len(h.cmdList) == 0 || h.cmdList[len(h.cmdList)-1] != cmd { + h.cmdList = append(h.cmdList, cmd) + } // whenever we add a new command, reset the current // pointer to the "beginning" of the list |