I typed the source code in WordPad and saved it as addition.f90 but, unfortunately, the only options Windows provides are text files, rtf's, and so forth.
I am using the G95 compiler for Windows.
In the WordPad Save dialog, type the filename in double quotes, e.g. "addition.f90". This will override the default extension.
I suggest you use a decent text editor instead. Have a look at notepad++, VIM, GNU Emacs or similar.
To rename a file in Windows you either use the command prompt:
rename file.f90.rtf file.f90
Or you can use the Windows explorer. Make sure you set it up to display file extensions. Under Tools | Folder Options, unselect 'Hide extensions for known file types'. To rename a file, either select it and press F2, or right-click and select Rename.
Related
We have a custom .clang-format file in the root folder of our repository and use clang-format with -style=file for all C and C++ files.
I like to change the formatting rules of clang-format for one file only.
In particular I like to switch BinPackArguments form true to false.
I know, that I could place a .clang-format file in the corresponding folder. This option does effect all files in this folder.
Formatting it differently once is not an option, because our version control system will reject not formatted files.
I know, that I could turn off the formatter via the comment
// clang-format off
This has the drawback that the file is not formatted at all.
Is there a way to change one option for one file only (perhaps via a comment)?
When I open a file with an ending of ".c" in Sublime Text 3, the program displays it in C++. I know this because the language shown in the bottom right hand corner is "C++". Can I change this?
I don't know if it is related, but when I try to run or build a C program, Sublime Text compiles it using g++ and not gcc. Also, I'm using a linux OS.
Thanks.
You can just click on that C++, a menu shall appear in which you can select C.
Since you're saying that all the files with .c extension are being viewed as C++ files, you may also want to change that default by navigating to:
View >> Syntax >> Open all with current extension as... >> C
While having a .c document as the active tab/group/window.
Sure you can,
in the tool bar select Tools->Build System->New Build System...
this will allow you to create your custom setting build.
After that you can remove Build System from Automatic and set it to your custom Build.
Hope it helps.
I am attempting to use the google.vim (and on vim.org) indent style for my c++ project, but I can't seem to load it. I installed google.vim using vundle and opened up a cpp file and noticed that my tabstops, shiftwidths, etc did not change. If you set global ts and sw parameters, are they not overwritten? How do you force a certain indention when editing a file in vim? I want everything in my vimrc file to be overwritten by the google.vim file when I edit a cpp file.
Running the :filetype command in vim reveals this information:
detection:ON plugin:ON indent:ON
The bottom line is that I don't understand how to tell vim to use my google.vim file located under ~/.vim/vundle/google.vim/indent/google.vim. From what I have read, vim detects that filetype of your current file and uses the appropriate .vim file for syntax and indentation. So would I then have to rename my google.vim file to something like cpp.vim?
In most cases I like to use a tabstop of 3 and a shiftwidth of 3, so I set these in my .vimrc file. However, when I edit a cpp file, I want all my settings to be changed from what I have set globally to what the google.vim file sets.
You must rename the file from google.vim to cpp.vim, as indicated in the description of the plugin on vim.org.
General explanation:
Adding filetype plugin indent on to your ~/.vimrc allows Vim to detect the filetype of the files you edit (usually based on the file extention) and source filetype-specific plugins and indent scripts.
The idea is simple: you edit a file with {{LANGUAGE}} filetype and Vim tries to source any ftplugin/{{LANGUAGE}}.vim and indent/{{LANGUAGE}}.vim it finds in your runtimepath.
Because the filetype of your file is cpp, Vim will blissfully ignore your google.vim indent script so… you must rename it to cpp.vim for it to work.
Or you could rename all your C++ files foobar.google and teach Vim to recognize *.google files but, well… it doesn't sound right ;-)
So I downloaded, installed, and inserted into path the clang formatting plugin. I also tested it and it works for Google (Mozilla, etc.) formatting options out of the box, yet I cannot get it working with my .clang-format file. (I've put my file into the same folder as my source file, changed its encoding into UTF-8, also tried to put it into clang install folder, add file into project, write its contents inside '{key:value}' yet formatting does not happen). So how do you feed formatting file to chrome-format extension?
My file contents:
{ BasedOnStyle: "LLVM", IndentWidth: 4 }
My file name:nm.clang-format
Go to Tools->Options->LLVM/Clang->ClangFormat and put file in the Style option field.
Then place your style file named .clang-format (this is the full filename, not an extension) either in the source file's directory or one of its parent directories. Windows Explorer won't let you create filenames with leading . so you need to go to the console for this.
If like me you got confused later on where the .clang-format was living, use procmon to track the file reads of clang-format.exe
For the record, it seems that if both "Fallback Style" and "Style" are set to "file", no formatting will happen even if the style file is at its correct location. Setting "Fallback Style" to something different than "file" (e.g. "none") helps.
In VS2019 works if the clang-format file is named as .clang-format.
It must be .clang-format, not .clang-format.txt or clang-format.txt.
I'm teaching myself some Django tonight using the local dev package at instantdjango.com
I made it through half the tutorial, building a basic map with points on it, then closed out of the console for a bit. I just fired it back up and now when I try to use notepad++ to edit files, console tells me it doesn't recognize the command. What happened?
When I as working through the first half, I was able to type: "notepad++ filename.ext" and I'd get a text editor that would pop up.
Now when I type that, it doesn't recognize the command.
How do I get back the ability to use the text editor and how did I lose it?
In a windows terminal, you can launch notepad++ with the following:
start notepad++ <filename>
Note that the filename is optional.
Most likely the directory in which the Notepad++ executable resides is not in your system's PATH. For information about fixing this please see How to set the path in Windows 2000 / Windows XP.
If you are using gitbash or cygwin, you can create an alias
alias np='start notepad++'
And use
np myfile.txt
This is what I have done, in this way you dont have to type notepad++
Create np.bat file with this set of commands
#echo off
start "" "C:\Program Files (x86)\Notepad++\notepad++.exe" %*
place np.bat file in c:\Windows
open the command prompt and type np or np myfile.txt and enter.
One way is to make a change to this registry key:
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\Notepad++.exe]
You can download a zipped .reg file from Donn Felker that lets you open a file with just an n shortcut.
I edited the .reg before running it and to make sure the path to Notepad++ is correct (e.g. C:\Program Files (x86)) and I also changed the shortcut to n instead of n.
Then double click to add to your registry.