File with saved states in vim - plugins

I'd like to create a file and edit it with vim editor,
then save a file and after saving a file always have a possibility
to decide that this is a State X (where X = 1, 2, 3, ...) of my editing work.
When I open the file later, I'd like to use commands like
gotostate 7
to see the file in state 7.
That's all.
Is there such a plugin or other possibility for the vim editor?
I try to avoid using git or other source control tools, because I only
need these two quick features.

Try my histwin plugin. It can tag certain undo states and go back to them if needed.

Related

Any way to have workspace/folder settings ONLY apply to files in that workspace/folder and not random files outside the workspace?

I know about workspace settings. My issue is that workspace settings also apply to any files that are opened not in that workspace. Example:
"editor.formatOnSave": true // put this in some workspace settings.
open a file not in that workspace (maybe in a different project) in the same window. This happens when I type $ code ~/someFile.txt
When I save that file, it gets formatted when it shouldn't.
Any workarounds?
Specifically for saving a file without formatting, try new command for saving without formatting. Just added in v1.28.0:
The new command Save without Formatting
(workbench.action.files.saveWithoutFormatting) can be used to save a
file without triggering any of the save participants (for example,
formatters, remove trailing whitespace, final newline). The default
keybinding is Ctrl+K S. This is useful when editing files outside your
normal projects, which may have different formatting conventions.

How to set default file type to be All Files(*.*) in VS Code?

Now my default file type of Visual Studio Code is Plain Text.
If I save a new file with name like a.in, it will save as a.in.txt. I have to change the dropdown to All Files.
I find the same problems in github: 1, 2. However, they seem not solve my problem.
This is not possible in the general case in VSCode.
The issue is that you cannot assign "no extension" to a language, and as per the links you mentioned, the All Files (*.*) option is disabled by upstream (electron).
Therefore, you will either have to remove the extension manually, OR you can create the file first (using the terminal, Explorer, an extension, etc.) and then open that existing file.
There is a way to change the default extension (but not to All Files)
Add the following line to your settings.json
"files.defaultLanguage": "<language>",
Replace <language> with the language of your choice.
Now, whenever you make a new a file, the default file language will be <language>.
A special value for <language> is ${activeEditorLanguage} which is the language of the file last opened (useful if, say, you copy a piece of code from one file to save as another).
Unfortunately, this does not fully answer the question, but provides a partial solution.

setting default syntax for sublime doesn't work

Whenever I open a .m file the default syntax is objective-c but I want to change that to matlab. So when I open a .m file I go to
view -> syntax -> open all with current extension as..
and choose matlab. After that if I open another .m file the default syntax is matlab. But if I close sublime and open it again the default syntax is back to objective-c.
I added objective-c to ignore syntax list but now it opens .m files as plain text. Is there another way to set default syntax for a file extension?
In sublime3, view -> syntax -> open all with current extension as.. works if you close then open sublime.
I'm not sure why Sublime is doing this, but there's a way around it. Since you're using ST2, it's quite easy. Select Preferences -> Browse Packages... to open your Packages folder, and open the Objective-C subfolder. Open Objective-C.tmLanguage in Sublime as an XML file, and comment out (or remove entirely) Line 7:
<string>m</string>
Save the file and close it. Next, open Objective-C++.tmLanguage and do the same thing to Line 8:
<string>M</string>
Save and close that file as well. Finally, just to make sure your Open all with current extension as... command worked, go to Packages/User and check for the existence of a file called MATLAB.sublime-settings. Open it as a JSON file, and double-check that its contents are as follows:
{
"extensions":
[
"m"
]
}
If for some reason the file doesn't exist, create it with the above contents and save it. You should now be able to open any .m file and have the syntax automatically set to MATLAB.
Note for Sublime Text 3 users:
ST3 does not store its default packages in Packages anymore, instead they're in the Installed Packages folder (its location varies by OS and type of install) as zipped .sublime-package files. To access the contents, install #skuroda's PackageResourceViewer plugin to seamlessly access the contents of these files. Once installed, open the Command Palette (CtrlShiftP on Windows/Linux, ⌘ShiftP on OS X) and type prv to bring up the PackageResourceViewer options. Select Extract Package, scroll down to Objective-C, and hit Enter. You can now follow the directions above for opening the Packages/Objective-C folder and editing the .tmLanguage files. The Packages/User directory is a regular directory, so you don't need to extract it to verify the contents of MATLAB.sublime-settings.
I think why this is happening, at least in Sublime 3 (v3.2.1). After using PackageResourceViewer: Extract Package to extract Matlab package, I found that in Matlab.sublime-syntax in Line 6:
- matlab
As .matlab is not an extension for matlab functions and scripts, after I changed it to - m, Sublime shows .m files in MATLAB syntax.

How to see(mark) lines, that are changed comparing to the project repo, in emacs?

Is there any way to current working copy modifications in-place by marking somehow all modified lines. For example NetBeans has the following feature:
In MSVC also, smth like this (not for VCS, but it looks alike):
Green Bars in Visual Studio 2010
I use vc-mode in Emacs to work with my versioned project. It can compute the full diff ( vc-diff) but it is inconvinient: to browse the diff separately. I want, to know all changed lines, during file-editing sesstion. Is it implemented in some version-control plugin?
The diff-hl extension does this in a VCS-agnostic way. There also exist other tools like git-gutter which are more focused on a specific VCS.

Is there a way to copy code from eclipse including ine numbers

I am writing a little bit of documentation and code explanation. I would like to copy code from eclipse including line numbers, so that it becomes easier to reference the code in the text.
Is there any way to do this in eclipse or some other IDE, editor?
Since Eclipse 3.4 and bug 19602, you will print the line numbers if you have activated them on the Eclipse editor.
alt text http://img706.imageshack.us/img706/7605/eclipseshowlines.png
Printing a source will give you:
alt text http://img341.imageshack.us/img341/9899/eclipseprint.png
You can do it by printing a PDF of source file, then copying source with line numbers from the PDF document.
It works for me with eclipse PDT + CutePDF, it should also work with Acrobat PDF printer
Another not-so-clean work-around to achieve this. This is specific to the Subversive plug-in.
3 steps to follow:
Delete the piece of code you need to copy and save the source file.
Right click the file and chose option Team -> Create Patch.. and save it to a file, say copy.patch
Undo (Ctrl + Z) the changes to revert the deletion done in step 1 and save the source file again.
Open the patch file and use the contents.
This also includes the file-name (if desired) along with the line number and retains the indentation.