Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make identifier chars configurable #236

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -877,6 +877,22 @@ Default: `[see next line]`
\ 'erlang' : [':'],
\ }

### The `g:ycm_identifier_chars` option

This option controls which non-alphanumeric characters are allowed in
identifiers for the various completion engines. YouCompleteMe will use
everything from the last disallowed char to your cursor position as the input
to completion engines.

For example, given `object.method_|` (| being the cursor position), and the
default `g:ycm_identifier_chars = '_'`, `method_` will be used as the search
string. Or, given `namespace/a-clojure-me|` and `g:ycm_identifier_chars = '-_'`
`a-clojure-me` will be the search string.

Default: `'_'`

let g:ycm_identifier_chars = '_'

FAQ
---

Expand Down
3 changes: 3 additions & 0 deletions plugin/youcompleteme.vim
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,9 @@ let g:ycm_semantic_triggers =
\ 'erlang' : [':'],
\ } )

let g:ycm_identifier_chars =
\ get( g:, 'ycm_identifier_chars', '_' )

" On-demand loading. Let's use the autoload folder and not slow down vim's
" startup procedure.
augroup youcompletemeStart
Expand Down
3 changes: 2 additions & 1 deletion python/ycm_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,10 @@
#
# You should have received a copy of the GNU General Public License
# along with YouCompleteMe. If not, see <http://www.gnu.org/licenses/>.
from vimsupport import GetVariableValue

def IsIdentifierChar( char ):
return char.isalnum() or char == '_'
return char.isalnum() or char in GetVariableValue( "g:ycm_identifier_chars" )


def SanitizeQuery( query ):
Expand Down