Skip to main content

Questions tagged [ftplugin]

Questions about the creation, usage and debugging of filetype plugins.

Filter by
Sorted by
Tagged with
0 votes
1 answer
22 views

How to test ftplugins?

I am trying to write some tests for a ftplugin but I am encountering some issues. The following is the plugin structure: . ├── ftplugin │   └── python.vim ├── lib │   └── myfunctions.vim ├── plugin │  ...
Barzi2001's user avatar
  • 650
1 vote
1 answer
32 views

Remaps to move across windows do not work when in netrw window

Can someone explain why remaps to navigate across windows like nmap <C-h> <C-w>h does not work when in the netrw window? Is there any reason why? Is there a setting to enable them?
mEm's user avatar
  • 157
-1 votes
2 answers
40 views

What options shall be set for loading ftplugins? [duplicate]

Consider the following script: vim9script filetype plugin indent on import "./plugin/myplugin.vim" exe $"edit testfile.py" MyCommand In the specific case, ...
Barzi2001's user avatar
  • 650
2 votes
1 answer
200 views

Cypher syntax file asks about commentstring on open

I am using syntax highlighting on my Cypher scripts from https://github.com/memgraph/cypher.vim. (I would open an issue there but the project and its predecessor haven't been touched in 3 years.) ...
kjekk's user avatar
  • 31
0 votes
1 answer
22 views

Neovim vim.g.ftplugin_sql_omni_key = 0 not working

I am trying to edit an sql file in neovim. However the ftplugin/sql.vim (which I cant even find) sets some keybindings that start with <C-c> which is my <ESC> key. I want searched the ...
0mycf's user avatar
  • 1
2 votes
3 answers
48 views

Setting variables in file in ftplugin directory

I am currently cleaning up my .vimrc. I learned that I can spread out filetype specific commands into separate files in the .vim/vimfiles directory by putting them into ftplugin and after/ftplugin ...
Matthias's user avatar
0 votes
1 answer
17 views

Setting guard variables does not prevent default ftplugin/syntax/indent files from running

I want to prevent the default ftplugin/syntax/indent files from running for tex files. I have a tex.vim in the $XDG_CONFIG_HOME/nvim/ftplugin directory, i confirmed it runs before the default ftplugin/...
CoelinG's user avatar
3 votes
1 answer
56 views

How to search standard library files in languages without include expressions?

vim-apathy advertises the many possibilities of :h include-search. However, if the programming language under consideration (here GAP), does not have include expressions but the interpreter always ...
Hotschke's user avatar
  • 4,800
1 vote
2 answers
92 views

How to prevent Vim from loading a specific system-wide ftplugin?

I'm writing a custom ftplugin for handling systemd file type. I've copied parts of code from vim's own systemd ftplugin and now the latter conflicts with my own code: Error detected while processing ...
intelfx's user avatar
  • 317
0 votes
1 answer
55 views

How do I position cursor according to filetype (gitcommit)?

Sometimes on start, the cursor is not at the top in gitcommit buffers. I assume that this is because it wasn't on the first line the last time I exited a gitcommit buffer and the position was saved in ...
paradroid's user avatar
  • 377
0 votes
2 answers
380 views

ftdetect, ftplugin not working as advertised -- what am I missing?

I've been reading documentation and trying experiments to register a new filetype in vim, and apply desired indentation rules -- all to no avail. As an example, say I want to register *.test as ...
StoneThrow's user avatar
0 votes
2 answers
39 views

How to combine identical ftplugin files?

I am trying to write a plugin and I observed that I have identical ftplugin files. e.g. ftplugin/python.vim and ftplugin/julia.vim have exactly the same content and it looks like the following: ...
Barzi2001's user avatar
  • 650
2 votes
1 answer
189 views

Why is there an ftplugin directory for each plugin?

I am trying to get started with VimTeX. I am reading through a guide (https://www.ejmastnak.com/tutorials/vim-latex/vimtex.html) and using vim-plug to manage plugins. I am very new to Vim generally, ...
monty_m's user avatar
  • 21
1 vote
1 answer
98 views

How can I make `.vim/after/ftplugin/markdown.vim` take effect immediately?

I change this file, but it seems that I have to restart Vim to make it take effect. Is there any way to make .vim/after/ftplugin/markdown.vim take effect immediately? I already tried :source and :...
Tokubara's user avatar
  • 177
1 vote
1 answer
655 views

How to properly set up ftplugin files for working with different filetypes in different windows?

$ vim --version VIM - Vi IMproved 8.1 I set up the following vim configuration files: " .vim/ftplugin/text.vim set textwidth = 0 " .vim/ftplugin/python.vim set textwidth = 99 set ...
Quappas's user avatar
  • 83
1 vote
2 answers
130 views

Open buffer without loading ftplugins

I have huge file and quite slow plugin (loaded by vim-plug) for corresponding filetype. I want following: Plugin is loaded by default Option to fast open this file without loading plugin. Something ...
petRUShka's user avatar
  • 243
0 votes
0 answers
256 views

Filetype inheritance

I know that it's not very common, but there are few cases in which I would really like to inherit the configurations for one filetype in another. Example: whatever I set for sh I would like to inherit ...
Annibale's user avatar
  • 101
0 votes
1 answer
58 views

modules installed again and again

Here is a part of my ftplugin/fortran_state.vim " Check python modules and install{{{1 if !executable('fprettify') || !executable('fortls') || !executable('unidecode') :let choice =confirm(&...
BaRud's user avatar
  • 491
1 vote
1 answer
167 views

Execute normal command after opening email in Mutt

I'd like to use ftplugin/mail.vim to execute a normal command after opening an email in Mutt. Specifically, when replying to an email, I'd like move the cursor after the header fields (I have set ...
Matthias Braun's user avatar
1 vote
2 answers
586 views

Where should I put filetype specific options for indentation?

At moment, mostly for random reasons, I have $ cat ~/.vim/ftplugin/c.vim set tabstop=2 softtabstop=2 expandtab shiftwidth=2 smarttab smartindent autoindent cinoptions=g2 and this $ cat ~/.vim/...
Enlico's user avatar
  • 2,244
1 vote
1 answer
268 views

How can I make vim ignore a filetype plugin's makeprg setting?

I am using a plugin that sets makeprg to some value specific to the filetype's programming language. I want to use my global setting instead, because I also use Makefiles. How can I do this? Thank you!...
Jay McCarthy's user avatar
3 votes
1 answer
3k views

Neovim automatically run command when opening a filetype from ftplugin file

I have Neovim setup with configurations for file types separated into ftplugin files. I would like to have Neovim start the Goyo plugin when I open a markdown file. However, I would like to keep this ...
Eugene Grechko's user avatar
3 votes
1 answer
649 views

Why won't vim source my ftplugin_after.vim file?

I have a file called ~/.config/nvim/after/ftplugin_after.vim, which contains set incsearch ignorecase smartcase number relativenumber autoindent shiftwidth=8 tabstop=8 softtabstop=8 expandtab ...
Not me's user avatar
  • 69
1 vote
1 answer
53 views

Buffer opened when compiling succeeds

I am writing a vim plugin for the fortran filetype. In an autoload script, I have done: " File Name: autoload/makes.vim let s:Compiler = get(g:, "fortran_compiler", "gfortran"...
BaRud's user avatar
  • 491
1 vote
1 answer
58 views

pluging value to override vimrc

in my ftplugin, I have code: if executable('fprettify') au BufWritePre <buffer> :silent %!fprettify --silent else :let choice=confirm("fprettify doesn't exists! Install ...
BaRud's user avatar
  • 491
13 votes
1 answer
5k views

Difference between adding "vim/after/ftplugin" vs "vim/ftplugin"

I'd like to configure Vim 8.2 on Ubuntu 18 so that when I open code in different programming languages, different settings load. Eg. indentation, color-theme, plugins etc. I found ftplugin to be the ...
theairbend3r's user avatar
0 votes
1 answer
752 views

Organize plugins and .vimrc settings for different filetypes using ftplugins?

I'm new to vim (8.2) and have been learning how to set it up on my computer (Ubuntu 18) for the past few days. I'd like to configure VIM so that when I open code in different programming languages, ...
theairbend3r's user avatar
0 votes
1 answer
214 views

Why are files in after/ftplugin/ run on every save, and can I work around it?

I have a variety of vimscripts for different filetypes in ~/.vim/after/ftplugin, e.g. text.vim, vim.vim, etc. These contain a variety of settings, mappings, etc. Only recently, I've noticed (not sure ...
Andrew Ferrier's user avatar
0 votes
1 answer
61 views

Highlight group in `.vim/after/ftplugin` not highlighting patterns

While highlight group in .vimrc highlights patterns just fine, highlight groups in .vim/after/ftplugin folder does not seem to do anything. Is it normal?
mahbubweb's user avatar
  • 602
2 votes
1 answer
213 views

Why do FileType autocommands not appear to work when using multiple filetypes?

Not everyone considers setting b:undo_ftplugin to be a "best practice" the way I do, but as far as I can tell, the behavior described in this question depends on it being set as part of the ...
D. Ben Knoble's user avatar
  • 26.8k
0 votes
0 answers
29 views

How to use bash aliases in ftplugin files? [duplicate]

I want to be able to compile and run C++ files directly from inside vim. I have a custom compilation alias gmm defined in ~/.bash_aliases. I do not want to copy it over to my ~/.vim/ftplugin/cpp.vim ...
Gaurang Tandon's user avatar