mirror of
https://github.com/Llewellynvdm/fzf.git
synced 2024-11-22 04:45:14 +00:00
Improve startup time
This commit is contained in:
parent
8f9dbc4c29
commit
f7efcc331a
19
fzf
19
fzf
@ -1,5 +1,5 @@
|
||||
# vim: set filetype=ruby isk=@,48-57,_,192-255:
|
||||
#!/usr/bin/env bash
|
||||
#!/usr/bin/env ruby
|
||||
# encoding: utf-8
|
||||
#
|
||||
# ____ ____
|
||||
# / __/___ / __/
|
||||
@ -35,10 +35,6 @@
|
||||
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
exec /usr/bin/env ruby -x "$0" $* 3>&1 1>&2 2>&3
|
||||
#!ruby
|
||||
# encoding: utf-8
|
||||
|
||||
def usage x
|
||||
puts %[usage: fzf [options]
|
||||
|
||||
@ -48,6 +44,9 @@ def usage x
|
||||
exit x
|
||||
end
|
||||
|
||||
stdout = $stdout.clone
|
||||
$stdout.reopen($stderr)
|
||||
|
||||
usage 0 unless (%w[--help -h] & ARGV).empty?
|
||||
@rxflag = ARGV.delete('+i') ? 0 : Regexp::IGNORECASE
|
||||
@sort = (ARGV.delete('+s') || ARGV.delete('--no-sort')) ? nil : 500
|
||||
@ -296,6 +295,7 @@ searcher = Thread.new {
|
||||
q = ''
|
||||
vcursor = 0
|
||||
zz = [0, 0]
|
||||
started = false
|
||||
|
||||
begin
|
||||
while true
|
||||
@ -396,7 +396,10 @@ searcher = Thread.new {
|
||||
end#new_search
|
||||
|
||||
# This small delay reduces the number of partial lists
|
||||
sleep 0.2 unless user_input
|
||||
if started && !user_input
|
||||
sleep 0.2
|
||||
end
|
||||
started = true
|
||||
|
||||
if events.delete(:vcursor) || new_search
|
||||
@mtx.synchronize do
|
||||
@ -538,6 +541,6 @@ begin
|
||||
end
|
||||
ensure
|
||||
C.close_screen
|
||||
$stderr.puts got if got
|
||||
stdout.puts got if got
|
||||
end
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user