From 1d249aa4a3016ebe4cbcfdf23bcf9f5293f37163 Mon Sep 17 00:00:00 2001 From: mitchell <70453897+667e-11@users.noreply.github.com> Date: Mon, 8 Jul 2013 23:08:05 -0400 Subject: Renamed Textadept module's "mime_types" to "file_types" and removed config file. --- doc/08_Preferences.md | 67 ++++++++++++++------------------------------------- doc/14_Appendix.md | 6 ++++- 2 files changed, 23 insertions(+), 50 deletions(-) (limited to 'doc') diff --git a/doc/08_Preferences.md b/doc/08_Preferences.md index 75ed019b..ba4ea399 100644 --- a/doc/08_Preferences.md +++ b/doc/08_Preferences.md @@ -131,6 +131,24 @@ Learn more about snippet syntax in the [snippets LuaDoc][]. [snippets LuaDoc]: api/_M.textadept.snippets.html +### File Types + +Textadept recognizes a wide range of programming language files either by file +extension, by a keyword in the shebang ("#!/path/to/exe") line, or by a +[Lua pattern][] that matches the text of the first line. The editor does this by +consulting a set of tables in [`_M.textadept.file_types`][] that are modifiable +from *~/.textadept/init.lua*. For example: + + -- Recognize .luadoc files as Lua code. + _M.textadept.file_types.extensions.luadoc = 'lua' + -- Change .html files to be recognized as XML files. + _M.textadept.file_types.extensions.html = 'xml' + -- Recognize a shebang line like "#!/usr/bin/zsh" as shell code. + _M.textadept.file_types.shebangs.zsh = 'bash' + +[Lua pattern]: 14_Appendix.html#Lua.Patterns +[`_M.textadept.file_types`]: api/_M.textadept.file_types.html + ## Buffer Properties Since Textadept runs *~/.textadept/init.lua* only once on startup, it is not the @@ -170,52 +188,3 @@ send the modified *locale.conf* file to [me][]. I will include it in a future release. [me]: README.html#Contact - -## File Types - -Textadept recognizes a wide range of programming language files by any of the -following: - -* File extension. -* Keywords in the file's shebang ("#!/path/to/exe") line. -* A pattern that matches the text of the file's first line. - -*modules/textadept/mime_types.conf* contains built-in file types. Override or -add to them in your *~/.textadept/mime_types.conf*: - - % Recognize .luadoc files as Lua code. - luadoc lua - - % Change .html files to be recognized as XML files. - html xml - -### Detect by Extension - -The syntax for mapping a file extension to a lexer is: - - file_ext lexer - -Note: `file_ext` should not start with a '.' (period). - -### Detect by Shebang - -The syntax for mapping a word contained in a shebang line (the first line of a -file whose first two characters are "#!") to a lexer is: - - #shebang_word lexer - -Examples of `shebang_word`s are "lua", "ruby", "python" which match lines like -"#!/usr/bin/lua", "#!/usr/env/ruby", and "#!/usr/bin/python3", respectively. - -### Detect by Pattern - -The syntax for mapping a Lua pattern that matches the first line of a file to a -lexer is: - - /pattern lexer - -Patterns use [Lua pattern syntax][] with only the last space, the one separating -the pattern from the lexer, being significant. No spaces in the pattern need -escaping. - -[Lua pattern syntax]: 14_Appendix.html#Lua.Patterns diff --git a/doc/14_Appendix.md b/doc/14_Appendix.md index a3f21a08..f92f4f35 100644 --- a/doc/14_Appendix.md +++ b/doc/14_Appendix.md @@ -157,6 +157,7 @@ buffer\_new() |Renamed |\_G.[buffer.new()][] **_M.textadept** | | filter\_through |Removed |N/A filter\_through.filter\_through() |Renamed |editing.[filter\_through()][] +mime\_types |Renamed |[file\_types][] **_M.textadept.bookmark** | | N/A |New |[goto\_mark()][] MARK\_BOOKMARK\_COLOR |Renamed |[BOOKMARK\_COLOR][] @@ -184,10 +185,13 @@ try\_encodings |Renamed |[encodings][] \*`arg` is `nil` when resetting. -Changed arguments too. +Removed *mime_types.conf* files. Interact with Lua tables directly. + +Changed arguments too. [buffer.new()]: api/buffer.html#new [filter\_through()]: api/_M.textadept.editing.html#filter_through +[file\_types]: api/_M.textadept.file_types.html [goto\_mark()]: api/_M.textadept.bookmarks.html#goto_mark [BOOKMARK\_COLOR]: api/_M.textadept.bookmarks.html#BOOKMARK_COLOR [HIGHLIGHT\_COLOR]: api/_M.textadept.editing.html#HIGHLIGHT_COLOR -- cgit v1.2.3