How to remove custom vim syntax and filetype settings for a specific - apache

I somehow botched the default syntax highlighting and filetype recognition for my apache httpd-vhosts.conf file, such that every time I open it in vim, the syntax and filetype are both set to "conf". All of the other files in the ../conf.d/ directory are recognized properly, i.e. as syntax and filetype both set to "apache". I've tried the following:
manually setting both in vim, i.e.
:set syntax=apache, :set filteype=apache
This works for the session, but they both reset back to "conf" when the file is reopened
Looking for the ~/.vimrc
I don't seem to have one, since I typically edit this file as root
yum remove and reinstall of vim
no change.
I know that there are a lot of posts regarding similar issues with vim syntax and filetype problems, but I cannot figure out how to resolve mine. My guess is that there is a mapping somewhere that says this one particular file should be recognized as a "conf", but that's all I've got. tia.
edit: to clarify, what I would like to know is how this one file got "stuck" on the "conf" syntax and filetype, whereas all of the other .conf files are "apache" syntax and filetype.

I would recommend using a modeline. Put this at the top of your file:
# vim: ft=apache
If you do not have a .vimrc file, you can create one. Keep in mind that each user has a separate .vimrc in their home folder. You can also look for the system default vimrc (without a dot) located in your vim installation folder. To find out where that is, type :echo $VIM in vim.
If you do create a new .vimrc for your user, you can set all .conf files to have apache highlighting as follows:
au BufRead,BufNewFile *.conf set filetype=apache

Related

How can i reset the httpd.conf file

Does anyone know how I can find the httpd.conf file because I may have accidentally changed some things inside and i can't Ctrl+z because I opened it in notepad file instead of notepad++. i would reinstall the whole wampserver but I have tons of data and files to take the risk. I just need the original file of httpd.conf of Apache 2.4.9. I couldn't find it online.
Use a program such as 7-zip to extract all the files from the wamp installer. Go find the httpd.conf file and copy it over. Also you could just install it temporarily on another windows computer to retrieve the file.
It's good practice to always make a backup of conf files before modifying them, they are specific to your release of apache and the environment it's meant to be used in.

Force IntelliJ to use another Home Directory?

I have read this... it does not answer the question.
I would like to have IntelliJ use another location for all of my project files. Currently, it goes to c:\users\ as a default project location.
I want to change that to c:\git.
I tried to change the "Start in" link properties, to no avail.
I don't want to force all of the configuration (ie: the .IdeaIC15 folder) to be relocated, I just want it to go to c:\git when I click "Open project".
To change the directory where project files are located to C:\git:
Select Help->Edit Custom VM Options...
Add the following line to the end of the file that comes up in the editor (*):
-Duser.home=C:\git
Restart IntelliJ.
(*) The file that comes up in the editor will either be idea64.exe.vmoptions or idea.exe.vmoptions.
Notes:
This will update/create a .vmoptions file in your config directory. It does not modify the vmoptions file in your install directory.
The above steps do not change the default directory that is used
when cloning git repositories. This is the directory that is used in
the File->New->Project from Version Control->Git window. You
still need to set that directory to C:\git and clone one remote repo
into C:\git. Once you have done that IntelliJ remembers the directory and
uses it for subsequent clones.
https://intellij-support.jetbrains.com/hc/en-us/articles/207240985-Changing-IDE-default-directories-used-for-config-plugins-and-caches-storage
Locations can be changed by editing the following file:
IDE_HOME\bin\idea.properties
Follow the comments in idea.properties file to change the defaults, make sure to un-comment the lines defining these properties:
idea.config.path
idea.system.path
idea.plugins.path
idea.log.path

Vim: Sudo Edit Breaks Apache Syntax Highlighting

Sudo Edit (sudo -e) allows unprivileged users to edit files securely. To achieve this, it makes a temporary copy of a file to edit and then copies it over when editing is done.
When I'm editing an apache file (eg, /etc/apache2/sites-enabled/mysite.com), sudoedit vim can't figure out that it should use Apache syntax highlighting, so I have to manually :set syntax=apache. I suspect that Vim's rule for syntax highlighting relies on the full path of the file, and since sudoedit changes the file to something like /var/tmp/mysiteRANDOMCHARS.com, it loses that path information.
Is there any way for me to automatically tell Vim that it should use apache syntax highlighting?
Thanks!
This sounds like one of the rare use-cases for the vi modeline feature:
In your .vimrc:
set modeline
And in your Apache config file, somewhere at the top or the bottom:
# vi: syntax=apache
See /usr/share/vim/vim7x/filetype.vim for how Vim determines that a file is an apache file.
In my config, using $ vim or $ sudo -e makes no difference as the .com extension is treated as dcl anyway.
I don't see a smart and solid way to workaround that beside overriding the .com autocommand in your ~/.vimrc:
au BufNewFile,BufRead *.com set ft=apache

Trying to create .htaccess file using ftp doesn't work

I want to create a .htaccess file in a specific directory. I'm using Notepad++ and their plug-in for FTP (NppFTP). I'm able to create any other files and see them in the folder but when I try to create a .htaccess I don't see that file in the directory. I get no errors, it is like nothing happened.
I tried to create this file using an FTP program and it showed the file and right away it disappeared. My guess it is because this is a special file used by the system and prefixed by a (.)
What is a way to edit that file?
This is probably because your ".htaccess" file is a hidden file and your system is set up to no display hidden files.
Have a look in your Notepad++ settings if there's an option to make hidden files visible/unhide.
In addition to that check the windows folder options for that option!
switch on showing hidden files in your ftp client

How to unload all the plugins from vim and change VIMRUNTIME?

I have an account at my hosting providers server and I can't install my own copy of vim.
So the only personalization I can make is editing .vimrc in my account, but it won't suffice
What I'd Like to do is:
on startup I'd like to unload all the plugins and loaded stuff, and tell vim to use other folder as its' runtime.
Any idea how to aproach it?
You can start your vim with -u NONE. From the man-page:
-u {vimrc} Use the commands in the file {vimrc} for initializations.
All the other initializations are skipped. Use this to
edit a special kind of files. It can also be used to skip
all initializations by giving the name "NONE". See ":help
initialization" within vim for more details.
For changing $VIMRUNTIME at runtime, use
:let $VIMRUNTIME = "/new/path/"
To answer your question: you just need to set the runtimepath option in your .vimrc file, because your .vimrc is read before any plugins are loaded.
However, the default runtimepath value usually includes the ~/.vim folder (use :set runtimepath? to check), so you should be able to add whatever plugins you need to the ~/.vim folder. Also you can prevent many plugins from loading by adding a line such as :let g:loaded_<plugin name> = 1 to your .vimrc file. Check the help docs for each plugin to find out how to do this.