Question: How do I replace current word under cursor in Emacs? 

I know that I can use query-replace or replace-string but every time I do so I have to type entire string to be replaced, this is just annoying. 

Vi has equivalent command cword and I can use a shortcut to pull the word under cursor for replacement:

```
nmap <leader>z :%s#\<<C-r>=expand("<cword>")<CR>\>#

```

Anybody know how to do it with Emacs?

Answer: 
Incremental search has this feature, but the replace functions don't. Fortunately, [incremental search](https://www.emacswiki.org/emacs/IncrementalSearch) *does* have a way to switch to replace mode once you've selected a search term. So:

* Press `C-s` to switch to incremental search mode
* Press `C-w` to yank the current word into the search buffer. You can keep pressing it to append multiple words, and you can also use `C-M-y` to yank individual characters and `C-y` to yank whole lines
* Press `M-%` to switch to replace mode using the search buffer you've already constructed

As you probably know from using `M-%` normally, this is a query replace mode where it prompts you for what to do with each match. If you just want to replace them all, hit `!` on the first match.
This approach similar to the one described by [Michael Mrozek](https://unix.stackexchange.com/a/51856/99066), but starts with `isearch-forward-symbol-at-point`, that *adds a word at a point to the search string*.

* Press `M-s .` to switch to incremental search mode.
* Press `M-%` to switch to replace mode.
* Optionally press `M-n` to pre-fill replacement string with the search string.

With this approach, the *cursor can be located at any part* of the word. It tested to work correctly with the *words that contain dashes*.