Vi seems to use a separate history for commands (starting with ':') and searches (starting with '/' or '?'). Let's do the same. You can view, comment on, or merge this pull request online at:
https://github.com/geany/geany-plugins/pull/848
-- Commit Summary --
* vimode: Use pointer array for ex command history * vimode: Separate command and search history
-- File Changes --
M vimode/src/excmd-prompt.c (66)
-- Patch Links --
https://github.com/geany/geany-plugins/pull/848.patch https://github.com/geany/geany-plugins/pull/848.diff
codebrainz commented on this pull request.
- if (link) - { - g_free(link->data); - history = g_list_remove_link(history, link); - } - if (g_strcmp0(text, ":") != 0) - history = g_list_prepend(history, g_strdup(text)); + if (g_ptr_array_find_with_equal_func(history, text + 1, g_str_equal, &index))
Requires [GLib 2.54](https://developer.gnome.org/glib/stable/glib-Pointer-Arrays.html#g-ptr-array...) or greater I guess.
techee commented on this pull request.
- if (link) - { - g_free(link->data); - history = g_list_remove_link(history, link); - } - if (g_strcmp0(text, ":") != 0) - history = g_list_prepend(history, g_strdup(text)); + if (g_ptr_array_find_with_equal_func(history, text + 1, g_str_equal, &index))
Ah, OK, I didn't notice the checks failed. I'll add some additional commits to this pull request so the command line behaves more like vim.
@techee pushed 6 commits.
5ebf1c18e2d31ea7a4ca5ed9ba9f55f0b7d2d3ca vimode: restrict history to 20 entries like vim 81d8c20853fbbf0d210e17d4e2a8e655ea27dd50 vimode: check modifiers in command mode f460eb2bf989d176728ad3fb338f33d8d30216c9 vimode: let ctrl-c leave the command mode 028eb7483d90008bcf0c5bb7bf45d7c2d5ce1101 vimode: implement going to beginning/end of command line 1f4db8077d04317073778278a99c02ffa72a0f8d vimode: filter ex cmd history using text entered by user 0d553fdef020213ba331b919b42cbd5087145fc9 vimode: don't use g_ptr_array_find_with_equal_func()
Merged #848 into master.
github-comments@lists.geany.org