handmade.network » Forums » Going from VS to 4coder/Emacs/Vim/....
khofez
21 posts
#16298 Going from VS to 4coder/Emacs/Vim/....
2 months ago Edited by khofez on Sept. 11, 2018, 9:03 p.m. Reason: Initial post

Hi! This is more of a "i want to know your opinion" question rather than a technical one, I've been trying to go from visual studio to 4coder since a few months now, and 4coder is awesome, its very nice to code using it and etc but, I always end up missing some features from visual studio, like F12 that goes to the function declaration, or the pick definition that opens a popup showing me the function or to find all references with some function or variable etc. I mean I suppose there are alternatives of course, but then when I go back to visual studio, the whole laggy, sluggish environment and slow intellisense operations makes me remember why I wanted to work out of it in the first place. So if anyone has gone through this process of going from visual studio and all it's shortcuts to something like 4coder/emacs/vim/etc, I would like to know if it was worth it and how was it for you?
mmozeiko
Mārtiņš Možeiko
1823 posts / 1 project
#16300 Going from VS to 4coder/Emacs/Vim/....
2 months ago

I cannot talk about 4coder as I don't use it, but for emacs/vim you typically configure ctags or more modern clang-based plugins which provides this kind of functionality - autocomplete, jumping to definition, finding references, etc.. It's a bit of work to properly set it up, but once it is done they work pretty good.

I have used vim on Linux with YouCompleteMe: https://valloric.github.io/YouCompleteMe/ It works pretty well and is very customizeable. And it works for more languages than just C/C++. C#, Python, Go, JavaScript and more. It may be a bit of pain to set up on Windows due to difficult dependencies & building of them, but I don't know for sure. I have used it only on Arch Linux where installation was as easy as installing package from AUR repo.
SIMPalaxy
2 posts
#16309 Going from VS to 4coder/Emacs/Vim/....
2 months ago

Getting to the function declaration is really easy in 4coder, ctrl + t or ctrl + shift + t (to list all locations)

As for the window popping up, I just use a second view open to the same buffer as the first then search for the function declaration or it's multiple calls making editing between the two super simple.
mrmixer
Simon Anciaux
478 posts
#16323 Going from VS to 4coder/Emacs/Vim/....
2 months ago Edited by Simon Anciaux on Sept. 13, 2018, 7:36 p.m. Reason: added batch file

When I switched to notepad++ and than 4coder I was missing the "goto definition" and the refactor tools (to rename things in bulk mostly). But I didn't use those a lot so it was never a great issue.

For "goto definition" 4coder has several search functions that can help you. This function search in open buffers (you can use the project system to open all files from a directory). When you got a "locked buffer" (~ readonly) in 4coder you can use <return> to open the line under the cursor in the other view, <shift return> to open in the same view, and <alt n> and <alt N> to open the next "jump location". All those function are text base (no compiler involved), so there can be false positives.

To search for a struct/class/enum/union definition:
<alt D> Queries user for string, lists all locations of strings that appear to define a type whose name matches the input string.
<alt T> Reads a token or word under the cursor and lists all locations of strings that appear to define a type whose name matches it.


To search for a function definition:
<ctrl T> Reads a token or word under the cursor and lists all exact case-sensitive mathces in all open buffers.
<ctrl F> Queries the user for a string and lists all exact case-sensitive matches found in all open buffers.
<alt F> Queries the user for a string and lists all case-insensitive substring matches found in all open buffers.
<ctrl G> Reads the string in the selected range and lists all exact case-sensitive mathces in all open buffers.


This work fine for your code but if you want to jump to a system header or library it requires that you open the file. So for that it may be better to use Visual Studio (at least to find the file you need to open).

I also use the "execute CLI" (my version of it) with a batch file to call "findstr". You can use the jump commands with the result. This is usefull to search in a directory without opening all the files in it, but it can be a bit slow. Note that you need to call this script form the directory you want to search which might no be possible to do with the default execute CLI from 4coder (I don't remember).
1
2
3
4
5
6
@echo off

set wildcards="%CD%\*.h" "%CD%\*.cpp" "%CD%\*.cs" "%CD%\*.txt" "%CD%\*.bat"
rem set wildcards=*.h *.cpp *.cs *.txt *.bat

findstr /L /S /I /N %* %wildcards%


For the bulk rename, I use the "compile error trick" where I change the name of the thing I want to rename and compile. That will generate errors and you can use <alt n> to open the files and than use the replace or replace in range functions. It's not fun but it works ok if you don't do that often.

Of course you can invest some time to try to code some of those things in you custom layer (you could use clang to do some of those things as mmozeiko said).