How does vi editor remember current line of the previous file - editor

Suppose I am reading a file in vi editor. I am at line number 50 and I quit. After some time I reopen the file in vi editor. I notice that the cursor is at the same line where I was before closing the file.
How does VI editor remember this?

Don't know about plain old vi. vim, however, saves the current line number of the files you edit with it in a file called .viminfo in your home directory. At least, that's what it does in Linux.

You can see this behavior in many programs. You close your IDE and when you reopen it, it opens your last project. Your can kill your firefox and when you reopen it, you get all your pages reloaded.
It is simple, they save it somewhere for themselves.
One of the common places to save these information in Windows-y applications is the registry. You can run regedt32 in your windows and see all those data there. With Linux-y applications, it is common to create a hidden file in your home (~). You can go to your home directory in your Linux and open file .bash_history and see your old bash commands that you can access with the Up Arrow key
Vi in particular? Definitely has a file somewhere.

Related

Stop renaming when copy/pasting

If I Ctrl-A, Ctrl-C a file (or copy the entire contents of a file), call it foo.txt, then do a Ctrl-A, Ctrl-V into a different file (replace the entire contents of that file with what I copied), call it bar.txt, VSCode will automatically create a new file called "foo-1.txt", with the pasted code in it, leaving bar.txt untouched. This is incredibly irritating, because this maneuver is always intentional for me. I'm assuming it's some kind of feature to prevent people from accidentally overwriting a file when they just want to make a copy of one. Thus, I suspect there is a setting to change this behavior. Does anyone know what that setting is?

How to view html output in Notepad++?

How do I view my Code output in Notepad++ as a webpage or something similiar?
I have built something but I can't find a button or something like that in Notepad to view it as a webpage or something similiar.
If it is a webpage written in html:
just go where you saved it and click it.
If it is in php:
You will need a web server, save the file in the www directory. and access it like this:
http://localhost/yourfile.php
Simply, save your file with the correct extension in this case html, then click run , in the run menu click launch in, (in whichever is your browser) in my case, chrome.And it should work(:
Add this plugin in Notepad++: Preview HTML but it opens only in IE
To setup Notepad++ for testing your markup or code there are a few things to consider.
When Notepad++ launches do you want a test document opened by default?
What language do you prefer the document to be opened as?
What browser do you wish to test your test file in?
Do we want a shortcut to open test in browser?
If you do not have your local environment setup to run server-side scripts you will be limited to what the browser supports.
In my example setup I will be using .php as my language. There are some variables, but I've chosen what I believe best suit my needs. I'm also using a windows machine.
Create a new file in C:\Program Files (x86)\Notepad++ (or wherever) as php.php (or whatever). This will be the document we keep open and will remain open so long as we never close it.
In Notepad++ go to Settings > Preferences > New Document
In the bottom left there is a drop-down. Select your language (php in my case).
Open php.php in Notepad++.
Go to Run > Modify Shortcut / Delete Command and locate your desired browser (note: this may not work as expected in some browsers i.e. Internet Explorer, go figure).
Create a custom shortcut so your document can be launched to test (unless you are happy with what is already setup).
This will effectively keep your default file open in Notepad++ every time it is launched in your preferred language and allow you to quickly test your markup.
Cntrl + Alt + Shift + I(Alphabet if you want to open in Internet explorer)
I hope this will work.

XNA XACT Where do I place the .xap file?

I've been trying and looking on the internet for ages now, but where exactly do you place the .xap file? I've read that you should place the file in your content folder, but I have a content folder located in;
TheGame\TheGameContent\
But I also have;
TheGame\TheGame\bin\x86\Debug\Content
Which is it? If I add the .xap file to the latter it recognises it when I refresh the solution explorer, but the former does not.
However, if I add the .xap to the latter it gives an error saying it can't find it when I use the following line of code to access it;
ae = new AudioEngine(#"Content\game_content\audio\xact\Win\xna xact file.xgs");
This line apparently gets the \x86\debug path.
Any advice?
Thanks
Visual Studio, go to the Solution Explorer and right click the Content solution (i.e. "TheGameContent (Content)") or a folder in that section and select Add > Existing Item... and select the .xap file. If it isn't in there, it will copy the file into TheGame/Content, but it will also make it ready to load and work within your project.
Basically it's the same as adding an image file to an XNA project, and it will save you all that trouble you are having.

Sublime tmLanguage file and sublime-settings file

I have two questions about the Sublime Text Editor 2.
My 1st question is, I have several different .tmLanguage files ( ex: Console.tmLanguage) or .tmbundle (Ex: Handlebars.tmbundle) saved in the Packages/User folder. But it won't detect by the Sublime when the initial loads. If I move them under the Package folder, sublime will see them as a color syntax setting.
I thought everything should store inside the User Folder so that it won't be erased when updates or any other possible overwritten situations. What can I do to make sublime see those file when they are stored inside User folder.
I have moved those file several different locations. When I initialized sublime, I received this error " Error loading syntax file "Packages/User/Console.tmLanguage": Error parsing plist xml: Failed to open file In file "Packages/User/Console.tmLanguage" "
I did research about this error, one of the file maybe use that color setting has been cached. I could not remember that which one is using it. How can I clear all the cache to get rid of this initial loading error?
My 2nd question is, I am sharing the Preferences.sublime-settings file for Windows and Mac via Dropbox. But Mac has high resolution, window has not. Mac need font size of 21 to show the same size on windows( font-size: 14 ). Every time When I sync the setting, I have to switch this value from setting file. So I created two different files, Preferences (OSX).sublime-settings and Preferences (Windows).sublime-settings to hold the font-size setting only. It seems to work on windows, but Mac just ignore that file, no font size is being applied at all. It is so tiny that I could not see. Any ideas how could I fix that?
I solved the 2nd problem (i.e. eliminating display differences) as follows:
Create the Default folder that will "mirror" Default.sublime-package:
Window 7:
%USERPROFILE%\AppData\Roaming\Sublime Text 3\Packages\Default
Mac OS X:
~/Library/Application Support/Sublime Text 3/Packages/Default
Extract two files from Default.sublime-package into this folder:
Preferences (OSX).sublime-settings
Preferences (Windows).sublime-settings
I used the following settings to get the same look and feel on Windows 7/XP and MacBook with Retina:
Windows:
{
"font_face": "Consolas",
"font_size": 11,
"line_padding_top": -1
}
Mac OS X:
{
"font_face": "Consolas",
"font_size": 14,
"line_padding_bottom": -1,
}
According to this post in the Sublime Text forums, you need to remove an existing .tmlanguage file from the /Packages folder AND the .tmlanguage.cache file and relaunch Sublime Text to confirm that the program is no longer reading them. Then you can put your .tmlanguage or .tmbundle file in /Packages/User.
It's not clear to me that the error message you got was indicating a problem with the location and not a problem with the plist file itself. You might try using one of the free plist editors to make sure the structure of the file itself is OK.
Good luck on the Mac/Windows display difference. I have no idea how you might solve that.
For windows delete - Delete all the sublime files from
C:\Users\\AppData\Roaming

Zope external editor with upload-on-save (Notepad++ prefered)

We are doing webdevelopment with Zope.
The web-editor is just horrible. No syntax highlighting, no in-text-tabs, nothing you can work with.
I installed Zope External Editor. It is now possible that I click the "use external editor" button on every element and it creates a temporary file and opens it in Notepad++, awesome.
But one important thing fail: it doesn't save back to Zope when I save the file. I still have to copy the code back to Zope manually.
I also searched for syntax highlighting extension for chrome/firefox at least to highlight the code (but I prefer Notepad++ with upload-on-save).
Can someone help me with that?
Did you also download the ExternalEditor Helper application?
Your browser should open the helper application, which will then open the editor (which you can specify in the configuration, see last point below). This is important because the helper application is responsible for sending changes back to Zope, which it does by keeping an open WebDAV session while you are editing.
You should download the latest helper app here: http://plone.org/products/zope-externaleditor-client
From that page:
Under Windows: Install the windows binary executable.
Open your page in your web browser and click on the link 'edit with external application'
Associate the file with Zope External Editor and make it permanent (first time only)
The file is opened in the editor defined in windows registry with certain editors, a message will ask whether the edition is terminated or not;
keep it until you closed you file and say yes.
If you want to change your default editor for certain content types , or if you want to add proxy parameters, open Zope External Edit in your program files menu and change your local user configuration.
The best option is to not develop Zope applications through-the-web anymore.
Use proper python packages, and you'll get to use your favourite tools without difficult integration with the server.

Resources