When I load GVim from the Cygwin command line or when I'm not connected to the office network (mapped to U:/) it loads instantaneously. It takes a good minute or so to open when I'm on the network. What is going on here?
You probably need to set your $HOME directory to something other than U:/. Create a $HOME environment variable for Windows that points to My Documents or whatever and it won't try and use U:/. You may need to log-off/log-in to pick up the changes.
You should check what your $HOME directory is mapped to in each case. I bet that it is different depending on if you are connected to the network or not.
Do you have any custom .vimrc or other config files read at startup? If nothing else, vim will query your $HOME directory to look for such files. If your network is slow, it could cause your problem.
See ":help startup" inside vim for more details on the startup process.
It might also be a good idea to set the directory and backupdir options so they prefer a local directory. Something along the lines of
set backupdir^=C:/Temp
set directory^=C:/Temp//
The ^= syntax puts the directory at the start of the list of directories for each option. The trailing // for directory tells Vim to encode the full path to the file being edited in the swapfile's name. This allows for swapfiles to be created in one directory when editing multiple files with the same name, but different paths.
Related
With more and more programs installed on my computer, I am tired of seeing lots of dotfiles while I have to access them often. For some reason I won't hide dotfiles when browsing files. Is there a way to move them to a better place I want them to stay (e.g. ~/.config/$PROGCONF) without affecting programs while running?
Symlinks still leave file symbols, which is far from my expectation. I expect that operations like listdirs() won't show the files while opening them uses a redirection.
"For some reason it won't hide dotfiles when browsing files.":
That depends on the file manager you use. nautilus hides it by default and most file managers have an option to "show/hide hidden files". The ls command by default omits out hidden files (files starting with a dot). It lists all files with the option -a.
"Is there a way to move them to a better place":
Programs which have support for "XDG user directories" can store their config files in `~/.config/$PROGRAM_NAME/. If the program doesn't support that and expects the config file to be present in the home directory, there is little you can do (Maybe you can give us a list of what programs' config files you want to move). The process differs for each program.
Let me give an example with vim. Its config file is ~/.vimrc. Lets say you move the file to ~/.config/vim/.vimrc. You can make vim read the file by launching vim using the following command.
vim -u ~/.config/vim/.vimrc
You can modify the .desktop entry or create a new shell script to launch vim using the above command and put it inside /usr/local/bin/ or create shell functions / aliases. You can read more about changing vim's config file location in this SO question.
This arch wiki article has application specific information.
"without affecting programs while running":
It depends on a few factors namely the file system used, the program we are dealing with and so on.
Generally, deleting / moving files only unlinks the file name from an inode and programs read / write files using inodes. Read more here. And most programs read the config file at the start, load the values into memory. They rarely read the config files again. So, if you move your config file while the program is running (assuming the program supports config in both places), you won't see a difference until the program is restarted.
"I expect that operations like listdirs() won't show the files"
I am assuming you are talking about os.listdir() in python. If files are present, os.listdir() will list them, there is little you can change about that. But you can write custom functions to omit out the hidden files from being listed.
This SO question can help with that.
I'm wondering whether I can change 'colorscheme' to point to different directory.(rather than default) since I want to set my all my color schemes in vimrc file with my own directory.
In My MacOS, the default directory are in /usr/local/share/vim/vim80/colors
You are supposed to put colorschemes in ~/.vim/colors/.
Create that directory if it doesn't exist and stay away from /usr/local/share/vim/.
As #romainl pointed out, keep your hands off the system-wide directories. Just because Vim's default stuff gets installed under /usr/local/share/vim, this doesn't mean that your personal extensions and customizations should be in there as well. You'll provoke problems when upgrading or reinstalling Vim.
If the suggested default location (~/.vim/colors/) doesn't suit you, you can add additional directories to 'runtimepath' (early enough; i.e. in your ~/.vimrc). For colorschemes, the direct directory has to be colors, though. To work around that, you'd have to use filesystem links to create an alias.
I'm new to Perforce, need to work in command line, i'm so confused why all the commands on the tutorial websites all write like $p4 command, but I have to add the port every time when try to trigger that command, for an example, for $p4 sync, i have to type $p4 -p myhost:myport sync every time even after I logged in, if i missed the host and port, like if i just typing $p4 sync, the program will just hang in there... anyone can provide some suggestions?
There are a couple ways to make myhost:1666 the default. These are, in the order of decreasing precedence:
command-line options (like -p myhost:1666)
the P4CONFIG file
environment variables (%P4PORT%)
on Windows, the registry (use p4 set P4PORT=myhost:1666 to set it)
See the docs here.
In your case, I guess the registry (if on Windows) or the env. var. (if on Linux) is the best option.
Type:
p4 set P4PORT=myhost:myport
From that point on, "myhost:myport" will be used as the P4PORT when you run commands.
If you use multiple workspaces/servers, P4CONFIG files make it easy to have different sets of settings (based on your working directory), but for a single value, "p4 set" is a nice persistent one-shot method.
I want gnuplot to load an initialization file on startup. According to the manual, in Windows systems, it is called GNUPLOT.INI. (It shouldn't matter if I call it gnuplot.ini, right? I tried both, though.)
According to answers like here: gnuplot configuration file
I'm supposed to put a file called gnuplot.ini in my HOME directory, and then everything should work. (Alternatively, see the manual at http://www.gnuplot.info/docs_4.6/gnuplot.pdf, page 38.)
1) What is a "HOME" directory in Windows? Where is it in Windows 7?
2) The manual mentions that I could change this default directory by changing the environment variable GNUPLOT. But it doesn't explain how to change environment variables in gnuplot, or even really what they are.
Basically, everyone refers me to the section in the manual, which I don't understand.
Furthermore, also from the manual: "When gnuplot is run, it first looks for a system-wide initialization file named gnuplotrc. The location of this file is determined when the program is built and is reported by show loadpath."
If I run "show loadpath" in gnuplot, it says:
"loadpath from GNUPLOT_LIB is "C:\Program Files (x86)\gnuplot\demo"
gnuplotrc is read from share"
1) There is no file called gnuplotrc in that folder.
2) No file ending is specified. Does the manual refer to x.gnuplotrc or gnuplotrc.x or something else?
3) Also, what does "read from share" mean?
I appreciate your help.
I finally managed to solve the problem above. Maybe this solution can help someone else. So:
1) The HOME directory of your OS can be found here: http://en.wikipedia.org/wiki/Home_directory.
2) Even after putting a file called gnuplot.ini into my HOME directory, gnuplot didn't consistently initialize with it. In fact, it only did it once, and I still don't know why.
3) The cryptic message "gnuplotrc is read from share" actually means that gnuplot searches for the initialization file "gnuplotrc" (without file ending) in the folder (install directory of gnuplot) \ share .
4) Placing the file called "gnuplotrc" into the folder (install directory of gnuplot) \share\ finally worked. Now gnuplot initializes from this file every time I restart gnuplot.
An update:
Other non-Linux users may be as unaware of what the "home directory" of an OS is as myself. Wikipedia finally gave me the answer here: http://en.wikipedia.org/wiki/Home_directory
So the Home directory in Windows 7 was (root) \Users\ (username).
Then I placed my gnuplot.ini in that folder, and when I started wgnuplot.exe and typed "plot sin(x)", it finally had the settings I wanted.
I thought I had finally solved my problem. I closed gnuplot. Then I changed a line in gnuplot.ini, saved it, and afterwards started gnuplot again. gnuplot was wholly unaffected by my change in gnuplot.ini. (I verified this with the option "show all".)
So as far as I can tell, I managed to correctly initialize gnuplot ONCE, but it doesn't properly intialize via gnuplot.ini every time?! What gives?
On windows, add the following line at the end of gnuplotrc:
load "C:\\Users\\username\\GNUPLOT.INI"
(replacing "username" with your user name, and with doubled backslashes !)
then you can put your GNUPLOT.INI file in your home directory
I keep hearing this is a path issue with cygwin. It is prevent emacs from working within my cygwin. When I execute find on the cli (not bash/cygwin) I get the same error not matter what I type. I've read this is a problem with path creation within cygwin and that it should be prepending itself to the path. As you can see it is doing that.
Here is my /etc/profile
PATH=/usr/local/bin:/usr/bin:/bin:$PATH
export PATH
Problem is that as everyone else stated, emacs is using find.exe provided by windows. To change this, you need to change your %userprofile%.emacs file.
As nobody else states (even faq!), this file is not created automatically anymore. Go into Options > Save options the mini-buffer (one line at the bottom of emacs) will tell you where the file is being written to.
Go in there and add this line (You've installed cygwin at c:\cygwin, right?):
(setq find-program "C:\\cygwin\\bin\\find.exe")
You may need to restart Emacs for this to take effect.
Just add this line to you .profile
alias find='/cygdrive/c/cygwin/bin/find.exe'
Oddly-enough, I needed to use
(setq find-program "/bin/find.exe")
instead.
But thanks for the suggestion Drew.
Adding a setq find-program [msys2 or git path] in my init file, as suggested (I tried different forms), didn't work for me. "C:\Windows\System32\find.exe" is first in the path if I type where find in eshell and I didn't find how to remove it, only how to add others, which doesn't solve the problem.
So I share here the more radical, but working (also in Powershell), solution I used: replacing the find.exe in "C:\Windows\System32" with the one from "C:\msys64\usr\bin". I kept the old file in case, but so far so good. You need to change the permissions for this operation (see here how to gain full control, but I suggest only applying this to the file, not the whole folder, and putting things back after ;)).