public <T> void optionChanged(Option<T> option, T oldValue, T newValue) { if (option.equals(Options.SMART_CASE) || option.equals(Options.IGNORE_CASE) || option.equals(Options.SEARCH_HIGHLIGHT) || option.equals(Options.SEARCH_REGEX)) { Search lastSearch = vim.getRegisterManager().getSearch(); // Update the search settings for the last/active search. if (lastSearch != null) { lastSearch = SearchCommandParser.createSearch( vim, lastSearch.getKeyword(), lastSearch.isBackward(), lastSearch.isWholeWord(), lastSearch.getSearchOffset()); if (Options.SEARCH_HIGHLIGHT.equals(option) && Boolean.FALSE.equals(newValue)) { vim.getSearchAndReplaceService().removeHighlighting(); // Update highlights when enabled, as search might now match more things } else if (vim.getConfiguration().get(Options.SEARCH_HIGHLIGHT)) { vim.getSearchAndReplaceService().highlight(lastSearch); } } vim.getRegisterManager().setSearch(lastSearch); } }