summary refs log tree commit diff stats
path: root/ranger.py
blob: cd0c430562aebb0e56349dc7b898705fa9b9c9fa (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#!/usr/bin/python -O
# ranger - a vim-inspired file manager for the console  (coding: utf-8)
# Copyright (C) 2009-2013  Roman Zimbelmann <hut@lepus.uberspace.de>
# This software is distributed under the terms of the GNU GPL version 3.

# =====================
# This embedded bash script can be executed by sourcing this file.
# It will cd to ranger's last location after you exit it.
# The first argument specifies the command to run ranger, the
# default is simply "ranger". (Not this file itself!)
# The other arguments are passed to ranger.
"""":
tempfile='/tmp/chosendir'
ranger="${1:-ranger}"
test -z "$1" || shift
"$ranger" --choosedir="$tempfile" "${@:-$(pwd)}"
returnvalue=$?
test -f "$tempfile" &&
if [ "$(cat -- "$tempfile")" != "$(echo -n `pwd`)" ]; then
    cd "$(cat "$tempfile")"
    rm -f -- "$tempfile"
fi
return $returnvalue
""" and None

import sys
from os.path import exists, abspath

# Need to find out whether or not the flag --clean was used ASAP,
# because --clean is supposed to disable bytecode compilation
argv = sys.argv[1:sys.argv.index('--')] if '--' in sys.argv else sys.argv[1:]
sys.dont_write_bytecode = '-c' in argv or '--clean' in argv

# Don't import ./ranger when running an installed binary at /usr/.../ranger
if __file__[:4] == '/usr' and exists('ranger') and abspath('.') in sys.path:
    sys.path.remove(abspath('.'))

# Start ranger
import ranger
sys.exit(ranger.main())
mouse handler for titlebar (X) #71 10/03/21 previews: black/whitelist + read file (X) #79 10/04/08 tab number zero ( ) #80 10/04/08 when closing tabs, avoid gaps? (X) #81 10/04/15 system crash when previewing /proc/kcore with root permissions (X) #83 10/04/19 better ways to mark files. eg by regexp, filetype,.. ( ) #86 10/04/21 narg for move_parent ( ) #60 10/02/05 utf support improvable ( ) #91 10/05/12 in keys.py, fm.move(right=N) should run with mode=N ( ) #92 10/05/14 allow to enter the realpath of a directory ( ) #93 10/05/15 pause after running program Bugs (X) #17 10/01/01 why do bookmarks disappear sometimes? (X) #18 10/01/01 fix notify widget (by adding a LogView?) (X) #19 10/01/01 resizing after pressing g (X) #23 10/01/04 stop dir loading with ^C -> wont load anymore (X) #25 10/01/06 directories sometimes dont reload correctly (X) #26 10/01/06 :delete on symlinks of directories fails (X) #31 10/01/06 ^C breaks cd-after-exit by stopping sourced shell script (X) #40 10/01/17 freeze with unavailable sshfs Not rangers fault (?) (X) #41 10/01/17 capital file extensions are not recognized (X) #46 10/01/19 old username displayed after using su (X) #49 10/01/19 fix unit tests :'( (X) #52 10/01/23 special characters in tab completion (X) #54 10/01/23 max_dirsize_for_autopreview not working (X) #62 10/02/15 curs_set can raise an exception (X) #65 10/02/16 "source ranger ranger some/file.txt" shouldn't cd after exit (X) #67 10/03/08 terminal title in tty (X) #69 10/03/11 tab-completion breaks with Apps subclass (X) #73 10/03/21 when clicking on the first column, it goes 1x down (X) #74 10/03/21 console doesn't scroll (X) #78 10/03/31 broken preview when deleting all files in a directory (X) #85 10/04/26 no automatic reload of directory after using :filter (X) #87 10/05/10 files are not properly closed after previewing ( ) #88 10/05/10 race conditions for data loading from FS (X) #90 10/05/11 no link target for broken links ( ) #94 10/05/26 "pressed keys" text cut off when chaining ctrl-XYZ keys Ideas ( ) #20 10/01/01 use inotify to monitor filesystem changes ( ) #24 10/01/06 progress bar (X) #27 10/01/06 hide bookmarks in list which contain hidden dir (X) #28 10/01/06 use regexp instead of string for searching (X) #33 10/01/08 accelerate mousewheel speed won't do this (X) #45 10/01/18 hooks for events like setting changes (X) #53 10/01/23 merge fm and environment won't do this (X) #68 10/03/10 threads, to seperate ui and loading won't do this ( ) #72 10/03/21 ranger daemon which does the slow io tasks ( ) #75 10/03/28 navigate in history (X) #76 10/03/28 save history between sessions (X) #77 10/03/28 colorscheme overlay in options.py ( ) #82 10/04/19 :s command for batch renaming ( ) #84 10/04/25 use pygments for syntax highlighting ( ) #89 10/05/10 branch view Blocking ( ) #60 10/02/05 utf support improvable (X) #81 10/04/15 system crash when previewing /proc/kcore with root permissions