Skip to content

Override search keyword default values

Created by: KattMingMing

Request Allow users to set preferred default values for search keywords.

  • Add search.keywordDefaults to user configuration. search.keywordDefaults lets users override the default keyword values such as case:no to case:smartcase.

  • On search append the query with overwritten operators if the keyword was not present in the query and exists in search.keywordDefaults.

All keywords can be found here: https://docs.sourcegraph.com/user/search/queries

Example

Set default "case" keyword value to "smartcase" instead of "no".

// user settings
...
search.keywordDefaults: {
    "case": "smartcase",
}
...

Example queries with overwritten keyword values

  1. Search input field: repo:github.com/gorilla/mux mux On search: repo:github.com/gorilla/mux mux case:smartcase

  2. Search input field: repo:github.com/gorilla/mux case:no mux On search: repo:github.com/gorilla/mux case:no mux

Related issues: https://github.com/sourcegraph/sourcegraph/issues/2084 and https://github.com/sourcegraph/sourcegraph/issues/1817