diakonos 0.8.11 → 0.9.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/CHANGELOG +433 -0
- data/LICENCE.md +675 -0
- data/bin/diakonos +6 -0
- data/diakonos-256-colour.conf +220 -0
- data/diakonos.conf +1802 -0
- data/help/about-help.dhf +31 -0
- data/help/clipboard.dhf +45 -0
- data/help/close-file.dhf +6 -0
- data/help/code-block-navigation.dhf +16 -0
- data/help/column-markers.dhf +15 -0
- data/help/config.dhf +69 -0
- data/help/cursor-stack.dhf +19 -0
- data/help/delete.dhf +41 -0
- data/help/extensions.dhf +125 -0
- data/help/file-type.dhf +24 -0
- data/help/key-mapping.dhf +127 -0
- data/help/line-numbers.dhf +22 -0
- data/help/macros.dhf +27 -0
- data/help/new-file.dhf +6 -0
- data/help/open-file.dhf +21 -0
- data/help/quit.dhf +7 -0
- data/help/resizing.dhf +19 -0
- data/help/ruby.dhf +17 -0
- data/help/save-file.dhf +10 -0
- data/help/scripting.dhf +92 -0
- data/help/search.dhf +103 -0
- data/help/shell.dhf +60 -0
- data/help/speed.dhf +23 -0
- data/help/support.dhf +15 -0
- data/help/switch-buffers.dhf +15 -0
- data/help/tabs.dhf +36 -0
- data/help/undo.dhf +9 -0
- data/help/uninstall.dhf +18 -0
- data/help/welcome.dhf +32 -0
- data/help/word-wrap.dhf +17 -0
- data/lib/diakonos/about.rb +69 -0
- data/lib/diakonos/bookmark.rb +46 -0
- data/lib/diakonos/buffer/bookmarking.rb +47 -0
- data/lib/diakonos/buffer/cursor.rb +335 -0
- data/lib/diakonos/buffer/delete.rb +170 -0
- data/lib/diakonos/buffer/display.rb +356 -0
- data/lib/diakonos/buffer/file.rb +157 -0
- data/lib/diakonos/buffer/indentation.rb +175 -0
- data/lib/diakonos/buffer/searching.rb +552 -0
- data/lib/diakonos/buffer/selection.rb +360 -0
- data/lib/diakonos/buffer/undo.rb +73 -0
- data/lib/diakonos/buffer-hash.rb +60 -0
- data/lib/diakonos/buffer-management.rb +59 -0
- data/lib/diakonos/buffer.rb +698 -0
- data/lib/diakonos/clipboard-klipper-dbus.rb +62 -0
- data/lib/diakonos/clipboard-klipper.rb +62 -0
- data/lib/diakonos/clipboard-osx.rb +59 -0
- data/lib/diakonos/clipboard-xclip.rb +60 -0
- data/lib/diakonos/clipboard.rb +47 -0
- data/lib/diakonos/config-file.rb +67 -0
- data/lib/diakonos/config.rb +381 -0
- data/lib/diakonos/core-ext/enumerable.rb +15 -0
- data/lib/diakonos/core-ext/hash.rb +60 -0
- data/lib/diakonos/core-ext/object.rb +6 -0
- data/lib/diakonos/core-ext/regexp.rb +6 -0
- data/lib/diakonos/core-ext/string.rb +122 -0
- data/lib/diakonos/ctag.rb +28 -0
- data/lib/diakonos/cursor.rb +27 -0
- data/lib/diakonos/display/format.rb +75 -0
- data/lib/diakonos/display.rb +336 -0
- data/lib/diakonos/extension-set.rb +49 -0
- data/lib/diakonos/extension.rb +34 -0
- data/lib/diakonos/finding.rb +40 -0
- data/lib/diakonos/functions/basics.rb +34 -0
- data/lib/diakonos/functions/bookmarking.rb +61 -0
- data/lib/diakonos/functions/buffers.rb +489 -0
- data/lib/diakonos/functions/clipboard.rb +70 -0
- data/lib/diakonos/functions/cursor.rb +264 -0
- data/lib/diakonos/functions/grepping.rb +83 -0
- data/lib/diakonos/functions/indentation.rb +71 -0
- data/lib/diakonos/functions/readline.rb +93 -0
- data/lib/diakonos/functions/search.rb +179 -0
- data/lib/diakonos/functions/selection.rb +98 -0
- data/lib/diakonos/functions/sessions.rb +78 -0
- data/lib/diakonos/functions/shell.rb +250 -0
- data/lib/diakonos/functions/tags.rb +65 -0
- data/lib/diakonos/functions/text-manipulation.rb +196 -0
- data/lib/diakonos/functions-deprecated.rb +77 -0
- data/lib/diakonos/functions.rb +292 -0
- data/lib/diakonos/grep.rb +98 -0
- data/lib/diakonos/help.rb +47 -0
- data/lib/diakonos/hooks.rb +13 -0
- data/lib/diakonos/installation.rb +19 -0
- data/lib/diakonos/interaction-handler.rb +216 -0
- data/lib/diakonos/interaction.rb +52 -0
- data/lib/diakonos/key-map.rb +62 -0
- data/lib/diakonos/keying.rb +442 -0
- data/lib/diakonos/line-mover.rb +42 -0
- data/lib/diakonos/list.rb +59 -0
- data/lib/diakonos/logging.rb +27 -0
- data/lib/diakonos/mode.rb +17 -0
- data/lib/diakonos/mouse.rb +18 -0
- data/lib/diakonos/number-fitter.rb +11 -0
- data/lib/diakonos/range.rb +31 -0
- data/lib/diakonos/readline/functions.rb +82 -0
- data/lib/diakonos/readline.rb +222 -0
- data/lib/diakonos/search.rb +58 -0
- data/lib/diakonos/sessions.rb +257 -0
- data/lib/diakonos/sized-array.rb +48 -0
- data/lib/diakonos/text-mark.rb +19 -0
- data/lib/diakonos/vendor/fuzzy_file_finder.rb +365 -0
- data/lib/diakonos/version.rb +25 -0
- data/lib/diakonos/window.rb +43 -0
- data/lib/diakonos.rb +592 -0
- metadata +160 -68
@@ -0,0 +1,62 @@
|
|
1
|
+
module Diakonos
|
2
|
+
|
3
|
+
# Same interface as Diakonos::Clipboard, except interacts with Klipper in KDE4 (via dbus)
|
4
|
+
class ClipboardKlipperDBus
|
5
|
+
|
6
|
+
def initialize
|
7
|
+
end
|
8
|
+
|
9
|
+
# Returns true iff some text was copied to klipper.
|
10
|
+
def send_to_klipper( text )
|
11
|
+
return false if text.nil?
|
12
|
+
|
13
|
+
clip_filename = write_to_clip_file( text.join( "\n" ) )
|
14
|
+
|
15
|
+
# A little shell sorcery to ensure the shell doesn't strip off trailing newlines.
|
16
|
+
`clipping=$(cat #{clip_filename};printf "_"); dbus-send --type=method_call --dest=org.kde.klipper /klipper org.kde.klipper.klipper.setClipboardContents string:"${clipping%_}"`
|
17
|
+
true
|
18
|
+
end
|
19
|
+
|
20
|
+
def write_to_clip_file( text )
|
21
|
+
clip_filename = $diakonos.diakonos_home + "/clip.txt"
|
22
|
+
File.open( clip_filename, "w" ) do |f|
|
23
|
+
f.print text
|
24
|
+
end
|
25
|
+
clip_filename
|
26
|
+
end
|
27
|
+
|
28
|
+
# ------------------------------
|
29
|
+
|
30
|
+
def clip
|
31
|
+
text = `dbus-send --print-reply --dest=org.kde.klipper /klipper org.kde.klipper.klipper.getClipboardContents | awk 'BEGIN { output = ""; } { if ( NR > 1 ) { output = output $0 "\\n"; } } END { print substr(output, 12, length(output) - 13); }'`.split( "\n", -1 )
|
32
|
+
# getClipboardContents puts an extra newline on end; pop it off.
|
33
|
+
text.pop
|
34
|
+
text
|
35
|
+
end
|
36
|
+
|
37
|
+
# text is an array of Strings
|
38
|
+
# Returns true iff a clip was added,
|
39
|
+
# and only non-nil text can be added.
|
40
|
+
def add_clip( text )
|
41
|
+
return false if text.nil?
|
42
|
+
send_to_klipper text
|
43
|
+
end
|
44
|
+
|
45
|
+
# no-op.
|
46
|
+
def each
|
47
|
+
end
|
48
|
+
|
49
|
+
# text is an array of Strings (lines)
|
50
|
+
# Appends the lines to the current clip.
|
51
|
+
# If no current clip, then a new clip is created.
|
52
|
+
# Returns true iff the text was successfully appended.
|
53
|
+
def append_to_clip( text )
|
54
|
+
return false if text.nil?
|
55
|
+
|
56
|
+
last_clip = clip
|
57
|
+
last_clip.pop if last_clip[ -1 ] == ""
|
58
|
+
send_to_klipper last_clip + text
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
end
|
@@ -0,0 +1,62 @@
|
|
1
|
+
module Diakonos
|
2
|
+
|
3
|
+
# Same interface as Diakonos::Clipboard, except interacts with Klipper in KDE 3 (via dcop)
|
4
|
+
class ClipboardKlipper
|
5
|
+
|
6
|
+
def initialize
|
7
|
+
end
|
8
|
+
|
9
|
+
# Returns true iff some text was copied to klipper.
|
10
|
+
def send_to_klipper( text )
|
11
|
+
return false if text.nil?
|
12
|
+
|
13
|
+
clip_filename = write_to_clip_file( text.join( "\n" ) )
|
14
|
+
|
15
|
+
# A little shell sorcery to ensure the shell doesn't strip off trailing newlines.
|
16
|
+
`clipping=$(cat #{clip_filename};printf "_"); dcop klipper klipper setClipboardContents "${clipping%_}"`
|
17
|
+
true
|
18
|
+
end
|
19
|
+
|
20
|
+
def write_to_clip_file( text )
|
21
|
+
clip_filename = $diakonos.diakonos_home + "/clip.txt"
|
22
|
+
File.open( clip_filename, "w" ) do |f|
|
23
|
+
f.print text
|
24
|
+
end
|
25
|
+
clip_filename
|
26
|
+
end
|
27
|
+
|
28
|
+
# ------------------------------
|
29
|
+
|
30
|
+
def clip
|
31
|
+
text = `dcop klipper klipper getClipboardContents`.split( "\n", -1 )
|
32
|
+
# getClipboardContents puts an extra newline on end; pop it off.
|
33
|
+
text.pop
|
34
|
+
text
|
35
|
+
end
|
36
|
+
|
37
|
+
# text is an array of Strings
|
38
|
+
# Returns true iff a clip was added,
|
39
|
+
# and only non-nil text can be added.
|
40
|
+
def add_clip( text )
|
41
|
+
return false if text.nil?
|
42
|
+
send_to_klipper text
|
43
|
+
end
|
44
|
+
|
45
|
+
# no-op.
|
46
|
+
def each
|
47
|
+
end
|
48
|
+
|
49
|
+
# text is an array of Strings (lines)
|
50
|
+
# Appends the lines to the current clip.
|
51
|
+
# If no current clip, then a new clip is created.
|
52
|
+
# Returns true iff the text was successfully appended.
|
53
|
+
def append_to_clip( text )
|
54
|
+
return false if text.nil?
|
55
|
+
|
56
|
+
last_clip = clip
|
57
|
+
last_clip.pop if last_clip[ -1 ] == ""
|
58
|
+
send_to_klipper last_clip + text
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
end
|
@@ -0,0 +1,59 @@
|
|
1
|
+
module Diakonos
|
2
|
+
|
3
|
+
# Same interface as Diakonos::Clipboard, except interacts with pbcopy and
|
4
|
+
# pbpaste on OSX
|
5
|
+
class ClipboardOSX
|
6
|
+
|
7
|
+
def initialize
|
8
|
+
end
|
9
|
+
|
10
|
+
# @return true iff some text was copied to pbcopy
|
11
|
+
def send_to_pbcopy(text)
|
12
|
+
return false if text.nil?
|
13
|
+
|
14
|
+
clip_filename = write_to_clip_file( text.join( "\n" ) )
|
15
|
+
`pbcopy < #{clip_filename}`
|
16
|
+
|
17
|
+
true
|
18
|
+
end
|
19
|
+
|
20
|
+
# TODO: DRY this up with other Clipboard classes
|
21
|
+
def write_to_clip_file(text)
|
22
|
+
clip_filename = $diakonos.diakonos_home + "/clip.txt"
|
23
|
+
File.open( clip_filename, "w" ) do |f|
|
24
|
+
f.print text
|
25
|
+
end
|
26
|
+
clip_filename
|
27
|
+
end
|
28
|
+
|
29
|
+
# ------------------------------
|
30
|
+
|
31
|
+
def clip
|
32
|
+
`pbpaste`.split( "\n", -1 )
|
33
|
+
end
|
34
|
+
|
35
|
+
# @param [Array<String>] text
|
36
|
+
# @return true iff a clip was added
|
37
|
+
def add_clip(text)
|
38
|
+
send_to_pbcopy text
|
39
|
+
end
|
40
|
+
|
41
|
+
# no-op
|
42
|
+
def each
|
43
|
+
end
|
44
|
+
|
45
|
+
# @param [Array<String>] lines of text
|
46
|
+
# Appends the lines to the current clip.
|
47
|
+
# If no current clip, then a new clip is created.
|
48
|
+
# @return true iff the text was successfully appended
|
49
|
+
def append_to_clip(text)
|
50
|
+
return false if text.nil?
|
51
|
+
|
52
|
+
last_clip = clip
|
53
|
+
last_clip.pop if last_clip[-1] == ""
|
54
|
+
|
55
|
+
send_to_pbcopy last_clip + text
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
end
|
@@ -0,0 +1,60 @@
|
|
1
|
+
module Diakonos
|
2
|
+
|
3
|
+
# Same interface as Diakonos::Clipboard, except interacts with xclip
|
4
|
+
class ClipboardXClip
|
5
|
+
|
6
|
+
def initialize
|
7
|
+
end
|
8
|
+
|
9
|
+
# Returns true iff some text was copied to xclip.
|
10
|
+
def send_to_xclip( text )
|
11
|
+
return false if text.nil?
|
12
|
+
clip_filename = write_to_clip_file( text.join( "\n" ) )
|
13
|
+
t = Thread.new do
|
14
|
+
`xclip -i #{clip_filename}`
|
15
|
+
end
|
16
|
+
`xclip -o` # Unfreeze xclip
|
17
|
+
t.terminate
|
18
|
+
true
|
19
|
+
end
|
20
|
+
|
21
|
+
def write_to_clip_file( text )
|
22
|
+
clip_filename = $diakonos.diakonos_home + "/clip.txt"
|
23
|
+
File.open( clip_filename, "w" ) do |f|
|
24
|
+
f.print text
|
25
|
+
end
|
26
|
+
clip_filename
|
27
|
+
end
|
28
|
+
|
29
|
+
# ------------------------------
|
30
|
+
|
31
|
+
def clip
|
32
|
+
`xclip -o`.split( "\n", -1 )
|
33
|
+
end
|
34
|
+
|
35
|
+
# text is an array of Strings
|
36
|
+
# Returns true iff a clip was added,
|
37
|
+
# and only non-nil text can be added.
|
38
|
+
def add_clip( text )
|
39
|
+
return false if text.nil?
|
40
|
+
send_to_xclip text
|
41
|
+
end
|
42
|
+
|
43
|
+
# no-op.
|
44
|
+
def each
|
45
|
+
end
|
46
|
+
|
47
|
+
# text is an array of Strings (lines)
|
48
|
+
# Appends the lines to the current clip.
|
49
|
+
# If no current clip, then a new clip is created.
|
50
|
+
# Returns true iff the text was successfully appended.
|
51
|
+
def append_to_clip( text )
|
52
|
+
return false if text.nil?
|
53
|
+
|
54
|
+
last_clip = clip
|
55
|
+
last_clip.pop if last_clip[ -1 ] == ""
|
56
|
+
send_to_xclip last_clip + text
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
end
|
@@ -0,0 +1,47 @@
|
|
1
|
+
module Diakonos
|
2
|
+
|
3
|
+
class Clipboard
|
4
|
+
def initialize( max_clips )
|
5
|
+
@clips = Array.new
|
6
|
+
@max_clips = max_clips
|
7
|
+
end
|
8
|
+
|
9
|
+
def [] ( arg )
|
10
|
+
@clips[ arg ]
|
11
|
+
end
|
12
|
+
|
13
|
+
def clip
|
14
|
+
@clips[ 0 ]
|
15
|
+
end
|
16
|
+
|
17
|
+
# text is an array of Strings
|
18
|
+
# Returns true iff a clip was added,
|
19
|
+
# and only non-nil text can be added.
|
20
|
+
def add_clip( text )
|
21
|
+
return false if text.nil?
|
22
|
+
@clips.unshift text
|
23
|
+
@clips.pop if @clips.length > @max_clips
|
24
|
+
true
|
25
|
+
end
|
26
|
+
|
27
|
+
def each
|
28
|
+
@clips.each do |clip|
|
29
|
+
yield clip
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
# text is an array of Strings (lines)
|
34
|
+
# Appends the lines to the current clip.
|
35
|
+
# If no current clip, then a new clip is created.
|
36
|
+
# Returns true iff the text was successfully appended.
|
37
|
+
def append_to_clip( text )
|
38
|
+
return false if text.nil?
|
39
|
+
return add_clip( text ) if @clips.length == 0
|
40
|
+
last_clip = @clips[ 0 ]
|
41
|
+
last_clip.pop if last_clip[ -1 ] == ""
|
42
|
+
@clips[ 0 ] = last_clip + text
|
43
|
+
true
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
end
|
@@ -0,0 +1,67 @@
|
|
1
|
+
module Diakonos
|
2
|
+
# Should inheritance be used in this file instead?
|
3
|
+
|
4
|
+
module ConfigFileDescription
|
5
|
+
def to_s
|
6
|
+
"#{@filename}\t(#{self.inclusion_description})"
|
7
|
+
end
|
8
|
+
|
9
|
+
def name_as_includer
|
10
|
+
@filename
|
11
|
+
end
|
12
|
+
|
13
|
+
def inclusion_description
|
14
|
+
"included by #{@including_config_file.name_as_includer}"
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
class ConfigFile
|
19
|
+
attr_reader :filename
|
20
|
+
attr_accessor :problems
|
21
|
+
|
22
|
+
include ConfigFileDescription
|
23
|
+
|
24
|
+
def initialize(filename, including_config_file)
|
25
|
+
@filename, @including_config_file = filename, including_config_file
|
26
|
+
@problems = []
|
27
|
+
end
|
28
|
+
|
29
|
+
def ==(other_config_file)
|
30
|
+
@filename == other_config_file.filename
|
31
|
+
end
|
32
|
+
|
33
|
+
def each_line_with_index
|
34
|
+
# TODO: Refactor line_number into index, then +1 before yielding
|
35
|
+
IO.readlines(@filename).each_with_index do |line, line_number|
|
36
|
+
line.chomp!
|
37
|
+
# Skip comments
|
38
|
+
next if line[0] == ?#
|
39
|
+
|
40
|
+
yield line, line_number
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
class ConfigFileUnreadable
|
46
|
+
include ConfigFileDescription
|
47
|
+
|
48
|
+
def initialize(filename, including_config_file)
|
49
|
+
@filename, @including_config_file = filename, including_config_file
|
50
|
+
end
|
51
|
+
|
52
|
+
def problems
|
53
|
+
["Configuration file #{self} was not found"]
|
54
|
+
end
|
55
|
+
|
56
|
+
def each_line_with_index
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
class ConfigFileNull
|
61
|
+
include ConfigFileDescription
|
62
|
+
|
63
|
+
def name_as_includer
|
64
|
+
"Diakonos"
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|