ROXL
  • Development
  • Administration
  • Software
  • Workspaces
  • Personal
    • Media
    • Projects
    • Uncategorized
Krivoschekov Artem
24.08.2020 by admin 0
Administration, Development

Vim for Visual Studio 2015 and above

Vim for Visual Studio 2015 and above
24.08.2020 by admin 0
Administration, Development

Today I’m gonna show you one awesome plugin that will add VIM mode to your Visual Studio 2015 and above.

The plugin called VsVim, the link for visual studio marketplace – [link].

You can simply install it from Tools -> Extensions and updates

vim for visual studio

In the modal window, choose tab “Online“, type “VsVim” in the search box and download the most relevant option

vim for visual studio

Restart your Visual Studio after that.

After the restart, you will see a window that says about some keymappings conflicts with plugin and VS. Choose “all mappings for VsVim” or something like that. Main idea – override all VS rules with VsVim rules. It’s ok, don’t worry.

Awesome, now you can use vim in your VS! Try combinations like I (for insert move), V (Visual Mode), and move cursor overall working area with VIM buttons such as H, J, K, L, and so on.

Some recommendations:

Also, I Can recommend you to do some settings for VIM mode, that are very common:

JJ for Esc (allows you to quit edit mode faster from JJ combination, same as by <ESC>)

1
:imap jj <ESC>

Unmap Crtl + S (allows you to save faster with Ctrl + S that will handle by VSStudio, not vim. In vim you should always type :w for saving docs)

1
2
3
nnoremap <c-s> :w<CR> # normal mode: save
inoremap <c-s> <Esc>:w<CR>l # insert mode: escape to normal and save
vnoremap <c-s> <Esc>:w<CR># visual mode: escape to normal and save

You can save all these settings in .vsvimrc file and they will be applied each visual studio load. How to do it – read here:

https://github.com/cboudereau/vsvimrc

.vimrc file location:

Example of my current .vimrc-file:

INI
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
" version control
nnoremap Ud       :vsc Team.Git.CompareWithUnmodified<cr>
 
" from https://github.com/justinmk/config/blob/master/.vsvimrc
nnoremap yxx      ggVG:vsc
EditorContextMenus.CodeWindow.ExecuteInInteractive<cr>
 
" fsharp refactoring
" not yet implemented
nnoremap Un       i failwith "not yet implemented"
 
" extract (p/P)arameter
nnoremap Up      
yawOlet<Space><Esc>Pa<Space>=<Space>failwith<Space>"not<Space>yet<Space>implemented"<Esc>j$i
nnoremap UP      
ciw<Esc>pa=<Esc>p<Esc>yawOlet<Space><Space><Esc>Pa<Space>=<Space>failwith<Space>"not<Space>yet<Space>implemented"<Esc>j$i
 
" convert to Union (C)ase
nnoremap Uc      
<Esc>diwatype<Space>[<Struct>]<Space><Esc>pa<Space>=<Space><Esc>pa<Space>of<Space>string
 
" extract (R)ecord member type to (I)dentifier
nnoremap Uri   
/:<CR>d$byiw$a=<Space><Esc>pbvuyiw?{<CR>Olet<Space><Esc>pa<Space>=<Space>failwith
"not yet implemented"<Esc>''<Esc>
 
" fsharp interactiv(E/e)
nnoremap Ue       Vggo:vsc
EditorContextMenus.CodeWindow.ExecuteInInteractive<cr>
nnoremap UE       VGGo:vsc
EditorContextMenus.CodeWindow.ExecuteInInteractive<cr>
 
imap jj <ESC>
 
nnoremap <c-s> :w<CR>
inoremap <c-s> <Esc>:w<CR>l
vnoremap <c-s> <Esc>:w<CR>
 
set clipboard=unnamed

 

Also, I recommend you print this useful cheatsheet for VIM.

vim cheat sheet

code typing vim

Previous articleVisual Studio + TFS: how to move changes to another branch OR tftp unshelveNext article КСУП - Модуль отображения полей сущности в зависимости от групп безопасности

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Categories

  • Administration
  • Development
  • Media
  • MyLanit
  • Personal
  • Portfolio
  • Software
  • КСУП
  • Почта

Tags

administration (1) blockchain (1) calendar (1) certification (2) code (1) commits (1) development (1) encoding (1) ethereum (1) frontend (1) ganache (1) geth (1) git (1) IntelliJ (1) javascript (1) js (1) material (1) material-ui (1) microsoft (1) mssql (1) outlook (1) photoshop (1) phpstorm (1) planning (1) powershell (7) react (2) react js (1) react js (3) scripts (2) searchservice (1) sharepoint (8) sharepoint (1) tests (1) tfs (1) tftp (1) typing (1) unit testing (1) vce (2) vcs (1) video (1) vim (2) visualstudio (2) vscode (1) web (1) windows (2)