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 ruby
|
||||||
#!/usr/bin/env bash
|
# encoding: utf-8
|
||||||
#
|
#
|
||||||
# ____ ____
|
# ____ ____
|
||||||
# / __/___ / __/
|
# / __/___ / __/
|
||||||
@ -35,10 +35,6 @@
|
|||||||
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||||
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
# 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
|
def usage x
|
||||||
puts %[usage: fzf [options]
|
puts %[usage: fzf [options]
|
||||||
|
|
||||||
@ -48,6 +44,9 @@ def usage x
|
|||||||
exit x
|
exit x
|
||||||
end
|
end
|
||||||
|
|
||||||
|
stdout = $stdout.clone
|
||||||
|
$stdout.reopen($stderr)
|
||||||
|
|
||||||
usage 0 unless (%w[--help -h] & ARGV).empty?
|
usage 0 unless (%w[--help -h] & ARGV).empty?
|
||||||
@rxflag = ARGV.delete('+i') ? 0 : Regexp::IGNORECASE
|
@rxflag = ARGV.delete('+i') ? 0 : Regexp::IGNORECASE
|
||||||
@sort = (ARGV.delete('+s') || ARGV.delete('--no-sort')) ? nil : 500
|
@sort = (ARGV.delete('+s') || ARGV.delete('--no-sort')) ? nil : 500
|
||||||
@ -296,6 +295,7 @@ searcher = Thread.new {
|
|||||||
q = ''
|
q = ''
|
||||||
vcursor = 0
|
vcursor = 0
|
||||||
zz = [0, 0]
|
zz = [0, 0]
|
||||||
|
started = false
|
||||||
|
|
||||||
begin
|
begin
|
||||||
while true
|
while true
|
||||||
@ -396,7 +396,10 @@ searcher = Thread.new {
|
|||||||
end#new_search
|
end#new_search
|
||||||
|
|
||||||
# This small delay reduces the number of partial lists
|
# 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
|
if events.delete(:vcursor) || new_search
|
||||||
@mtx.synchronize do
|
@mtx.synchronize do
|
||||||
@ -538,6 +541,6 @@ begin
|
|||||||
end
|
end
|
||||||
ensure
|
ensure
|
||||||
C.close_screen
|
C.close_screen
|
||||||
$stderr.puts got if got
|
stdout.puts got if got
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user