I have been using TextPad for years and I am happy with it except for one issue. I use it to monitor log files that are updated in near real time. Every time the log file is updated TextPad prompts me to reload it. Essentially I want to force the yes button at all times and never see the prompt. I submitted a change request at their site, but I was wondering if there were any alternatives to TextPad that would allow me to see the file loading in real time with out a prompt to reload it.
You can configure Textpad to reload the file without prompting.
Go to Configure->Preferences...->File, then select the Auto-Reload option under When files are modified by another process.
One point to note, if the cursor is at the end of the file, TextPad will keep it at the end as updates are made so the file will scroll nicely. If the cursor is elsewhere in the file, it won't scroll.
Related
Hi I am trying to update one of my remote repositories. When I use commit in git bash it shows that a SWP file already exists and askes me if I want to (R)ead only the file (E)dit (D)elete. I tried editing the file, but I cannot save the changes and therefore cannot commit my changes. Any idea what is going on.
EDIT:
It's working now thanks to those that helped. In terms of the question I will try to only show the relevant information when asking questions in the future.
When you edit a file, Vim stores your changes in a "swap file" so that you can recover your work if Vim's process is killed before you could save. This can be caused by something as problematic as a system crash or, simply, by closing your terminal window while Vim is running.
If Vim is quitted "normally", it deletes the swap file it created.
If it is not, the swap file is left behind and, the next time you open the same file, Vim will notice the presence of the swap file and offer you the possibility to recover the work that you "lost" the last time Vim quitted "abnormally".
That is the interactive screen you get with the "(R)ead only the file (E)dit (D)elete" prompt.
Now, when you are starting out with stuff like Git, Vim, the command line, etc. it may happen quite often that you find yourself in an uncomfortable situation, not knowing exactly what to do to fix it. This is frankly quite normal at this stage. In those situations, closing the terminal window might seem like a good first step in going back to a more comfortable situation to start again. In some cases, however, doing so might leave a trail of hidden files and broken states that might make it harder than you hoped to get to that comfortable situation.
When you do $ git commit, Git populates a specific temporary file located in your local .git directory:
.git/COMMIT_EDITMSG
with some text describing the commit you are about to make, and opens that file with your designated editor, which is the dreaded Vim by default.
When you start editing the file, Vim creates a swap file. If you insert your commit message, write the file, and quit Vim normally, the swap file is deleted and you won't ever be prompted about it. If you close the terminal window before writing the file, the swap file stays behind and Vim will prompt you about it the next time you try to make a commit.
From there you have quite a few options…
Go into your .git directory and delete the swap file(s) manually. They should be named .git/.COMMIT_EDITMSG.swp (or .swo, .swn, etc. see :help swap-files in Vim). This should give you a clean state for the next time you do $ git commit.
Don't close your terminal window when faced with a problem. Instead, try to analyze what went wrong and look for proper ways to fix it. If you have to close the terminal window, look for stray swap files just in case.
Learn Vim's basics so that you don't have to close the terminal window when you mess up your commits. Try $ vimtutor.
Tell Git to use a text editor you are more familiar with. Search Stack Overflow, I am sure there are dozens of Q/As about that.
Configure Vim to never create swap files. You can do it in Vim's configuration file:
# in $HOME/.vimrc
set noswapfile
This won't tell it to ignore existing swap files, though, so you might want to delete them manually anyway.
Use a graphical Git client instead of the CLI.
I have a long standing issue with P4Merge. When I diff a workspace file with the version in the depot and then proceed to edit the workspace file, within P4Merge, after every edit and save the cursor jumps back to the top of the file. This force me to navigate back to the last diff I was at.
So the steps are something like:
Diff workspace file with depot version
Edit workspace file by pressing Edit File (in right pane) button
Edit the workspace file
Save the file (ctrl+s)
The result after step 4 is that you are automatically scrolled back to the first change in the file and have to track back the change you were previously focused on.
Is there any way to prevent this from happening? I.e. I just want to stay at the current line and be able to proceed to go to the next or previous change from there.
No, there is not a way to prevent this -- sounds like a bug more than anything.
As a workaround you can configure other merge tools to use with Perforce. Since you're on Windows my personal recommendation would be P4WinMerge (the merge tool that used to be bundled with P4Win -- I always found it a lot less "jittery" than the newer one so I never bothered to switch over), which you can still download thanks to the Wayback Machine:
http://web.archive.org/web/20160703111618/http://filehost.perforce.com/perforce/r07.2/bin.ntx86/p4winst.exe
What needs to be done?
I need to make a connection to the remote machine through UNIX, go to the shared drive, open an excel file, save it and close it. This needs to written in an script.
The file contains macros so they needs to be opened manually on daily basis, save it and close it. We plan to write a script that would run on daily basis and refresh this file automatically.
Where am i facing the issue?
Making a connection to the remote machine is done, after that i run certains commands:
1. Open the command prompt
2. cd the file path
3. Open the File
Now this is where the issue starts
How to save the file automatically?
How to close that file?
I tried using the taskill option and it almost worked but it gives out the popup of Do you want to save the file and i dont know how to provide output to that popup through command prompt.
Let me know if you have any idea on how to move ahead on this.
A bit hackish, but xdotool, a program which simulates mouse clicks and keyboard presses could be used. If Windows is being used, then see this question for tools which simulate mouse clicks and keyboard presses.
Have you tried SendKeys?
That may help.
This is my issue with Vim: you have it open for a couple of days. You're ready to close vim. You don't necessarily want to save all files... you want to skip any files which don't have modified changes, and you want to be left (or be asked) what you want to do with the remaining buffers with unmodified changes…
For anyone that has used Photoshop, this is very familiar… you use it for a week, and when you close Photoshop, it is really trying to close the application, and skips all files which haven't been touched, let's you chose what you want to do with the remaining files, and then closes itself.
It seems like every time I close Vim, I have to go through this circus of doing :qa, then running into a file, doing :bd!, then doing :qa again, run into a file I want, :w, and it's just a huge pain. There has to be a better way of doing this.
If it isn't already obvious… I have :set hidden in my .vimrc.
How about
:confirm qa
It asks you for each modified file whether to save or abandon it (or all remaining). This is the same behavior that GVIM exhibits when you close it via the X in the window title.
does :xa! solve your problem ?
:xa[ll]! Write all changed buffers, even the ones that are readonly,
and exit Vim. If there are buffers without a file name or
which cannot be written for another reason, Vim will not quit.
I was able to find the plugin BufOnly, and then with the help of someone else on StackOverflow, I got an answer that satisfies me:
https://stackoverflow.com/a/14690570/240287
Is it possible to automatically remove the swapfile when the file is saved, and automatically create it again when the file is changed?
And is this a good idea?
EDIT:
The reason for wanting to to this is so that I don't have to go through the diff process for files that had no changes after last save if the computer suddenly ran out of power or crashed.
The diff process referred to is; first open the file read only, saving it under a different filename, vimdiffing it and in the end delete it.
It doesn't happen often, but is just as annoying when it does.
Is it possible to automatically remove the swapfile when the file is saved, and automatically create it again when the file is changed?
And is this a good idea?
Deletion and creation of a file are relatively slow operations. It makes sense to keep the swap file in case if one going to keep editing. Or why else one would keep the VIM running?
Additionally VIM uses the swap file to detect attempts to edit the same file from different VIM instances.
All in all, I think it is a bad idea to try to remove the file.
P.S. Worth noting that when VIM is started in read-only mode as view or vim -R, it doesn't create the swap file. But if once you change the file, the swap file is going to be created.
I am assuming you have a long running vim session like I do (my first window in my screen session is always vim and it usually lives for several days, almost for the entire duration of the uptime). I think the swapfile is not kept around, if you simply close the buffer, unless you have the 'hidden' setting. What happens is that when you have the 'hidden' turned on for buffers, vim tries to keep all the undo history of the buffer, and so has to have the swapfile accessible, in case you come back to the buffer and start undoing changes. As for me, I don't like this feature and keep it turned off (which is the default) and so only have to deal with the swapfiles for those buffers that I actively have loaded in a vim window at the time of crash. Since I have macros that autosave my session every 5min., and since I also disable the Vim's default swapfile detected prompt, restarting my session after a crash is fairly painless.