summary refs log tree commit diff stats
path: root/README
blob: 52a0b66cc1d7353425a5d961fd19c09c7d430c58 (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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
ranger v.1.5.5
==============
ranger is a console file manager with VI key bindings.  It provides a
minimalistic and nice curses interface with a view on the directory hierarchy.
The secondary task of ranger is to figure out which program you want to use to
open your files with.

This file describes ranger and how to get it to run.  For instructions on the
usage, please read the man page.  See doc/HACKING for development specific
information.  For configuration, check the files in ranger/config/.  They
are usually installed to /usr/lib/python*/site-packages/ranger/config/
and can be obtained with ranger's --copy-config option.

A note to packagers:  Versions meant for packaging are listed in the changelog
on the website.


About
-----
* Authors:     Check the copyright notices in each source file
* License:     GNU General Public License Version 3

* Website:     http://ranger.nongnu.org/
* Download:    http://ranger.nongnu.org/ranger-stable.tar.gz
* Bug reports: https://savannah.nongnu.org/bugs/?group=ranger&func=additem
* git clone    http://git.sv.gnu.org/r/ranger.git


Design Goals
------------
* An easily maintainable file manager in a high level language
* A quick way to switch directories and browse the file system
* Keep it small but useful, do one thing and do it well
* Console based, with smooth integration into the unix shell


Features
--------
* UTF-8 Support  (if your python copy supports it)
* Multi-column display
* Preview of the selected file/directory
* Common file operations (create/chmod/copy/delete/...)
* Renaming multiple files at once
* VIM-like console and hotkeys
* Automatically determine file types and run them with correct programs
* Change the directory of your shell after exiting ranger
* Tabs, Bookmarks, Mouse support


Dependencies
------------
* Python (tested with version 2.6, 2.7, 3.1, 3.2) with support for ncurses
  and (optionally) wide-unicode.
* A pager ("less" by default)

Optional:
* The "file" program for determining file types
* The python module "chardet", in case of encoding detection problems
* "sudo" to use the "run as root"-feature
* w3m for the "w3mimgdisplay" program to preview images

Optional, for enhanced file previews (with "scope.sh"):
* bash for running scope.sh
* img2txt (from caca-utils) for previewing images
* highlight for syntax highlighting of code
* atool for previews of archives
* lynx, w3m or elinks for previews of html pages
* pdftotext for pdf previews
* transmission-show for viewing bit-torrent information
* mediainfo for viewing information about media files


Installing
----------
Use the package manager of your operating system to install ranger.
Note that ranger can be started without installing by simply running ranger.py.

To install ranger manually:
    sudo make install

This translates roughly to:
    sudo python setup.py install --optimize=1 --record=install_log.txt

This also saves a list of all installed files to install_log.txt, which you can
use to uninstall ranger.


Getting Started
---------------
After starting ranger, you can use the Arrow Keys (or hjkl) to navigate, Enter
to open a file or type Q to quit.  The third column shows a preview of the
current file.  The second is the main column and the first shows the parent
directory.

Ranger can automatically copy default configuration files to ~/.config/ranger
if you run it with the switch --copy-config. (see ranger --help for a
description of that switch.)  Also check ranger/config/ for the default
configuration.
itle='author Kartik K. Agaram <vc@akkartik.com> 2016-12-11 16:18:18 -0800 committer Kartik K. Agaram <vc@akkartik.com> 2016-12-11 16:18:18 -0800 3705 - switch to tested file-system primitives' href='/akkartik/mu/commit/edit/010-sandbox-trace.mu?h=hlt&id=294b2ab35983ebe95698835bb54bca8bd3eec101'>294b2ab3 ^
6f65d591 ^
55479bc2 ^
a90faae9 ^


dd30f56d ^
294b2ab3 ^

898f03cc ^
294b2ab3 ^
71056d61 ^
a90faae9 ^

dd30f56d ^
71056d61 ^
ceeb92d4 ^
71056d61 ^


a90faae9 ^


dd30f56d ^
a90faae9 ^

294b2ab3 ^
55479bc2 ^
a90faae9 ^


dd30f56d ^
294b2ab3 ^

898f03cc ^
294b2ab3 ^
ceeb92d4 ^
71056d61 ^
a90faae9 ^



6f65d591 ^
e00d4854 ^
dd30f56d ^
a90faae9 ^
294b2ab3 ^








6d12a8c4 ^
a90faae9 ^
a90faae9 ^


294b2ab3 ^
a90faae9 ^
dd30f56d ^
294b2ab3 ^

898f03cc ^
294b2ab3 ^

ceeb92d4 ^
71056d61 ^
a90faae9 ^
fa94f4d9 ^
a90faae9 ^
dd30f56d ^
a90faae9 ^

294b2ab3 ^
a90faae9 ^
fa94f4d9 ^
a90faae9 ^
dd30f56d ^
294b2ab3 ^

898f03cc ^
294b2ab3 ^

71056d61 ^

ceeb92d4 ^
71056d61 ^
9c2421ec ^



6f65d591 ^
9c2421ec ^

294b2ab3 ^


6d12a8c4 ^
9c2421ec ^
9c2421ec ^



294b2ab3 ^
9c2421ec ^

71056d61 ^
ceeb92d4 ^
898f03cc ^
71056d61 ^

9c2421ec ^





294b2ab3 ^
9c2421ec ^



71056d61 ^
ceeb92d4 ^
898f03cc ^
71056d61 ^

a90faae9 ^


2d91279b ^
e2b367dc ^
3d8b137c ^
b4bccf49 ^


2d91279b ^
b4bccf49 ^
350ca0c6 ^
ea19d0dc ^
3d8b137c ^
ea5e7fd4 ^


b4bccf49 ^

a90faae9 ^

fa94f4d9 ^
a90faae9 ^
3d8b137c ^


a90faae9 ^
2d91279b ^
a90faae9 ^
3d8b137c ^


a90faae9 ^

2d91279b ^
a90faae9 ^

3d8b137c ^
ea5e7fd4 ^

4e7186fa ^
ea5e7fd4 ^
ada5eb55 ^
a90faae9 ^


2d91279b ^
a90faae9 ^
350ca0c6 ^
a90faae9 ^
350ca0c6 ^
3d8b137c ^

a90faae9 ^


2d91279b ^
a90faae9 ^
3d8b137c ^

a90faae9 ^




3d8b137c ^




a90faae9 ^

1ead3562 ^
a90faae9 ^
1ead3562 ^
a90faae9 ^




3d8b137c ^
a90faae9 ^
ea19d0dc ^
a90faae9 ^
afdda1ea ^
a90faae9 ^
8beff53e ^
a90faae9 ^
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253


                                                              
             
                                       
                                    
                







                                                                           
                                
          


                  
                                            
                         
                                                                                                          

                                                                                                                                                                                                              
                                                                                                            
                                                                                                            
                                                                                                                                                                                                                                                                                                                  
                                                                                                            
   
                                    
                  
                    

       
                                              
                                
                        


                                                      
                                                                                                          

                                                                                                                                                                                                              
                                                                                                            
                                                                                                            
                                                                                                                                                                                                                

                                            
                                                                                                          
                                                                                                            
                                                                                                                                                                                                              


                                                                                                                                                                                                                


                                  
                    

       
                                              
                        


                         
                                                                                                          

                                                                                                                                                                                                              
                                                                                                            
                                                                                                            
                                                                                                                                                                                                                                                                                                                  
                                                                                                            



                                             
             
                                       
                                    
                








                                                                           
                                
          


                  
                                            
                         
                                                                                                          

                                                                                                                                                                                                              
                                                                                                            

                                                                                                            
                                                                                                                                                                                                                                                                                                                  
                                                                                                            
   
                                    
                  
                    

       
                                              
   
                                  
                         
                                                                                                          

                                                                                                                                                                                                              
                                                                                                            

                                                                                                            

                                                                                                                                                                                                                
                                                                                                                                                                                                              
                                                                                                            



                                             
             

                                       


                                                                                       
                                
                               



                    
                                            

                                                                                                          
                                                                                                            
                                                                                                                                                                                                                                                                                                                  
                                                                                                            

                                                                                                            





                                                                                         
                                              



                                                                                                          
                                                                                                            
                                                                                                                                                                                                                                                                                                                  
                                                                                                            

                                                                                                            


   
                   
            
                     


                           
                                                                                                           
             
                  
                                        
                                                                          


                                                      

 

                                                       
                                                
   


                                                                               
                                 
                                                       
                              


                                                                                  

                                                         
                                                                  

                                        
                                                 

                                                      
                                                     
                                                                                    
                    


   
                                                                                      
             
                  
                                                      
                                     

                                                                 


                                                                                   
                                                               
                             

                                                                      




                                                 




                                                                             

                                   
                                       
   
                




                                                                                                    
                                                              
                               
                                                    
                                                           
                                                                                
   
                             
 
## clicking on the code typed into a sandbox toggles its trace

scenario sandbox-click-on-code-toggles-app-trace [
  local-scope
  trace-until 100/app  # trace too long
  assume-screen 100/width, 10/height
  # basic recipe
  assume-resources [
    [lesson/recipes.mu] <- [
      |recipe foo [|
      |  stash [abc]|
      |]|
    ]
  ]
  env:&:environment <- new-programming-environment resources, screen, [foo]
  render-all screen, env, render
  # run it
  assume-console [
    press F4
  ]
  event-loop screen, console, env, resources
  screen-should-contain [
    .                                                                                 run (F4)           .
    .recipe foo [                                                                                       .
    .  stash [abc]                                     ┊─────────────────────────────────────────────────.
    .]                                                 0   edit       copy       to recipe    delete    .
    .                                                  foo                                              .
    .┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┊─────────────────────────────────────────────────.
    .                                                                                                   .
  ]
  # click on the code in the sandbox
  assume-console [
    left-click 4, 51
  ]
  run [
    event-loop screen, console, env, resources
    cursor:char <- copy 9251/    print screen, cursor
  ]
  # trace now printed and cursor shouldn't have budged
  screen-should-contain [
    .                                                                                 run (F4)           .
    .ecipe foo [                                                                                       .
    .  stash [abc]                                     ┊─────────────────────────────────────────────────.
    .]                                                 0   edit       copy       to recipe    delete    .
    .                                                  foo                                              .
    .┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┊abc                                              .
  ]
  screen-should-contain-in-color 245/grey, [
    .                                                                                                    .
    .                                                                                                   .
    .                                                  ┊─────────────────────────────────────────────────.
    .                                                                                                   .
    .                                                                                                   .
    .┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┊abc                                              .
  ]
  # click again on the same region
  assume-console [
    left-click 4, 55
  ]
  run [
    event-loop screen, console, env, resources
    print screen, cursor
  ]
  # trace hidden again
  screen-should-contain [
    .                                                                                 run (F4)           .
    .ecipe foo [                                                                                       .
    .  stash [abc]                                     ┊─────────────────────────────────────────────────.
    .]                                                 0   edit       copy       to recipe    delete    .
    .                                                  foo                                              .
    .┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┊─────────────────────────────────────────────────.
    .                                                                                                   .
  ]
]

scenario sandbox-shows-app-trace-and-result [
  local-scope
  trace-until 100/app  # trace too long
  assume-screen 100/width, 10/height
  # basic recipe
  assume-resources [
    [lesson/recipes.mu] <- [
      |recipe foo [|
      |  stash [abc]|
      |  reply 4|
      |]|
    ]
  ]
  env:&:environment <- new-programming-environment resources, screen, [foo]
  render-all screen, env, render
  # run it
  assume-console [
    press F4
  ]
  event-loop screen, console, env, resources
  screen-should-contain [
    .                                                                                 run (F4)           .
    .recipe foo [                                                                                       .
    .  stash [abc]                                     ┊─────────────────────────────────────────────────.
    .  reply 4                                         0   edit       copy       to recipe    delete    .
    .]                                                 foo                                              .
    .                                                  4                                                .
    .┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┊─────────────────────────────────────────────────.
    .                                                                                                   .
  ]
  # click on the code in the sandbox
  assume-console [
    left-click 4, 51
  ]
  run [
    event-loop screen, console, env, resources
  ]
  # trace now printed above result
  screen-should-contain [
    .                                                                                 run (F4)           .
    .recipe foo [                                                                                       .
    .  stash [abc]                                     ┊─────────────────────────────────────────────────.
    .  reply 4                                         0   edit       copy       to recipe    delete    .
    .]                                                 foo                                              .
    .                                                  abc                                              .
    .┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┊8 instructions run                               .
    .                                                  4                                                .
    .                                                  ┊─────────────────────────────────────────────────.
    .                                                                                                   .
  ]
]

scenario clicking-on-app-trace-does-nothing [
  local-scope
  trace-until 100/app  # trace too long
  assume-screen 100/width, 10/height
  assume-resources [
  ]
  env:&:environment <- new-programming-environment resources, screen, [stash 123456789]
  render-all screen, env, render
  # create and expand the trace
  assume-console [
    press F4
    left-click 4, 51
  ]
  event-loop screen, console, env, resources
  screen-should-contain [
    .                                                                                 run (F4)           .
    .                                                                                                   .
    .┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┊─────────────────────────────────────────────────.
    .                                                  0   edit       copy       to recipe    delete    .
    .                                                  stash 123456789                                  .
    .                                                  123456789                                        .
  ]
  # click on the stash under the edit-button region (or any of the other buttons, really)
  assume-console [
    left-click 5, 57
  ]
  run [
    event-loop screen, console, env, resources
  ]
  # no change; doesn't die
  screen-should-contain [
    .                                                                                 run (F4)           .
    .                                                                                                   .
    .┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┊─────────────────────────────────────────────────.
    .                                                  0   edit       copy       to recipe    delete    .
    .                                                  stash 123456789                                  .
    .                                                  123456789                                        .
  ]
]

container sandbox [
  trace:text
  display-trace?:bool
]

# replaced in a later layer
def! update-sandbox sandbox:&:sandbox, env:&:environment, idx:num -> sandbox:&:sandbox, env:&:environment [
  local-scope
  load-ingredients
  data:text <- get *sandbox, data:offset
  response:text, _, fake-screen:&:screen, trace:text <- run-sandboxed data
  *sandbox <- put *sandbox, response:offset, response
  *sandbox <- put *sandbox, screen:offset, fake-screen
  *sandbox <- put *sandbox, trace:offset, trace
]

# clicks on sandbox code toggle its display-trace? flag
after <global-touch> [
  # check if it's inside the code of any sandbox
  {
    sandbox-left-margin:num <- get *current-sandbox, left:offset
    click-column:num <- get t, column:offset
    on-sandbox-side?:bool <- greater-or-equal click-column, sandbox-left-margin
    break-unless on-sandbox-side?
    first-sandbox:&:sandbox <- get *env, sandbox:offset
    break-unless first-sandbox
    first-sandbox-begins:num <- get *first-sandbox, starting-row-on-screen:offset
    click-row:num <- get t, row:offset
    below-sandbox-editor?:bool <- greater-or-equal click-row, first-sandbox-begins
    break-unless below-sandbox-editor?
    # identify the sandbox whose code is being clicked on
    sandbox:&:sandbox <- find-click-in-sandbox-code env, click-row
    break-unless sandbox
    # toggle its display-trace? property
    x:bool <- get *sandbox, display-trace?:offset
    x <- not x
    *sandbox <- put *sandbox, display-trace?:offset, x
    screen <- render-sandbox-side screen, env, render
    screen <- update-cursor screen, recipes, current-sandbox, sandbox-in-focus?, env
    loop +next-event
  }
]

def find-click-in-sandbox-code env:&:environment, click-row:num -> sandbox:&:sandbox [
  local-scope
  load-ingredients
  # assert click-row >= sandbox.starting-row-on-screen
  sandbox <- get *env, sandbox:offset
  start:num <- get *sandbox, starting-row-on-screen:offset
  clicked-on-sandboxes?:bool <- greater-or-equal click-row, start
  assert clicked-on-sandboxes?, [extract-sandbox called on click to sandbox editor]
  # while click-row < sandbox.next-sandbox.starting-row-on-screen
  {
    next-sandbox:&:sandbox <- get *sandbox, next-sandbox:offset
    break-unless next-sandbox
    next-start:num <- get *next-sandbox, starting-row-on-screen:offset
    found?:bool <- lesser-than click-row, next-start
    break-if found?
    sandbox <- copy next-sandbox
    loop
  }
  # return sandbox if click is in its code region
  code-ending-row:num <- get *sandbox, code-ending-row-on-screen:offset
  click-above-response?:bool <- lesser-than click-row, code-ending-row
  start:num <- get *sandbox, starting-row-on-screen:offset
  click-below-menu?:bool <- greater-than click-row, start
  click-on-sandbox-code?:bool <- and click-above-response?, click-below-menu?
  {
    break-if click-on-sandbox-code?
    return 0/no-click-in-sandbox-output
  }
  return sandbox
]

# when rendering a sandbox, dump its trace before response/warning if display-trace? property is set
after <render-sandbox-results> [
  {
    display-trace?:bool <- get *sandbox, display-trace?:offset
    break-unless display-trace?
    sandbox-trace:text <- get *sandbox, trace:offset
    break-unless sandbox-trace  # nothing to print; move on
    row, screen <- render-text screen, sandbox-trace, left, right, 245/grey, row
  }
  <render-sandbox-trace-done>
]