fork/fish-shell

git clone https://git.julia.blue/fork/fish-shell

Fabian Boehmcompletions: More shortening5dc07c9e7

master
4.8 KiB103 linesraw
1# these don't work
2#complete vim -a - -d 'Read file from stdin, commands from stderr, which should be a tty'
3
4function __fish_vim_find_tags_path
5    set -l max_depth 10
6    set -l tags_path tags
7
8    for depth in (seq $max_depth)
9        if test -f $tags_path
10            echo $tags_path
11            return 0
12        end
13
14        set tags_path ../$tags_path
15    end
16
17    return 1
18end
19
20# NB: This function is also used by the nvim completions
21function __fish_vim_tags
22    set -l token (commandline -ct)
23    set -l tags_path (__fish_vim_find_tags_path)
24    or return
25
26    # To prevent freezes on a huge tags file (e.g., on one from the Linux
27    # kernel source tree), limit matching tag lines to some reasonable amount
28    set -l limit 10000
29
30    # tags file is alphabetically sorted, so it's reasonable to use "look" to
31    # speedup the lookup of strings with known prefix
32    command look $token $tags_path | head -n $limit | cut -f1,2 -d \t
33end
34
35# todo
36# +[num]        : Position the cursor on line number
37# +/{pat}       : Position the cursor on the first occurrence of {pat}
38# +{command}    : Execute Ex command after the first file has been read
39complete -c vim -s c -r -d 'Execute Ex command after the first file has been read'
40complete -c vim -s S -r -d 'Source file after the first file has been read'
41complete -c vim -l cmd -r -d 'Execute Ex command before loading any vimrc'
42complete -c vim -s d -r -d 'Use device as terminal (Amiga only)'
43complete -c vim -s i -r -d 'Set the viminfo file location'
44complete -c vim -s o -d 'Open horizontally split windows for each file'
45complete -c vim -o o2 -d 'Open two horizontally split windows' # actually -o[N]
46complete -c vim -s O -d 'Open vertically split windows for each file'
47complete -c nvim -o O2 -d 'Open two vertically split windows' # actually -O[N]
48complete -c vim -s p -d 'Open tab pages for each file'
49complete -c nvim -o p2 -d 'Open two tab pages' # actually -p[N]
50complete -c vim -s q -r -d 'Start in quickFix mode'
51complete -c vim -s r -r -d 'Use swap files for recovery'
52complete -c vim -s s -r -d 'Source and execute script file'
53complete -c vim -s t -xa '(__fish_vim_tags)' -d 'Set the cursor to tag'
54complete -c vim -s T -r -d 'Terminal name'
55complete -c vim -s u -r -d 'Use alternative vimrc'
56complete -c vim -s U -r -d 'Use alternative vimrc in GUI mode'
57complete -c vim -s w -r -d 'Record all typed characters'
58complete -c vim -s W -r -d 'Record all typed characters (overwrite file)'
59complete -c vim -s A -d 'Start in Arabic mode'
60complete -c vim -s b -d 'Start in binary mode'
61complete -c vim -s C -d 'Behave mostly like vi'
62complete -c vim -s d -d 'Start in diff mode'
63complete -c vim -s D -d 'Debugging mode'
64complete -c vim -s e -d 'Start in Ex mode'
65complete -c vim -s E -d 'Start in improved Ex mode'
66complete -c vim -s f -d 'Start in foreground mode'
67complete -c vim -s F -d 'Start in Farsi mode'
68complete -c vim -s g -d 'Start in GUI mode'
69complete -c vim -s h -d 'Print help message and exit'
70complete -c vim -s H -d 'Start in Hebrew mode'
71complete -c vim -s L -d 'List swap files'
72complete -c vim -s l -d 'Start in lisp mode'
73complete -c vim -s m -d 'Disable file modification'
74complete -c vim -s M -d 'Disallow file modification'
75complete -c vim -s N -d 'Reset compatibility mode'
76complete -c vim -s n -d 'Don\'t use swap files'
77complete -c vim -s R -d 'Read only mode'
78complete -c vim -s r -d 'List swap files'
79complete -c vim -s s -d 'Start in silent mode'
80complete -c vim -s V -d 'Start in verbose mode'
81complete -c vim -s v -d 'Start in vi mode'
82complete -c vim -s x -d 'Use encryption when writing files'
83complete -c vim -s X -d 'Don\'t connect to X server'
84complete -c vim -s y -d 'Start in easy mode'
85complete -c vim -s Z -d 'Start in restricted mode'
86complete -c vim -o nb -d 'Become an editor server for NetBeans'
87complete -c vim -l no-fork -d 'Start in foreground mode'
88complete -c vim -l echo-wid -d 'Echo the Window ID on stdout (GTK GUI only)'
89complete -c vim -l help -d 'Print help message and exit'
90complete -c vim -l literal -d 'Do not expand wildcards'
91complete -c vim -l noplugin -d 'Skip loading plugins'
92complete -c vim -l remote -d 'Edit files on Vim server'
93complete -c vim -l remote-expr -d 'Evaluate expr on Vim server'
94complete -c vim -l remote-send -d 'Send keys to Vim server'
95complete -c vim -l remote-silent -d 'Edit files on Vim server'
96complete -c vim -l remote-wait -d 'Edit files on Vim server'
97complete -c vim -l remote-wait-silent -d 'Edit files on Vim server'
98complete -c vim -l serverlist -d 'List all Vim servers that can be found'
99complete -c vim -l servername -d 'Set server name'
100complete -c vim -l version -d 'Print version information and exit'
101complete -c vim -l socketid -r -d 'Run gvim in another window (GTK GUI only)'
102complete -c vim -l clean -d 'Factory defaults: skip vimrc, plugins, viminfo'
103complete -c vim -l startuptime -r -d 'Write startup timing messages to <file>'