diff options
-rw-r--r-- | core/gui.lua | 36 | ||||
-rw-r--r-- | core/locale.conf | 2 | ||||
-rw-r--r-- | core/locales/locale.de.conf | 2 | ||||
-rw-r--r-- | core/locales/locale.es.conf | 2 | ||||
-rw-r--r-- | core/locales/locale.fr.conf | 2 | ||||
-rw-r--r-- | core/locales/locale.ru.conf | 2 | ||||
-rw-r--r-- | doc/09_Themes.md | 20 | ||||
-rw-r--r-- | doc/14_Appendix.md | 2 | ||||
-rw-r--r-- | modules/textadept/command_entry.lua | 2 | ||||
-rw-r--r-- | modules/textadept/keys.lua | 6 | ||||
-rw-r--r-- | modules/textadept/menu.lua | 2 |
11 files changed, 25 insertions, 53 deletions
diff --git a/core/gui.lua b/core/gui.lua index bee5c567..59ad72d5 100644 --- a/core/gui.lua +++ b/core/gui.lua @@ -162,39 +162,21 @@ function gui.goto_file(filename, split, preferred_view, sloppy) end --- --- Sets the editor theme name to *name* or prompts the user to select one from a --- list of themes found in the *`_USERHOME`/themes/* and *`_HOME`/themes/* --- directories and optionally sets key-value pair argument properties. +-- Sets the editor theme name to *name* and optionally sets key-value pair +-- argument properties. -- User themes override Textadept's default themes when they have the same name. -- If *name* contains slashes, it is assumed to be an absolute path to a theme -- instead of a theme name. --- @param name Optional name or absolute path of a theme to set. If `nil`, the --- user is prompted for one. --- @param ... key-value argument pairs for theme properties to set. These --- override the theme's defaults. +-- @param name The name or absolute path of a theme to set. +-- @param ... Optional key-value argument pairs for theme properties to set. +-- These override the theme's defaults. -- @usage gui.set_theme('light', 'font', 'Monospace', 'fontsize', 12) -- @name set_theme function gui.set_theme(name, ...) - if not name then - local themes, themes_found = {}, {} - for theme in lfs.dir(_HOME..'/themes') do - theme = theme:match('^(.-)%.lua$') - if theme then themes_found[theme] = true end - end - if lfs.attributes(_USERHOME..'/themes') then - for theme in lfs.dir(_USERHOME..'/themes/') do - theme = theme:match('^(.-)%.lua$') - if theme then themes_found[theme] = true end - end - end - for theme in pairs(themes_found) do themes[#themes + 1] = theme end - table.sort(themes) - name = gui.filteredlist(_L['Select Theme'], _L['Name'], themes) - end - if name and not name:find('[/\\]') then - name = package.searchpath(name, _USERHOME..'/themes/?.lua;'.. - _HOME..'/themes/?.lua') - end + if not name then return end + name = name:find('[/\\]') and name or + package.searchpath(name, _USERHOME..'/themes/?.lua;'.. + _HOME..'/themes/?.lua') if not name or not lfs.attributes(name) then return end local buffer, props = buffer, {...} local current_buffer, current_view = _BUFFERS[buffer], _VIEWS[view] diff --git a/core/locale.conf b/core/locale.conf index 40bd6945..4878377e 100644 --- a/core/locale.conf +++ b/core/locale.conf @@ -42,7 +42,6 @@ Name = Name %Untitled = Untitled Switch Buffers = Switch Buffers theme not found. = theme not found. -Select Theme = Select Theme CRLF = CRLF CR = CR LF = LF @@ -239,7 +238,6 @@ Toggle _Virtual Space = Toggle _Virtual Space Zoom _In = Zoom _In Zoom _Out = Zoom _Out _Reset Zoom = _Reset Zoom -Select _Theme... = Select _Theme... _Help = _Help Show _Manual = Show _Manual Show _LuaDoc = Show _LuaDoc diff --git a/core/locales/locale.de.conf b/core/locales/locale.de.conf index 2508a656..183d1f1f 100644 --- a/core/locales/locale.de.conf +++ b/core/locales/locale.de.conf @@ -43,7 +43,6 @@ Name = Name %Untitled = Unbenannt Switch Buffers = Wechsle Buffer theme not found = -Theme nicht gefunden -Select Theme = Theme auswählen CRLF = CRLF CR = CR LF = LF @@ -229,7 +228,6 @@ Toggle _Virtual Space = Virtuelle Leerzeichen umschalten Zoom _In = Zoom vergrößern Zoom _Out = Zoom verkleinern _Reset Zoom = Zoom zurücksetzen -Select _Theme... = Theme auswählen _Help = _Hilfe Show _Manual = Handbuch anzeigen Show _LuaDoc = LuaDoc anzeigen diff --git a/core/locales/locale.es.conf b/core/locales/locale.es.conf index a8a1c628..102401e4 100644 --- a/core/locales/locale.es.conf +++ b/core/locales/locale.es.conf @@ -43,7 +43,6 @@ Name = Nombre %Untitled = Sin Nombre Switch Buffers = Cambiar Buffer theme not found. = tema no encontrado. -Select Theme = Seleccionar tema CRLF = CRLF CR = CR LF = LF @@ -240,7 +239,6 @@ Toggle _Virtual Space = Activa_r/Desactivar modo espacio virtual Zoom _In = _Zoom: Acercar Zoom _Out = Zoom: Ale_jar _Reset Zoom = Zoom: R_estaurar -Select _Theme... = Se_leccionar tema... _Help = A_yuda Show _Manual = Mostrar _manual Show _LuaDoc = Mostrar _LuaDoc diff --git a/core/locales/locale.fr.conf b/core/locales/locale.fr.conf index ad2be4d8..60279918 100644 --- a/core/locales/locale.fr.conf +++ b/core/locales/locale.fr.conf @@ -43,7 +43,6 @@ Name = Nom %Untitled = Sans titre Switch Buffers = Changer de buffer theme not found. = thème non trouvé. -Select Theme = Sélectionner un thème CRLF = CRLF CR = CR LF = LF @@ -240,7 +239,6 @@ Toggle _Virtual Space = Permuter _espace virtuel Zoom _In = _Zoomer Zoom _Out = Déz_oomer _Reset Zoom = _Réinitialiser zoom -Select _Theme... = Sélectionner _Thème... _Help = _Aide Show _Manual = Voir _manuel Show _LuaDoc = Voir _LuaDoc diff --git a/core/locales/locale.ru.conf b/core/locales/locale.ru.conf index e4b48db6..c1fde42c 100644 --- a/core/locales/locale.ru.conf +++ b/core/locales/locale.ru.conf @@ -43,7 +43,6 @@ Name = Название %Untitled = Безымянный Switch Buffers = Переключение между буферами theme not found. = тема не найдена. -Select Theme = Выбрать тему CRLF = CRLF CR = CR LF = LF @@ -229,7 +228,6 @@ Toggle _Virtual Space = Переключить режим _виртульных Zoom _In = _Приблизить Zoom _Out = _Отдалить _Reset Zoom = _Сбросить масштаб -Select _Theme... = Выбрать тему... _Help = _Справка Show _Manual = Показать _руководство Show _LuaDoc = Показать документацию по _lua diff --git a/doc/09_Themes.md b/doc/09_Themes.md index ccdbf85e..eb069795 100644 --- a/doc/09_Themes.md +++ b/doc/09_Themes.md @@ -25,16 +25,20 @@ display these standard colors. [definitions]: api/lexer.html#Styles.and.Styling -## Switch Themes +## Setting Themes -Switch between or reload themes using `Ctrl+Shift+T` (`⌘⇧T` on Mac OSX | none in -curses). Set that theme to be the default one by putting +Override the default theme in your [*~/.textadept/init.lua*][] using the +[`gui.set_theme()`][] function. For example: - gui.set_theme('name') + gui.set_theme('dark') -somewhere in your [*~/.textadept/init.lua*][]. +Either restart Textadept for changes to take effect or type [`reset()`][] in the +[command entry][]. [*~/.textadept/init.lua*]: 08_Preferences.html#User.Init +[`gui.set_theme()`]: api/gui.html#set_theme +[`reset()`]: api/_G.html#reset +[command entry]: 10_Advanced.html#Command.Entry ## Customizing Themes @@ -50,9 +54,9 @@ scratch or tweak an existing one. Creating a new one is straightforward -- all you need to do is define a set of colors and a set of styles. Just follow the example of existing themes. If instead you want to use an existing theme like "light" but only change the font face and font size, you have two options: call -[`gui.set_theme()`][] with additional parameters from your -*~/.textadept/init.lua* or create an abbreviated *~/.textadept/themes/light.lua* -using Lua's `dofile()` function. For example: +[`gui.set_theme()`][] from your *~/.textadept/init.lua* with additional +parameters, or create an abbreviated *~/.textadept/themes/light.lua* using Lua's +`dofile()` function. For example: -- File *~/.textadept/init.lua* gui.set_theme('light', 'font', 'Monospace', 'fontsize', 12) diff --git a/doc/14_Appendix.md b/doc/14_Appendix.md index 2cdb86b8..3a8d85a0 100644 --- a/doc/14_Appendix.md +++ b/doc/14_Appendix.md @@ -277,7 +277,7 @@ terminal themes: You may still use absolute paths for themes instead of names. -[set a preferred theme]: 09_Themes.html#Switch.Themes +[set a preferred theme]: 09_Themes.html#Setting.Themes ### Textadept 5 to 6 diff --git a/modules/textadept/command_entry.lua b/modules/textadept/command_entry.lua index 45dd7d3c..4825faa9 100644 --- a/modules/textadept/command_entry.lua +++ b/modules/textadept/command_entry.lua @@ -94,7 +94,7 @@ local env = setmetatable({}, { -- Executes string *code* as Lua code. -- Code is subject to an "abbreviated" environment where the `buffer`, `view`, -- and `gui` tables are also considered as globals. --- Print the results of '=' expressions like in the Lua prompt. +-- Prints the results of '=' expressions like in the Lua prompt. -- @param code The Lua code to execute. -- @name execute_lua function M.execute_lua(code) diff --git a/modules/textadept/keys.lua b/modules/textadept/keys.lua index 3470e499..810d6ee0 100644 --- a/modules/textadept/keys.lua +++ b/modules/textadept/keys.lua @@ -136,7 +136,6 @@ local M = {} -- Ctrl+= |⌘= |N/A |Zoom in -- Ctrl+- |⌘- |N/A |Zoom out -- Ctrl+0 |⌘0 |N/A |Reset zoom --- Ctrl+Shift+T |⌘⇧T |None |Select theme... -- **Help**| | | -- F1 |F1 |None|Open manual -- Shift+F1|⇧F1 |None|Open LuaDoc @@ -301,7 +300,7 @@ local OSX, CURSES, c = OSX, CURSES, _SCINTILLA.constants -- Windows and Linux key bindings. -- -- Unassigned keys (~ denotes keys reserved by the operating system): --- c: A B C H p Q ~ V X Y _ ) ] } + +-- c: A B C H p Q T ~ V X Y _ ) ] } + -- a: aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ_ ) ] } *+-/=\n\s -- ca: aAbBcCdD F jJkKlLmM N PqQ t xXy zZ_"'()[]{}<>* / \s -- @@ -316,7 +315,7 @@ local OSX, CURSES, c = OSX, CURSES, _SCINTILLA.constants -- Mac OSX key bindings. -- -- Unassigned keys (~ denotes keys reserved by the operating system): --- m: A B C ~ JkK ~M p ~ t U V XyY _ ) ] } + ~~\n +-- m: A B C ~ JkK ~M p ~ tT U V XyY _ ) ] } + ~~\n -- c: cC D gG H J K L oO qQ xXyYzZ_ ) ] } * / -- cm: aAbBcC~D F ~HiIjJkKlL~MnN pPq~rRsStTuUvVwWxXyYzZ_"'()[]{}<>*+-/=\t\n -- @@ -548,7 +547,6 @@ end keys[not OSX and not CURSES and 'c=' or 'm='] = buffer.zoom_in keys[not OSX and not CURSES and 'c-' or 'm-'] = buffer.zoom_out keys[not OSX and not CURSES and 'c0' or 'm0'] = utils.reset_zoom -if not CURSES then keys[not OSX and 'cT' or 'mT'] = gui.set_theme end -- Help. if not CURSES then diff --git a/modules/textadept/menu.lua b/modules/textadept/menu.lua index bf5b28e4..c7babf8d 100644 --- a/modules/textadept/menu.lua +++ b/modules/textadept/menu.lua @@ -184,8 +184,6 @@ local menubar = { {_L['Zoom _In'], buffer.zoom_in}, {_L['Zoom _Out'], buffer.zoom_out}, {_L['_Reset Zoom'], utils.reset_zoom}, - SEPARATOR, - {_L['Select _Theme...'], gui.set_theme}, }, { title = _L['_Help'], {_L['Show _Manual'], |