# vim

* [check where vim executable package](#check-where-vim-executable-package)
* [check vimdoc with keyword](#check-vimdoc-with-keyword)
* [cursor and cursor shape](#cursor-and-cursor-shape)
* [vimrc examples](#vimrc-examples)

{% hint style="info" %}

> reference:
>
> * [mhinz/vim-galore](https://github.com/mhinz/vim-galore) | [Vim 从入门到精通](https://wsdjeg.net/vim-galore-zh-cn/)
> * [\* Vim help files](https://vimhelp.org/#reference_toc)
> * [mhinz/vim-galore](https://github.com/mhinz/vim-galore)
> * [Bram Moolenaar](https://www.moolenaar.net/)
> * [vim:tip](https://vim.fandom.com/wiki/Category:VimTip)
> * [Best Vim Tips](https://vim.fandom.com/wiki/Best_Vim_Tips)
> * [Search for visually selected text](https://vim.fandom.com/wiki/Search_for_visually_selected_text)
> * [Mastering Vim Grammar](https://irian.to/blogs/mastering-vim-grammar/)
> * [Syntax highlighting is extremely slow when scrolling up in recent version (v8.0.1599) #2712](https://github.com/vim/vim/issues/2712)
> * [Slow vim in huge projects](https://www.reddit.com/r/vim/comments/ng59kz/slow_vim_in_huge_projects/)
> * [Setting up Vim for YAML editing](https://www.arthurkoziel.com/setting-up-vim-for-yaml/)
>   {% endhint %}

#### check where vim executable package

```vim
:echo v:progpath
```

#### [check vimdoc with keyword](https://www.reddit.com/r/vim/comments/ng59kz/comment/gyrceos/?utm_source=share\&utm_medium=web2x\&context=3)

```vim
:helpgrep <keyword>

" i.e.
:helpgrep slow
```

* [or](https://stackoverflow.com/a/48858718/2940319)

  ```vim
  :echo $VIM
  ```

#### cursor and cursor shape

> \[!NOTE|label:references:]
>
> * [cursor shape](https://vim.fandom.com/wiki/Change_cursor_shape_in_different_modes)
>   * mode settings:
>     * [t\_SI](https://vimdoc.sourceforge.net/htmldoc/term.html#t_SI) = INSERT mode : `let &t_SI.="\e[5 q"`
>     * t\_SR = REPLACE mode : `let &t_SR.="\e[4 q"`
>     * [t\_EI](https://vimdoc.sourceforge.net/htmldoc/term.html#t_EI) = NORMAL mode (ELSE) : `let &t_EI.="\e[1 q"`
>   * cursor settings:
>     * 1 -> blinking block
>     * 2 -> solid block
>     * 3 -> blinking underscore
>     * 4 -> solid underscore
>     * 5 -> blinking vertical bar
>     * 6 -> solid vertical bar
> * [andyfowler/.vimrc](https://gist.github.com/andyfowler/1195581)
> * [Change cursor shape in different modes](https://vim.fandom.com/wiki/Change_cursor_shape_in_different_modes)
> * [Vim change block cursor when in insert mode](https://stackoverflow.com/a/58042687/2940319)
> * [Configuring the cursor](https://vim.fandom.com/wiki/Configuring_the_cursor)
> * [:help guicorsor](https://vimdoc.sourceforge.net/htmldoc/options.html#'guicursor')
> * [\* iMarslo : redirect message into file](https://github.com/marslo/ibook/blob/marslo/docs/vim/tricky.html#redirect-cmd-result-into-file)

* [revert cursor shape when exit vim/nvim](https://stackoverflow.com/a/71374251/2940319)

  ```vim
  autocmd VimLeave * silent !echo -ne "\e[6 q"
  ```

**guicursor**

```bash
$ /Applications/MacVim.app/Contents/bin/mvim -u NONE \
                                             -c 'redir > ~/Desktop/guicursor.txt' \
                                             -c 'echo &guicursor' \
                                             -c 'redir END' \
                                             -c 'q'
$ cat ~/Desktop/guicursor.txt
n-v-c:block-Cursor/lCursor,ve:ver35-Cursor,o:hor50-Cursor,i-ci:ver25-Cursor/lCursor,r-cr:hor20-Cursor/lCursor,sm:block-Cursor-blinkwait175-blinkoff150-blinkon175

# after modified
$ /Applications/MacVim.app/Contents/bin/mvim -c 'redir! > ~/Desktop/guicursor.txt' \
                                             -c 'echo &guicursor' \
                                             -c 'redir END' \
                                             -c 'q'
$ cat ~/Desktop/guicursor.txt
a:hor10-Cursor-blinkon0,i-r-c-ci-cr-o:hor10-iCursor-blinkon0,n:hor10-Cursor-blinkwait700-blinkon400-blinkoff250,v-ve:block-Cursor
```

![guicursor](/files/UnSDZxdlnKIARTUUPPUo)

**cursorcolumn**

> \[!NOTE|label:references:]
>
> * [Setting Vim cursorline colors?](https://stackoverflow.com/a/29207563/2940319)

```vim
set cursorcolumn
autocmd InsertEnter * highlight CursorColumn ctermfg=White ctermbg=Yellow cterm=bold guifg=white guibg=yellow gui=bold
autocmd InsertLeave * highlight CursorColumn ctermfg=Black ctermbg=Yellow cterm=bold guifg=Black guibg=yellow gui=NONE

" or simplely via
set cursorcolumn
highlight CursorColumn ctermfg=White ctermbg=gray cterm=bold guifg=white guibg=gray gui=bold
```

#### vimrc examples

* [reiter/.vim-files/vimrc](https://github.com/jreiter/.vim-files/blob/master/vimrc)
* [lilydjwg/dotvim](https://github.com/lilydjwg/dotvim/blob/master/vimrc) |[依云 - lilydjwg](https://blog.lilydjwg.me/)
* [Yggdroot/dotvim](https://github.com/Yggdroot/dotvim/blob/master/vimrc)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://imarslo.gitbook.io/handbook/vim.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
