Is there a shortcut to wrap text as a code chunk in a RMarkdown file in RStudio? - r-markdown

Any shortcut to transform text as a code block by selecting the text and pressing keys ?

I have created a package {chunkthis} which provides a Rstudio Addins Chunk the code to do this.
At first, install the package from GitHub using install_github which is a function from {remotes} package.
# install.packages("remotes")
remotes::install_github("shafayetShafee/chunkthis")
Doing this will add the addin in Rstudio. Then, simply copy something then use that addin to paste wrapped in a R code-chunk fence. Or even you can add a keyboard shortcut for that addin.
To add a shortcut for Rstudio Addin, navigate to Tools -> Addins -> Browse Addins -> keyboard Shortcuts... and then add a key board shortcut for that addin.
Hope this helps.

Related

File not formatting after saving in Sublime even when SublimeAstyleformatter's autoformat_on_save is true

So I tried setting up Sublime text editor for programming in cpp on mac , and to use formatter I added the sublimeAstyleformatter plugin and then followed these steps:
Sublime Text > Preferences > Browse packages > SublimeAstyleformatter > SublimeAStyleFormatter.sublime-settings
and inside the file I changed the autoformat_on_save to true and saved the file, but still whenver I save the cpp code, the file is not formatted.
I searched but didn't find any way out, Any help would be appreciated
I understand many windows users are facing the same issue on their systems too. It's probably because you may have installed fresh OS on your system.
so let's get to the solving part.
I am assuming if you are reading this answer you're already done with this step:
Preferences > Browse Packages > SublimeAStyleFormatter > SublimeAStyleFormatter.sublime-settings > "autoformat_on_save": true, (change false to true in line 8)
(If not then do the above step after installing AsytleFormatter package in sublime, and give it a go-to check whether it started working or not)
Now, after this, if your formatter still doesn't work there is a major chance your system doesn't have Microsoft Visual C++ 2010 x64 Redistributable - 10.040219
here is the official link : Microsoft Visual C++ 2010 x64 Redistributable-10.040219
install this software, relaunch sublime editor and you are good to go.
PS: For confirmation do the following (I have added snap for reference Screenshot):
Right-click in the file on your sublime editor
Hover over AStyleFormatter
Now you will be able to see the "format" option (which previously was greyed out)
( Hope it helps to solve the issue!)
I was facing issue with my m1 mac. Now it is resolved. What I did was open sublime text using Rosetta. Some of the sublime packages started working for me as I changed sublime text to open using Rosetta, when I click.
Follow these steps.
Quit Sublime text.
Go to Applications.
Right click on Sublime Text -> Get Info -> Select "Open using Rosetta" checkbox.
Open sublime Text again and check.
This resolved the issue for me. However, in case you do not want to go through Rosetta for sublime, then you can have Clang format Sublime Package installed; that works natively, without going through Rosetta.
Going off the documentation, the key combos on macOS/OSX are CtrlAltF for format current file and ⌘K, ⌘F for format current selection (you had it backwards). The Command Palette commands are called SublimeAStyleFormatter: Format Current File and SublimeAStyleFormatter Format Current Selection.
After looking through the issues on the plugin's Github repo, it looks like the Microsoft Visual C++ 2010 SP1 Redistributable Package (x64) is required for the plugin to work. However, seeing as you're on macOS, I'm not sure what else would be required.

Set Questa Sim Double-Click Editor

I am trying to get Questa Sim-64 10.7a to open .sv files in Notepad++ when I double-click in the project window. I set the editor command to use Notepad++, so when I use the edit command in the Questa Sim console window it uses Notepad++. That also sets Notepad++ as the editor that is used when I select File-->Open in External Editor in the Quest Sim editor, but that means I have to open the file in the default editor, then open it in my preferred external editor.
How do I set my Questa Sim project to open the file in Notepad++ when I double-click on the file in the project window?
I'm not sure what I did, but suddenly it is working as expected. That is, double-clicking a file in the project opens it in Notepad++.
I tried restarting Questa Sim, and it still didn't work as expected. All of a sudden, without even restarting, it just works.
edit: This morning it is not working again, although I haven't changed anything. That is, it is opening in the default editor. Unless I'm missing something, I think this feature is just flaky.
edit edit: OK, I discovered a work around. Whenever I add an existing file, the editor defaults back to the Questa Editor. If I open any .sv file from Windows Explorer (I have .sv files associated with Notepad++ in Windows), Questa starts using Notepad++ as expected. So, it's some goofy Questa Sim bug for sure.
1.install gvim or notepad++
2.after installation go to This PC
3.select any file .v or .sv file
4.select and open with open with gvim or notepad++
5.make default for .v or .sv with gvim or notepad++
6.whenever you open the file it will open with the default tool only
7.in Questa Editor also it open with the default tool

How to make sublime text highlight CUDA C++ syntax

I'm using Sublime Text 3 to write CUDA C++ programs. But when I create the .cu file and open it using Sublime Text, the Sublime Text does not highlight the syntax.
I installed the packages here
https://github.com/harrism/sublimetext-cuda-cpp
I cd to the Sublime Text directory, git the repository and restart the Sublime Text. However, nothing got changed. What's wrong? Do I need to further configure something after I git the repository to the sublime text directory?
Thank you all for helping me !!!
I think I have solved this problem.
Firstly, install the Package Control introduced by most blogs. Then, as recommended by OdatNurd, I abort the installation via git. Instead, I open the sublime text, then press Ctrl+Shift+p. Then type in "Package Control", then choose "Package Control: Add Repository". We are required to input a url. Input "https://github.com/harrism/sublimetext-cuda-cpp". Press Enter. Then press Ctrl+Shift+p again, type in "Package Control", this time choose "Package Control: Install Package". In the search box, type in "cuda", and choose the name of the CUDA C++ package.
Finally, restart sublime.
Thanks all the answerers!

Run as administrator not showing in start menu

Background:
My C++ application developed by VS2008 and use the VS setup project to create installer for that. After installation it will create two shortcuts to application. one is in user desktop and second one is in start menu. Application(myApp.exe) installed to the Program files directory.
Question: If I right click on the icons in the start menu, there is a option Run as Administrator for most of them. But if I right click on the shortcut that related to my application. It doesn't show Run as Administrator. How to fix this?
Edit: But if i right click on the myApp.exe in the Program files, it shows "Run as Administrator".
Set your embedded manifest to require administrator. On the project property page:
...on the (highlighted) UAC Execution Level, change asInvoker to requireAdministrator. Build your project to embed the new manifest, and it should be ready to do its thing.
Oh -- I didn't think to do it here, but in the Configuration drop-down, you probably want to select All Configurations, instead of the (default) Active configuration that's selected in the screen shot. Gets seriously annoying -- you think you've got things fixed, then you change to "Release" and a bunch of stuff suddenly breaks, and you have to go through figuring out what you'd changed, and edit those changes into the Release configuration as well.
In manifest file there is option "requestedExecutionLevel" and "UIAccess" which will manage it.
I found the answer for this after so much testing and searching. So here I mention it for use of any one.
Windows only shows Run as Administrator in the context menu for that shortcuts those are directly targeting to some exe file.
If you use VS deployment (setup) project to create your installation with desktop and start menu shortcuts. Those shortcuts not targeting to exe (Application.exe) file.
Instead of that shortcuts targeting to application folder (MS office 2007 also same). This is called installation-on-demand and advertisement. Here is the more details.
This will help your application to repair from file missing (pray Google for more).
So we have to disable this feature if you want to target your shortcuts directly to exe file.
For this you can use command prompt or some tool. here is how to do it.
Nirmally windows installer having a exe and a msi.
These setting are stored at at msi generated with setup file.
So You have to alter the file and add the entry DISABLEADVTSHORTCUTS=1 to property table.
Using Command prompt:
msiexec /i <path to your msi> DISABLEADVTSHORTCUTS=1
Using Orca Tool:(Meny other tools also there)
Download Orca tool from here and install it.
Right click your *.msi file and click edit with orca.
Go to property table and add new entry DISABLEADVTSHORTCUTS and value is 1 , save and close.
Now you done.
Install using setup.exe file and check the target of the shortcuts. those are directly target to the exe file in application folder.
Now if you right click on the shortcuts those shows Run as Administrator option in context menu.
Note: Doing this you will gain Run as Administrator but scarify the windows auto repair capability.

Javadoc-like info boxes for visual C++

Are there any plugins/options/etc. that will show me this:
when I hover over a C++ function/method name in visual studio 2010?
I've tried using visual assist X, but the info for the function is not indented, newlines are ignored, and terms like "return" and "Parameter" aren't bold or colored. The VS built-in XML comment stuff was even less readable.
If you have CodeRush/Refactor you can try the CR_Documenter plugin (use VS Extension Manager). It provides a new dockable window with such documentation.
Use SandCastle to integrate with the builtin help (F1). Its not as good as inline help like you get in your Eclipse screenshot, but you can hover over a type, press F1 and then you are there.
To do this, install Sandcastle and Sandcastle Help File Builder. Then in your Sandcastle Help File Builder project, make sure to tick the box for MSHelpViewer. This will generate documentation and a script you can run to integrate your custom documentation into the F1 help.