NppFileSettings is plug-in for Notepad++ that tries to recognize VIM modelines and adjust settings for that file accordingly.
Support for VIM modelines
tabstop
,ts
: set the width of tabstopsexpandtab
,et
: tab key produces spacesnoexpandtab
,noet
: tab key produces tabsfiletype
,ft
,syntax
,syn
: specify the syntax highlighting used for the filefileformat
,ff
: force the line ending tounix
,dos
ormac
.fileencoding
,fenc
: support the following file encoding, based on the vim docslatin1
utf-8
utf-16
utf-16le
- Support more VIM modelines options, if possible
wrap
andnowrap
to wrap or don't wrap linestextwidth
,tw
(at what column does the text wrap, default toSCI_GETEDGECOLUMN
)shiftwidth
,sw
can probably be mapped toSCI_SETINDENT
spell
andnospell
to enable or disable the spelling checkspelllang
to set the spelling language
The wrap
options need some work. This is a global setting in Notepad++ and
it needs to be preserved when switching between files.
The DSpellCheck plugin first needs to have an API to support the spell check related properties.
There will be no support for encoding
in vim modelines, which is different from fileencoding
, because the vim documentation clearly states
This option cannot be set from a |modeline|. It would most likely corrupt the text.
I have no intention to create yet another modeline variant especially for Notepad++. There are already too many of them.
-
Support the modeline concept found in other places
- Emacs File Variables, see #3
- Kate Editor
- Sublime Text
- jEdit
- PEP 263, see #4
-
Add a dialog to show which settings are active for the current document.
-
Modeline Generator to add a modeline, compatible with your editor of choice, to the current file or edit the existing one.
-
Every time a file is activated (like when switching tabs), the plug-in will do its thing, not just when the file is opened. When a file is saved the plug-in is not activated (yet).
-
The modeline parser is very basic. The fact that this plug-in recognizes something doesn't mean it is valid for
vim
. So when you add a modeline be sure to check its syntax with the real thing. -
If your
vim
doesn't recognize the modelines, you probably need to enable it. Add these lines to~/.vimrc
:set modeline set modelines=5
- This plug-in could cause unexpected results if you use it together with
the EditorConfig plug-in. When both plug-ins
are installed and a
.editorconfig
file exists and sets tabs and a VIM modeline with tab settings is opened, it depends on the order the are found in thePlugins
menu of Notepad++ which plug-in does its thing first. To fix this these two plugins need to become aware of each other most likely with the messageNPPM_MSGTOPLUGIN
. EditorConfig should be applied first (global) and the modeline after that (local).
This plug-in used to be called NppFileMagic. It was also able to set the language of a file based on the first line of the file. But since v6.8.4 Notepad++ recognizes many languages by itself by parsing the first line of a file. The detection was not that great, so I contributed some of my code and knowledge upstream and now that part of the plug-in was not needed anymore. Therefore I decided to remove that code and rename to plug-in.