I'm programming in Fortran90 within the environment Visual Studio 2013.
I want to format my code in a clever and easy way and I tried to use shortcuts (like Ctrl + I Matlab smart indent) but it didn't work out. It's actually really strange as I tried to use Ctrl+K, Ctrl+D but it is not working and I don't understand why...
Is there someone that can help?
Many thanks,
Antonio
Each language in Visual Studio has its own predefined shortcuts, and of course you can add your own key combinations. For Intel Fortran there is no "smart indent" but there is an indent option for which no shortcut is predefined. To see what's available, select some text and then do Edit > Advanced. For example, CTRL-K,CTRL-C will comment the selection.
Related
What is the inline hints on/off shortcut in visual studio 2022?
I checked these checkboxes and it works but the shortcut Alt+F1 not work. (Visual Studio Community 2022 (64-bit) - Preview
Version 17.2.0 Preview 2.1)
I found your question because I was having the same issue. I think I've figured out what's going on.
Are you coding in C# or C/C++ ?
If you're doing C#, HOLDING DOWN the alt-F1 keys will TEMPORARILY show ALL the types of hints available; i.e. those you haven't told it to show all the time. When you release alt-F1 the 'extra' hints will disappear. If, as in your image, you've chosen to show almost everything all the time, holding down alt-F1 probably won't display anything different. (try diabling some of the stuff below the first line and see if there's a difference when you hold down alt-F1)
On my system it reacts rather slowly; if you just tap quickly you might not see any change.
(if that doesn't work, you might want to check to see if any extensions you're using are overriding the alt-F1 shortcut)
If you're using C/C++ the inline hints works a bit differently. Here alt-F1 or ctrl-ctrl can TOGGLE hints.
The options settings for C/C++ are located in "Text Editor/ C/C++ / IntelliSense", and the list of inline hint settings are quite a bit more limited than those listed for C#.
On vanilla Visual Studio 2022 press ctrl twice.
If you are using Visual Assist press Alt + F1
My question is there code completion for Visual studio like in Netbeans where you cycle the buffer with ctrl+k, when you type something?
There's now a nice extension called Simple Autocomplete which adds one command simpleAutocomplete.next that you can map to a shortcut of your choice.
No, there isn't a similar feature in Visual Studio.
The traditional Visual Studio autocomplete is using intellisense.
When you start typing, intellisense may bring up a drop down with suggestions. In that case you can tab to complete using the current suggestion or use the arrow keys to choose another.
Ctrl-Space (or Alt-Right arrow) will bring up this intellisense menu if it's not up.
I find it does a pretty good job overall.
Some extensions like Resharper or Visual Assist offer their own code completion or other similar features (like Suggestion List for Visual Assist).
I know it's been ages since I asked this question but I found the next best thing to do this. What I would suggest is to use VsVim extension and to use Vim's anyword completion; however, in order for this work, what must be resolved is the keyboard shortcuts that conflict:
Go to "Tools options" in Visual Studio.
Then go to VsVim category(alternatively you can search "VsVim" and
should bring the options) and click keyboard.
As far as I know vim deals with this type of completion with these keys
CTRL+P and CTRL+N so what we do is to let Visual Studio give up
these keybindings and let VsVim deal with it by Selecting from the drop
down of the keys(CTRL+P and CTRL+N) and let it be "Handled by VsVim".
I hope this has helped someone out.
Because of the lack Intellisense in Sublime, I prefer to using Visual Studio to code C# and Pycharm to Python.
ctrl + d in Sublime can select mutiple same word in text. So I can alter the selections on same time. It is convenient to alter the name of same variable in a function. How can I do that in my other editors?
The Ctrl-D multiple selection tool is one of its greatest features of Sublime Text 2 and is sorely lacking in other editors and IDEs.
Visual Studio doesn't have it built-in but there's a MultiEditing plug-in for it.
IntelliJ, which PyCharm is based on, doesn't have it either but it's apparently being planned for a release that should be out soon. See this blog comment (and the link in it) for more.
Meanwhile, you can use the rename refactoring tool in Resharper (for Visual Studio) or in PyCharm. It's not the same as multiple selections but is very useful functionality in its own right.
A nother IDE that does support it is Webstorme - alt+j. you can read the stackOverflow discussion about it here : How can I select next occurrence in IDEA editors
I just tested it on Webstorme10, and it works perfectly, just like in Sublime.
Try ctrl + h. It is the standard shortcut in many editors for replacing text.
I am using Visual Studio 2005 team edition. I come from a unix background using gvim.
It would appear that formatting/indenting code seems to be a lot harder.
Can anyone suggest a good option. VI with its autoindent/smartindent settings spoilt me.
thanks
ctrl K-F formats the selected code
Go to tools->options->Text editor->c/c++ to set formatting details
I'm trying to bind the following shortcut: Ctrl + W to close tabs
How can you customize VS to add/change shortcuts? Also, what are the most useful shortcuts you guys have found?
Tools > Options > (Show all settings), then Environment > Keyboard.
Here, rebind the key “File.Close” to Ctrl+W.
VS 2005/2008 Keybinding posters:
Visual C# 2008 Keybinding Reference
Poster
Visual C# 2005 Keyboard
Shortcut Reference Poster
Visual Basic 2008 Keybinding
Reference Poster
Visual Basic
2005 Keyboard Shortcut Reference
Poster
These don't cover customizations but they're good reference materials and definitely helpful for finding new shortcuts.
I keep a link to Jeff's shortcuts page, and refer to it to learn the shortcuts for all tasks I find myself regularly doing. I also use VisualAssist, and use a lot of:
toggling between .h and .cpp files (yes, I code in C++ :) ) (Alt-o);
going to the definition of something (Alt-g).
Tools > Options > Environment > Keyboard
I find most of them useful TBH!
Commenting, Bookmarking, Incremental Search, etc etc.
The one you want to override by the way is Window.CloseDocumentWindow which defaults to CTRL+F4
Ctrl-Shift-Space shows the syntax/overloads for the current function you are typing parameters for.