Questions tagged [filetype]

Questions about making Vim to have a defined behavior according the type of the edited file.

Filter by
Sorted by
Tagged with
8
votes
1answer
211 views

The first and last 5 lines of a file? Use for file specific spell ignore list?

Rumor has reached me that it is possible to place vim commands in the first five, or in the last five lines of a a file. But, I could not find this in Google. Any leads would be appreciated. I ...
3
votes
1answer
121 views

How to set filetype to PKGBUILD when the filename is PKGBUILD?

I want vim to automatically set the filetype to PKGBUILD when I am editing files that are named "PKGBUILD". How can I accomplish this?
3
votes
1answer
152 views

Automate running SQL filetype scripts when opening a PHP file

When I open a PHP file in Vim I want Vim to provide SQL assistance as well as all the PHP assistance. From :h sql-completion-filetypes: This can be enabled easily with the following steps (assuming ...
1
vote
0answers
58 views

filetype plugin not loaded on files opened with edit command

I've turned on filetype indent and plugins on with the following in my vimrc file: filetype indent plugin on Everything is fine when I open a file from terminal, but if I open another buffer ...
5
votes
1answer
451 views

Where are vim compound (dotted) filetypes documented

Vim has some kind of support for dot-separated compound filetypes like "ruby.rspec" where settings/definitions for both will be loaded. I see mentions of it around the internet but I can't find any ...
1
vote
2answers
912 views

Setting foldmethod=expr when re-sourcing vimrc?

I have the following on my vimrc file to handle custom folding: " ++ Folding set foldenable " enable folding ...
2
votes
1answer
1k views

How can I prevent the default loading of ftplugin/text.vim for certain *.txt files

I have to edit a bunch of *.txt files for which I want to define a specific filetype. So, in my vimrc, I add a autocmd! BufReadPost bunchOfFiles/*.txt :set ft=bunchOfFilesFT This reads ftplugin/...
3
votes
1answer
400 views

Jump to the definition in a scss file

How, in vim, can I jump to the mixin that is @includeed in a SCSS file? For example, I'd like to put the cursor over avatar below and hit some magic key in vim that'll take me to that mixin...but how?...
3
votes
0answers
74 views

Filetype changes when using :split and :Explore

Why does using :split and :Explore cause the filetype to change? For example, edit a file named text.man, and the filetype is set to man. Change the filetype to txt, then :split and :Explore in the ...
1
vote
1answer
142 views

`filetype plugin on` and square brackets

With this .vimrc: nnoremap [ :lp^M nnoremap ] :lne^M filetype plugin on vim becomes sluggish when switching between "errors" of location list with square brackets. As opposed to using lprevious/...
5
votes
1answer
3k views

Filetype that LaTeX should be

From :help filetype: If the first line of a *.tex file has the form %&<format> then this determined the file type: plaintex (for plain TeX), context (for ConTeXt), or tex (for ...
3
votes
2answers
246 views

write a key command for a markdown comment

I've been messing about with file type specific commands this evening (which is going to be very useful) and I'm trying to write a markdown comment command at the moment. I'm not sure how to go about ...
5
votes
1answer
2k views

How does Vim know how to syntax-highlight some files with strange extension or without extension at all?

Take markdown file as an example. I often found that some downloaded files suffixed with .md (rather than .markdown) can be recognized as markdown file, and syntax-highlighted as such. However, it ...
16
votes
2answers
6k views

How to tell vim not to try to unzip a file

I'm trying to open an .xlsx file in Vim, but got an error saying: ***error*** (zip#Browse) unzip not available on your system I know it's a binary file, but I want to do some checksums and ...
1
vote
0answers
171 views

Disable tar.vim plugin from command line? [duplicate]

The tar.vim plugin tries to give a special view of tar files. Its filetype "detection" matches against the filename. If I try to download a tar file from the web and get an HTML error page, I cannot ...
8
votes
1answer
488 views

Run shell commands on current file based on file extension

I'm currently doing a lot of work with both Ruby and JavaScript. I know that I can run my Ruby files with :! ruby % and likewise my JavaScript with :! node %, and that I can bind either of those to, ...
8
votes
2answers
268 views

How can I get correct autocompletion for ambiguous file extensions?

I'm editing Prolog files as part of an exploratory project, and some of the files I'm working with have the extension .pl, which is shared by Perl files. Whenever I do work on a Prolog file named [...
20
votes
2answers
2k views

Open .md files as Markdown

Vim, by default, opens all .md files as "modula2" code. I have never heard of modula2, nor do I plan to use it. How can I tell vim to always treat foo.md as Markdown (as if I had typed :set ft=...
6
votes
2answers
139 views

Setting up ++ft according to the file extension

I have a lot of *.sage that follow the Python syntax. However, VIm does not recognize this. Can I make VIm set ++filetype based solely on the file extension?

1 2 3
4