diff options
-rw-r--r-- | core/ext/key_commands.lua | 10 | ||||
-rw-r--r-- | core/ext/key_commands_mac.lua | 4 | ||||
-rw-r--r-- | core/ext/key_commands_std.lua | 4 | ||||
-rw-r--r-- | core/ext/menu.lua | 15 | ||||
-rw-r--r-- | core/locale.lua | 10 | ||||
-rw-r--r-- | modules/textadept/editing.lua | 76 |
6 files changed, 2 insertions, 117 deletions
diff --git a/core/ext/key_commands.lua b/core/ext/key_commands.lua index 21c6ec02..89d7903e 100644 --- a/core/ext/key_commands.lua +++ b/core/ext/key_commands.lua @@ -12,7 +12,7 @@ module('textadept.key_commands', package.seeall) A: A C G J K L O W X Z CS: C D J L Q R S T U W SA: A C D E G H I J K L M O Q R S T W X Z - CA: A C G H J K L O Q S T V W X Y Z + CA: A C D E G H J K L O Q S T U V W X Y Z CSA: C D G H J K L O Q R S T U W X Z ]]-- @@ -122,8 +122,6 @@ local m_editing = _m.textadept.editing keys.cm = { m_editing.match_brace } keys.csm = { m_editing.match_brace, 'select' } keys['c '] = { m_editing.autocomplete_word, '%w_' } -keys['a '] = { m_editing.autocomplete_word_from_dict, - '/usr/share/dict/cracklib-small' } keys.cq = { m_editing.block_comment } keys.cl = { m_editing.goto_line } keys.ck = { m_editing.smart_cutcopy, } @@ -135,13 +133,7 @@ keys.cw = { m_editing.current_word, 'delete' } keys.at = { m_editing.transpose_chars } keys.csh = { m_editing.squeeze, } keys.cj = { m_editing.join_lines } -keys.cau = { m_editing.move_line, 'up' } -keys.cad = { m_editing.move_line, 'down' } keys.csai = { m_editing.convert_indentation } -keys.cae = { -- code execution - r = { m_editing.ruby_exec }, - l = { m_editing.lua_exec } -} keys.ae = { -- enclose in... t = { m_editing.enclose, 'tag' }, st = { m_editing.enclose, 'single_tag' }, diff --git a/core/ext/key_commands_mac.lua b/core/ext/key_commands_mac.lua index a3e92f1b..258c91a9 100644 --- a/core/ext/key_commands_mac.lua +++ b/core/ext/key_commands_mac.lua @@ -54,16 +54,12 @@ keys.cq = { m_editing.block_comment } -- TODO: { m_editing.current_word, 'delete' } keys.ct = { m_editing.transpose_chars } -- TODO: { m_editing.squeeze } --- TODO: { m_editing.move_line, 'up' } --- TODO: { m_editing.move_line, 'down' } -- TODO: { m_editing.convert_indentation } keys.ck = { m_editing.smart_cutcopy } -- TODO: { m_editing.smart_cutcopy, 'copy' } keys.cy = { m_editing.smart_paste } keys.ay = { m_editing.smart_paste, 'cycle' } keys.say = { m_editing.smart_paste, 'reverse' } --- TODO: { m_editing.ruby_exec } --- TODO: { m_editing.lua_exec } keys.cc = { -- enClose in... t = { m_editing.enclose, 'tag' }, st = { m_editing.enclose, 'single_tag' }, diff --git a/core/ext/key_commands_std.lua b/core/ext/key_commands_std.lua index 9327da18..b6db26b6 100644 --- a/core/ext/key_commands_std.lua +++ b/core/ext/key_commands_std.lua @@ -54,16 +54,12 @@ keys.cq = { m_editing.block_comment } -- TODO: { m_editing.current_word, 'delete' } -- TODO: { m_editing.transpose_chars } -- TODO: { m_editing.squeeze } --- TODO: { m_editing.move_line, 'up' } --- TODO: { m_editing.move_line, 'down' } -- TODO: { m_editing.convert_indentation } -- TODO: { m_editing.smart_cutcopy } -- TODO: { m_editing.smart_cutcopy, 'copy' } -- TODO: { m_editing.smart_paste } -- TODO: { m_editing.smart_paste, 'cycle' } -- TODO: { m_editing.smart_paste, 'reverse' } --- TODO: { m_editing.ruby_exec } --- TODO: { m_editing.lua_exec } keys.ac = { -- enClose in... t = { m_editing.enclose, 'tag' }, st = { m_editing.enclose, 'single_tag' }, diff --git a/core/ext/menu.lua b/core/ext/menu.lua index 54f4a501..9124f748 100644 --- a/core/ext/menu.lua +++ b/core/ext/menu.lua @@ -40,16 +40,12 @@ local ID = { TRANSPOSE_CHARACTERS = 212, SQUEEZE = 213, JOIN_LINES = 245, - MOVE_LINE_UP = 214, - MOVE_LINE_DOWN = 215, CONVERT_INDENTATION = 216, CUT_TO_LINE_END = 217, COPY_TO_LINE_END = 218, PASTE_FROM_RING = 219, PASTE_NEXT_FROM_RING = 220, PASTE_PREV_FROM_RING = 221, - EXECUTE_AS_RUBY = 222, - EXECUTE_AS_LUA = 223, ENCLOSE_IN_HTML_TAGS = 224, ENCLOSE_IN_HTML_SINGLE_TAG = 225, ENCLOSE_IN_DOUBLE_QUOTES = 226, @@ -228,8 +224,6 @@ t.menubar = { { l.MENU_EDIT_TRANSPOSE_CHARACTERS, ID.TRANSPOSE_CHARACTERS }, { l.MENU_EDIT_SQUEEZE, ID.SQUEEZE }, { l.MENU_EDIT_JOIN_LINES, ID.JOIN_LINES }, - { l.MENU_EDIT_MOVE_LINE_UP, ID.MOVE_LINE_UP }, - { l.MENU_EDIT_MOVE_LINE_DOWN, ID.MOVE_LINE_DOWN }, { l.MENU_EDIT_CONVERT_INDENTATION, ID.CONVERT_INDENTATION }, { title = l.MENU_EDIT_KR_TITLE, { l.MENU_EDIT_KR_CUT_TO_LINE_END, ID.CUT_TO_LINE_END }, @@ -239,10 +233,6 @@ t.menubar = { { l.MENU_EDIT_KR_PASTE_PREV_FROM, ID.PASTE_PREV_FROM_RING }, }, { title = l.MENU_EDIT_SEL_TITLE, - { title = l.MENU_EDIT_SEL_EXEC_TITLE, - { l.MENU_EDIT_SEL_EXEC_AS_RUBY, ID.EXECUTE_AS_RUBY }, - { l.MENU_EDIT_SEL_EXEC_AS_LUA, ID.EXECUTE_AS_LUA }, - }, { title = l.MENU_EDIT_SEL_ENC_TITLE, { l.MENU_EDIT_SEL_ENC_HTML_TAGS, ID.ENCLOSE_IN_HTML_TAGS }, { l.MENU_EDIT_SEL_ENC_HTML_SINGLE_TAG, ID.ENCLOSE_IN_HTML_SINGLE_TAG }, @@ -471,8 +461,6 @@ local actions = { [ID.TRANSPOSE_CHARACTERS] = { m_editing.transpose_chars }, [ID.SQUEEZE] = { m_editing.squeeze }, [ID.JOIN_LINES] = { m_editing.join_lines }, - [ID.MOVE_LINE_UP] = { m_editing.move_line, 'up' }, - [ID.MOVE_LINE_DOWN] = { m_editing.move_line, 'down' }, [ID.CONVERT_INDENTATION] = { m_editing.convert_indentation }, -- Edit -> Kill Ring [ID.CUT_TO_LINE_END] = { m_editing.smart_cutcopy }, @@ -480,9 +468,6 @@ local actions = { [ID.PASTE_FROM_RING] = { m_editing.smart_paste }, [ID.PASTE_NEXT_FROM_RING] = { m_editing.smart_paste, 'cycle' }, [ID.PASTE_PREV_FROM_RING] = { m_editing.smart_paste, 'reverse' }, - -- Edit -> Selection -> Execute as... - [ID.EXECUTE_AS_RUBY] = { m_editing.ruby_exec }, - [ID.EXECUTE_AS_LUA] = { m_editing.lua_exec }, -- Edit -> Selection -> Enclose in... [ID.ENCLOSE_IN_HTML_TAGS] = { m_editing.enclose, 'tag' }, [ID.ENCLOSE_IN_HTML_SINGLE_TAG] = { m_editing.enclose, 'single_tag' }, diff --git a/core/locale.lua b/core/locale.lua index 4eaa2177..20895638 100644 --- a/core/locale.lua +++ b/core/locale.lua @@ -154,10 +154,6 @@ MENU_EDIT_TRANSPOSE_CHARACTERS = 'Tran_spose Characters' MENU_EDIT_SQUEEZE = 'S_queeze' -- _Join Lines MENU_EDIT_JOIN_LINES = '_Join Lines' --- _Move Line Up -MENU_EDIT_MOVE_LINE_UP = '_Move Line Up' --- Mo_ve Line Down -MENU_EDIT_MOVE_LINE_DOWN = 'Mo_ve Line Down' -- Convert _Indentation MENU_EDIT_CONVERT_INDENTATION = 'Convert _Indentation' -- _Kill Ring @@ -174,12 +170,6 @@ MENU_EDIT_KR_PASTE_NEXT_FROM = 'Paste _Next From' MENU_EDIT_KR_PASTE_PREV_FROM = 'Paste _Previous From' -- S_election MENU_EDIT_SEL_TITLE = 'S_election' --- E_xecute as... -MENU_EDIT_SEL_EXEC_TITLE = 'E_xecute as...' --- _Ruby -MENU_EDIT_SEL_EXEC_AS_RUBY = '_Ruby' --- _Lua -MENU_EDIT_SEL_EXEC_AS_LUA = '_Lua' -- _Enclose in... MENU_EDIT_SEL_ENC_TITLE = '_Enclose in...' -- _HTML Tags diff --git a/modules/textadept/editing.lua b/modules/textadept/editing.lua index 2d10b56e..caf6daa0 100644 --- a/modules/textadept/editing.lua +++ b/modules/textadept/editing.lua @@ -151,25 +151,6 @@ function autocomplete_word(word_chars) end --- --- Pops up an autocompletion list for the current word based on the path to a --- dictionary of words. --- @param dict Path to a dictionary of words. -function autocomplete_word_from_dict(dict) - local buffer = buffer - local start = buffer:word_start_position(buffer.current_pos, true) - local root = buffer:text_range(start, buffer.current_pos) - if #root == 0 then return end - local f = io.open(dict) - if not f then return end - local c_list = {} - for line in f:lines() do - if line:find('^'..root) then c_list[#c_list + 1] = line end - end - f:close() - if #c_list > 0 then buffer:auto_c_show(#root, table.concat(c_list, ' ')) end -end - ---- -- Displays a call tip based on the word to the left of the cursor and a given -- API table. -- @param api Table of functions call tips can be displayed for. Each key is a @@ -384,7 +365,7 @@ end --- -- Transposes characters intelligently. --- If the carat is at the end of the current word, the two characters before +-- If the caret is at the end of the current word, the two characters before -- the caret are transposed. Otherwise the characters to the left and right of -- the caret are transposed. function transpose_chars() @@ -431,25 +412,6 @@ function join_lines() end --- --- Moves the current line in the specified direction up or down. --- @param direction 'up' moves the current line up, 'down' moves it down. -function move_line(direction) - local buffer = buffer - local column = buffer.column[buffer.current_pos] - buffer:begin_undo_action() - if direction == 'up' then - buffer:line_transpose() - buffer:line_up() - elseif direction == 'down' then - buffer:line_down() - buffer:line_transpose() - column = buffer.current_pos + column -- starts at line home - buffer:goto_pos(column) - end - buffer:end_undo_action() -end - ---- -- Encloses text in an enclosure set. -- If text is selected, it is enclosed. Otherwise, the previous word is -- enclosed. The n previous words can be enclosed by appending n (a number) to @@ -600,29 +562,6 @@ function select_scope() end --- --- Executes the selection or contents of the current line as Ruby code, --- replacing the text with the output. -function ruby_exec() - local buffer = buffer - local txt = get_sel_or_line() - local p = io.popen("ruby 2>&1 <<'_EOF'\n"..txt..'\n_EOF') - local out = p:read('*all') - p:close() - if out:sub(-1) == '\n' then out = out:sub(1, -2) end -- chomp - buffer:replace_sel(out) -end - ---- --- Executes the selection or contents of the current line as Lua code, --- replacing the text with the output. -function lua_exec() - local buffer = buffer - local txt = get_sel_or_line() - loadstring(txt) - buffer:goto_pos(buffer.current_pos) -end - ---- -- Converts indentation between tabs and spaces. function convert_indentation() local buffer = buffer @@ -647,19 +586,6 @@ function convert_indentation() end --- --- Reformats the selected text or current paragraph using the 'fmt' command. -function reformat_paragraph() - local buffer = buffer - if buffer:get_sel_text() == '' then select_paragraph() end - local txt = buffer:get_sel_text() - local p = io.popen("fmt -c -w 80 <<'_EOF'\n"..txt..'\n_EOF') - local out = p:read('*all') - p:close() - if txt:sub(-1) ~= '\n' and out:sub(-1) == '\n' then out = out:sub(1, -2) end - buffer:replace_sel(out) -end - ---- -- [Local function] Inserts text into kill_ring. -- If it grows larger than maxn, the oldest inserted text is replaced. -- @see smart_cutcopy |