From 04730b609194f64081a99bf7f39909573a5e8b1d Mon Sep 17 00:00:00 2001 From: mitchell <70453897+667e-11@users.noreply.github.com> Date: Tue, 21 May 2013 16:54:53 -0400 Subject: Renamed "settings.lua" to "properties.lua". --- core/gui.lua | 8 ++-- doc/04_WorkingWithFiles.md | 2 +- doc/06_AdeptEditing.md | 2 +- doc/08_Preferences.md | 16 +++---- properties.lua | 115 +++++++++++++++++++++++++++++++++++++++++++++ settings.lua | 113 -------------------------------------------- 6 files changed, 129 insertions(+), 127 deletions(-) create mode 100644 properties.lua delete mode 100644 settings.lua diff --git a/core/gui.lua b/core/gui.lua index 3fd32c9b..dbbab6ce 100644 --- a/core/gui.lua +++ b/core/gui.lua @@ -208,12 +208,12 @@ end local events, events_connect = events, events.connect --- Loads the theme and settings files. +-- Loads the theme and properties files. local function load_theme_and_settings() dofile(theme) - dofile(_HOME..'/settings.lua') - if lfs.attributes(_USERHOME..'/settings.lua') then - dofile(_USERHOME..'/settings.lua') + dofile(_HOME..'/properties.lua') + if lfs.attributes(_USERHOME..'/properties.lua') then + dofile(_USERHOME..'/properties.lua') end end diff --git a/doc/04_WorkingWithFiles.md b/doc/04_WorkingWithFiles.md index 029f2e0d..764b9c0b 100644 --- a/doc/04_WorkingWithFiles.md +++ b/doc/04_WorkingWithFiles.md @@ -47,7 +47,7 @@ to tabs. If the buffer uses spaces, all indenting tabs convert to spaces.) Similarly, the "Buffer -> Indentation" menu manually sets indentation size. [language-specific modules]: 07_Modules.html#Buffer.Properties -[user settings]: 08_Preferences.html#Buffer.Settings +[user settings]: 08_Preferences.html#Buffer.Properties #### Line Endings diff --git a/doc/06_AdeptEditing.md b/doc/06_AdeptEditing.md index 518fc1bc..83e12802 100644 --- a/doc/06_AdeptEditing.md +++ b/doc/06_AdeptEditing.md @@ -82,7 +82,7 @@ Textadept curses does not support creating rectangular selections with the mouse. [`buffer.rectangular_selection_modifier`]: api/buffer.html#rectangular_selection_modifier -[settings]: 08_Preferences.html#Buffer.Settings +[settings]: 08_Preferences.html#Buffer.Properties ### Select to Matching Brace diff --git a/doc/08_Preferences.md b/doc/08_Preferences.md index 447d7ef9..2343b472 100644 --- a/doc/08_Preferences.md +++ b/doc/08_Preferences.md @@ -132,7 +132,7 @@ Learn more about snippet syntax in the [snippets LuaDoc][]. [snippets LuaDoc]: api/_M.textadept.snippets.html -## Buffer Settings +## Buffer Properties Since Textadept runs *~/.textadept/init.lua* only once on startup, it is not the appropriate place to set per-buffer properties like indentation size or @@ -140,10 +140,10 @@ view-related properties like the behaviors for scrolling and autocompletion. If you do set such properties in *~/.textadept/init.lua*, those settings only apply to the first buffer and view -- subsequent buffers and split views will not inherit those settings. Instead, put your settings in a -*~/.textadept/settings.lua* file which runs after creating a new buffer or split -view. Any settings there override Textadept's default *settings.lua* settings. -For example, to use tabs rather than spaces and have a tab size of 4 spaces by -default, your *~/.textadept/settings.lua* would contain: +*~/.textadept/properties.lua* file which runs after creating a new buffer or +split view. Any settings there override Textadept's default *properties.lua* +settings. For example, to use tabs rather than spaces and have a tab size of 4 +spaces by default, your *~/.textadept/properties.lua* would contain: buffer.tab_width = 4 buffer.use_tabs = true @@ -151,10 +151,10 @@ default, your *~/.textadept/settings.lua* would contain: (Remember that in order to have per-filetype properties, you need to have a [language-specific module][].) -Textadept's *settings.lua* is a good reference to see available properties to +Textadept's *properties.lua* is a good reference to see available properties to set. It also has many commented out properties that you can copy to your -*~/.textadept/settings.lua* and uncomment to turn on or change the value of. Use -[Adeptsense][] to view a property's documentation or read the [LuaDoc][]. +*~/.textadept/properties.lua* and uncomment to turn on or change the value of. +Use [Adeptsense][] to view a property's documentation or read the [LuaDoc][]. [language-specific module]: 07_Modules.html#Buffer.Properties [Adeptsense]: 06_AdeptEditing.html#Adeptsense diff --git a/properties.lua b/properties.lua new file mode 100644 index 00000000..aa317d3c --- /dev/null +++ b/properties.lua @@ -0,0 +1,115 @@ +-- Copyright 2007-2013 Mitchell mitchell.att.foicica.com. See LICENSE. + +local buffer = buffer +local c = _SCINTILLA.constants + +-- Multiple Selection and Virtual Space +buffer.multiple_selection = true +buffer.additional_selection_typing = true +--buffer.multi_paste = c.SC_MULTIPASTE_EACH +--buffer.virtual_space_options = c.SCVS_RECTANGULARSELECTION + +-- c.SCVS_USERACCESSIBLE +buffer.rectangular_selection_modifier = (WIN32 or OSX) and c.SCMOD_ALT or + c.SCMOD_SUPER +--buffer.additional_carets_blink = false +--buffer.additional_carets_visible = false + +-- Scrolling. +buffer:set_x_caret_policy(1, 20) -- CARET_SLOP +buffer:set_y_caret_policy(13, 1) -- CARET_SLOP | CARET_STRICT | CARET_EVEN +--buffer:set_visible_policy() +--buffer.h_scroll_bar = false +--buffer.v_scroll_bar = false +--buffer.x_offset = +--buffer.scroll_width = +--buffer.scroll_width_tracking = true +--buffer.end_at_last_line = false + +-- Whitespace +--buffer.view_ws = c.SCWS_VISIBLEALWAYS +--buffer.whitespace_size = +--buffer.extra_ascent = +--buffer.extra_descent = + +-- Line Endings +--buffer.view_eol = true + +-- Caret and Selection Styles. +--buffer.sel_eol_filled = true +buffer.caret_line_visible = not CURSES +--buffer.caret_line_visible_always = true +--buffer.caret_period = 0 +--buffer.caret_style = c.CARETSTYLE_BLOCK +--buffer.caret_width = +--buffer.caret_sticky = c.SC_CARETSTICKY_ON + +-- Line Number Margin. +local width = 4 * buffer:text_width(c.STYLE_LINENUMBER, '9') +buffer.margin_width_n[0] = width + (not CURSES and 4 or 0) + +-- Marker Margin. +buffer.margin_width_n[1] = not CURSES and 0 or 1 + +-- Fold Margin. +buffer.margin_width_n[2] = not CURSES and 10 or 1 +buffer.margin_mask_n[2] = c.SC_MASK_FOLDERS +buffer.margin_sensitive_n[2] = true +--buffer.margin_left = +--buffer.margin_right = + +-- Annotations. +buffer.annotation_visible = c.ANNOTATION_BOXED + +-- Other. +buffer.buffered_draw = not CURSES and not OSX -- Quartz buffers drawing on OSX +--buffer.two_phase_draw = false + +-- Tabs and Indentation Guides. +-- Note: tab and indentation settings apply to individual buffers. +buffer.tab_width = 2 +buffer.use_tabs = false +--buffer.indent = 2 +buffer.tab_indents = true +buffer.back_space_un_indents = true +buffer.indentation_guides = c.SC_IV_LOOKBOTH + +-- Fold Margin Markers. +if not CURSES then + buffer:marker_define(c.SC_MARKNUM_FOLDEROPEN, c.SC_MARK_ARROWDOWN) + buffer:marker_define(c.SC_MARKNUM_FOLDER, c.SC_MARK_ARROW) + buffer:marker_define(c.SC_MARKNUM_FOLDERSUB, c.SC_MARK_EMPTY) + buffer:marker_define(c.SC_MARKNUM_FOLDERTAIL, c.SC_MARK_EMPTY) + buffer:marker_define(c.SC_MARKNUM_FOLDEREND, c.SC_MARK_EMPTY) + buffer:marker_define(c.SC_MARKNUM_FOLDEROPENMID, c.SC_MARK_EMPTY) + buffer:marker_define(c.SC_MARKNUM_FOLDERMIDTAIL, c.SC_MARK_EMPTY) +end + +-- Autocompletion. +--buffer.auto_c_cancel_at_start = false +buffer.auto_c_choose_single = true +--buffer.auto_c_auto_hide = false +--buffer.auto_c_max_height = +--buffer.auto_c_max_width = + +-- Call Tips. +buffer.call_tip_use_style = buffer.tab_width * + buffer:text_width(c.STYLE_CALLTIP, ' ') + +-- Folding. +buffer.property['fold'] = '1' +buffer.property['fold.by.indentation'] = '1' +buffer.property['fold.line.comments'] = '0' +buffer.fold_flags = not CURSES and c.SC_FOLDFLAG_LINEAFTER_CONTRACTED or 0 +buffer.automatic_fold = c.SC_AUTOMATICFOLD_SHOW + c.SC_AUTOMATICFOLD_CLICK + + c.SC_AUTOMATICFOLD_CHANGE + +-- Line Wrapping. +--buffer.wrap_mode = c.SC_WRAP_WORD +--buffer.wrap_visual_flags = c.SC_WRAPVISUALFLAG_MARGIN +--buffer.wrap_visual_flags_location = c.SC_WRAPVISUALFLAGLOC_END_BY_TEXT +--buffer.wrap_indent_mode = c.SC_WRAPINDENT_SAME +--buffer.wrap_start_indent = + +-- Long Lines. +--buffer.edge_mode = not CURSES and c.EDGE_LINE or c.EDGE_BACKGROUND +--buffer.edge_column = 80 diff --git a/settings.lua b/settings.lua deleted file mode 100644 index 5bce633e..00000000 --- a/settings.lua +++ /dev/null @@ -1,113 +0,0 @@ --- Copyright 2007-2013 Mitchell mitchell.att.foicica.com. See LICENSE. - -local buffer = buffer -local c = _SCINTILLA.constants - --- Multiple Selection and Virtual Space -buffer.multiple_selection = true -buffer.additional_selection_typing = true ---buffer.multi_paste = c.SC_MULTIPASTE_EACH ---buffer.virtual_space_options = c.SCVS_RECTANGULARSELECTION + --- c.SCVS_USERACCESSIBLE -buffer.rectangular_selection_modifier = (WIN32 or OSX) and c.SCMOD_ALT or - c.SCMOD_SUPER ---buffer.additional_carets_blink = false ---buffer.additional_carets_visible = false - --- Scrolling. -buffer:set_x_caret_policy(1, 20) -- CARET_SLOP -buffer:set_y_caret_policy(13, 1) -- CARET_SLOP | CARET_STRICT | CARET_EVEN ---buffer:set_visible_policy() ---buffer.h_scroll_bar = false ---buffer.v_scroll_bar = false ---buffer.x_offset = ---buffer.scroll_width = ---buffer.scroll_width_tracking = true ---buffer.end_at_last_line = false - --- Whitespace ---buffer.view_ws = c.SCWS_VISIBLEALWAYS ---buffer.whitespace_size = ---buffer.extra_ascent = ---buffer.extra_descent = - --- Line Endings ---buffer.view_eol = true - --- Caret and Selection Styles. ---buffer.sel_eol_filled = true -buffer.caret_line_visible = not CURSES ---buffer.caret_line_visible_always = true ---buffer.caret_period = 0 ---buffer.caret_style = c.CARETSTYLE_BLOCK ---buffer.caret_width = ---buffer.caret_sticky = c.SC_CARETSTICKY_ON - --- Line Number Margin. -local width = 4 * buffer:text_width(c.STYLE_LINENUMBER, '9') -buffer.margin_width_n[0] = width + (not CURSES and 4 or 0) - --- Marker Margin. -buffer.margin_width_n[1] = not CURSES and 0 or 1 - --- Fold Margin. -buffer.margin_width_n[2] = not CURSES and 10 or 1 -buffer.margin_mask_n[2] = c.SC_MASK_FOLDERS -buffer.margin_sensitive_n[2] = true ---buffer.margin_left = ---buffer.margin_right = - --- Annotations. -buffer.annotation_visible = c.ANNOTATION_BOXED - --- Other. -buffer.buffered_draw = not CURSES and not OSX -- Quartz buffers drawing on OSX ---buffer.two_phase_draw = false - --- Tabs and Indentation Guides. --- Note: tab and indentation settings apply to individual buffers. -buffer.tab_width = 2 -buffer.use_tabs = false ---buffer.indent = 2 -buffer.tab_indents = true -buffer.back_space_un_indents = true -buffer.indentation_guides = c.SC_IV_LOOKBOTH - --- Fold Margin Markers. -if not CURSES then - buffer:marker_define(c.SC_MARKNUM_FOLDEROPEN, c.SC_MARK_ARROWDOWN) - buffer:marker_define(c.SC_MARKNUM_FOLDER, c.SC_MARK_ARROW) - buffer:marker_define(c.SC_MARKNUM_FOLDERSUB, c.SC_MARK_EMPTY) - buffer:marker_define(c.SC_MARKNUM_FOLDERTAIL, c.SC_MARK_EMPTY) - buffer:marker_define(c.SC_MARKNUM_FOLDEREND, c.SC_MARK_EMPTY) - buffer:marker_define(c.SC_MARKNUM_FOLDEROPENMID, c.SC_MARK_EMPTY) - buffer:marker_define(c.SC_MARKNUM_FOLDERMIDTAIL, c.SC_MARK_EMPTY) -end - --- Autocompletion. ---buffer.auto_c_cancel_at_start = false -buffer.auto_c_choose_single = true ---buffer.auto_c_auto_hide = false ---buffer.auto_c_max_height = ---buffer.auto_c_max_width = - --- Call Tips. -buffer.call_tip_use_style = buffer.tab_width * - buffer:text_width(c.STYLE_CALLTIP, ' ') - --- Folding. -buffer.property['fold'] = '1' -buffer.property['fold.by.indentation'] = '1' -buffer.property['fold.line.comments'] = '0' -buffer.fold_flags = not CURSES and c.SC_FOLDFLAG_LINEAFTER_CONTRACTED or 0 - --- Line Wrapping. ---buffer.wrap_mode = c.SC_WRAP_WORD ---buffer.wrap_visual_flags = c.SC_WRAPVISUALFLAG_MARGIN ---buffer.wrap_visual_flags_location = c.SC_WRAPVISUALFLAGLOC_END_BY_TEXT ---buffer.wrap_indent_mode = c.SC_WRAPINDENT_SAME ---buffer.wrap_start_indent = - --- Long Lines. ---buffer.edge_mode = not CURSES and c.EDGE_LINE or c.EDGE_BACKGROUND ---buffer.edge_column = 80 -- cgit v1.2.3