VSCode + VIM on Windows - vscodevim

I use VIM on linux/max as part of my day job but recently started dabbling in game dev. I have VSCode with the VIM plugin. How can I search for "String" across multiple files, similar to vim on linux using silver searcher via command: :ag "grep pattern" /search/directory_location
Or is there a better way to do this in general?

Related

Can I use vim-like commands in the WIndows Command line in Windows 10?

Because I use vim (and obviously like it) while working in the command line, I often go through a few keystrokes before I realize I'm not in vim anymore. That's not a huge problem, but when entering a lot of commands on one line, vim-like navigation would really speed things up on the extremely rare occasion cough I make a typo. It would be great it there were a way to make command line typing act at least a little like vim (e.g. Normal mode, Insert mode, movement from the home keys, etc.)
I am open to using a different shell, but would prefer something I can use without learning a ton of new commands (e.g. command line or BASH like). I have else compiled many of my frequent command sequences into .bat files, which I would prefer not to have to change too much to get to work properly.
When using Windows, a good option would be to install Git, which gives you "Git Bash", which is their distribution of mingw.
Now that you have bash, you can use set -o vi which puts your readline in Vim mode.
https://sanctum.geek.nz/arabesque/vi-mode-in-bash/
I'm surprised nobody has mentioned Clink. It works with cmd.exe, and has support for Vim (well, technically, Vi) key mappings. Sadly, the documentation seems unfinished (to say the least); that said, I have found it to be quite stable, and have used it for a few years now. Doing a quick search yields information on how to set the default editing mode to Vi (versus Emacs).
In short Control+Alt+J switches to Vi mode (assuming one is currently in the default Emacs mode), and a standard Readline inputrc in the right place (my file path is %HOMEPATH%\AppData\Local\clink\clink_inputrc), with the right directive (set editing-mode vi) ensures that a new cmd.exe invocation starts off in Vi mode.
I am open to using a different shell, but would prefer something I can use without learning a ton of new commands (e.g. command line or BASH like)
In bash you can enter vi-mode with the command:
set -o vi
This will make shell-editing very similar to Vim-editing. For a cheat-sheet of vim-mode commands see: https://github.com/pkrumins/bash-vi-editing-mode-cheat-sheet/blob/master/bash-vi-editing-mode-cheat-sheet.txt

IdeaVim : Navigate through project file

Is it possible with the plugin IdeaVim for IntelliJ to navigate thourgh project file (in the window below) using hjkl key ? Like the CtrlP plugin for Vim.
As of 2021, this is now possible.
All you have to do is enable the NERDTree plugin in ideavim by inserting set NERDTree into your .ideavimrc
if you're looking for a CtrlP equivalent, Webstorm has a fuzzy finder that's actually much more powerful than CtrlP.
Try COMMAND+SHIFT+O (the letter O) on Mac or CTRL+SHIFT+N on Windows/Linux.
There is more here: https://www.jetbrains.com/help/phpstorm/2016.1/navigating-to-class-file-or-symbol-by-name.html?origin=old_help#d937859e425
This is old but just in case anyone is looking for marginal efficiency. I use this AutoHotKey script to achieve this exact behavior - together with as you'll figure other mapping for never needing to travel out to the Numpad, Arrow keys or Special keys.
As it is a very short repo here are the essentials:
Download autohotkey (https://autohotkey.com/).
Place the .ahk script into the startup folder (win + r, then run "shell:startup" to find on Windows) (https://autohotkey.com/docs/FAQ.htm#Startup). This allows the script to always be active, as it is ran on startup.
Run the Script to go into effect now.
The script is:
#SingleInstance
+CapsLock::CapsLock
CapsLock::Esc
Its been game changing

LaTeX editors with VIM like commands

I have recently grown fond of VIM for simple scripts now that I know how to use it a little bit. (thanks VIM adventures!!!)
Is there a LaTeX editor out there with vim-like commands? Having the toolbar of Winedt with the VIM commands to move around the text and replace/substitute things would be great.
There is vim-latex which adds LaTeX support to Vim, if that is what you are looking for.
I recommend installing it using Vundle.

Console editor: something between VIM and nano?

I used vim for a long time, but switched to Sublime Text last year for most of my programming work.
Now, every time I have to make use of a console editor (mostly over ssh), I feel extremely uncomfortable with vim. The shortcuts and commands have slowly left my memory, my once carefully curated vimrc is gathering dust, and I just can't use the editor effectively without re-learning everything.
On the other hand, nano is just dumb. Great for opening a file, adding a flag and closing it, but way too primitive for anything else.
Is there something in between I can use? I can settle for not-as-easy-as-nano-nor-as-powerful-as-vim.
You can use mcedit. It is much more user friendly than other editors - it even supports mouse over ssh (even in Putty console from Windows).
Simply install package Midnight Commander as follows:
Ubuntu/Debian:
sudo apt-get install mc
Fedora/Redhat:
sudo yum install mc
MacOS:
brew install mc
and it will make mcedit available.
In local console it even supports Shift+Del, Shift+Ins, Ctrl+Ins shortcuts that we use in Windows.
It also has nice ability to copy blocks into arbitrary files, effectively giving you unlimited number of clipboards.
You could try these, but you'll have to install them on the machines you SSH into:
joe
ne
diakonos
But my opinion is that you should drop the seriously underpowered Sublime and go back to Vim.
$ vimtutor is your friend.
If you want to learn a text editor that's available on just about every machine you could possibly SSH into, basically your only options are vim, emacs, nano, and ed.
Emacs is an okay choice, so long as you can remember c-x c-s (save) and c-x c-c (close)… But that's only two fewer commands than you need to remember with vim (i for insert mode, <esc> for normal mode, :w to save, and :q to quit).
Possibly a better alternative would be to run X11 locally, so you can use gedit, gvim, or one of the other graphical editors from the remote machine? Or maybe print off a couple of cheat sheets (see: https://stackoverflow.com/questions/442057/what-is-your-linux-vim-cheat-sheet) and keep them on your person at all times?
I haven't personally used it, but the Cream flavor of Vim modifies Vim with more standard-style mappings (e.g. CTRL-F for Find), no modal editing (normal vs. insert mode) as in Vi(m), and it also works in the console (with menus). Maybe that makes Vim suitable to you.
Since you're a Sublime user, you'll probably feel comfortable with Suplemon https://github.com/richrd/suplemon.
It's a bit like Sublime and it's specifically created to be easy and powerfull at the same time. It also has multiple cursors and similar key mapping as Sublime. It's written in Python and supports addon modules. Hopefully one day it'll support Sublime packages too.
Disclaimer: I'm the developer of Suplemon.

How to start Erlang shell from inside Vim

I want to use Vim as the editor for my Erlang coding.
I managed to install the plugin for Erlang in vim, and I want to know if it is possible to
compile the current buffer inside vim? In Emacs for example you can start Erlang shell using Ctrl C + Ctrl L
key combination. So is there a alternative in Vim to start the Erlang shell and then compile the current buffer?
For a quick shell command from inside Vim, use :!command -a -b arg1 (e.g. :!ls -l, :!erl %).
But Emacs is not Vim, they have different ideas behind both. Vim is just a text editor with programming extensions, it's not a place for terminal inside (just as for tetris and M-x doctor).
Vim maintainers refuse to add a full-blown terminal implementation into Vim itself (for more details, see :help shell-window ).
If you still want an in-buffer shell, you can take a look at ConqueTerm , but it does not work seamlessly. I tried it, but prefer using tmux / screen to split my console's screen estate into windows.
I also use the same vimerl plugin for erlang development in vim. However, I had to make a small change to it to make some improvements to the way it compiles for checking.
Once I'd made these changes, writing the file (e.g. with :w) caused vimerl to compile that source file and put the warnings/errors in the quickfix list (exactly the same way that :make would do if you had a Makefile in place).
FWIW, I also have the following configuration in my vimrc:
let g:erlangHighlightErrors = 1
let g:erlangHighlightBif = 1
let g:erlangCompletionDisplayDoc = 1
let g:erlangWranglerPath = "/usr/local/share/wrangler"
let g:erlangRefactoring = 1

Resources