summaryrefslogtreecommitdiffstats
path: root/.config/ranger/ranger_new/commands.py
diff options
context:
space:
mode:
authorYigit Sever2021-10-08 00:07:00 +0300
committerYigit Sever2021-10-08 00:07:00 +0300
commit69037e40f4490dc29ecb22181a815c46fa09f930 (patch)
tree725cb9bdea9dda23ea3fbd32169cafbae75eebd4 /.config/ranger/ranger_new/commands.py
parente5f3a6f5de714554b521a24e832be2942ff25a38 (diff)
downloaddotfiles-69037e40f4490dc29ecb22181a815c46fa09f930.tar.gz
dotfiles-69037e40f4490dc29ecb22181a815c46fa09f930.tar.bz2
dotfiles-69037e40f4490dc29ecb22181a815c46fa09f930.zip
ranger: removed
Diffstat (limited to '.config/ranger/ranger_new/commands.py')
-rw-r--r--.config/ranger/ranger_new/commands.py62
1 files changed, 0 insertions, 62 deletions
diff --git a/.config/ranger/ranger_new/commands.py b/.config/ranger/ranger_new/commands.py
deleted file mode 100644
index 97b7909..0000000
--- a/.config/ranger/ranger_new/commands.py
+++ /dev/null
@@ -1,62 +0,0 @@
1# This is a sample commands.py. You can add your own commands here.
2#
3# Please refer to commands_full.py for all the default commands and a complete
4# documentation. Do NOT add them all here, or you may end up with defunct
5# commands when upgrading ranger.
6
7# A simple command for demonstration purposes follows.
8# -----------------------------------------------------------------------------
9
10from __future__ import (absolute_import, division, print_function)
11
12# You can import any python module as needed.
13import os
14
15# You always need to import ranger.api.commands here to get the Command class:
16from ranger.api.commands import Command
17
18
19# Any class that is a subclass of "Command" will be integrated into ranger as a
20# command. Try typing ":my_edit<ENTER>" in ranger!
21class my_edit(Command):
22 # The so-called doc-string of the class will be visible in the built-in
23 # help that is accessible by typing "?c" inside ranger.
24 """:my_edit <filename>
25
26 A sample command for demonstration purposes that opens a file in an editor.
27 """
28
29 # The execute method is called when you run this command in ranger.
30 def execute(self):
31 # self.arg(1) is the first (space-separated) argument to the function.
32 # This way you can write ":my_edit somefilename<ENTER>".
33 if self.arg(1):
34 # self.rest(1) contains self.arg(1) and everything that follows
35 target_filename = self.rest(1)
36 else:
37 # self.fm is a ranger.core.filemanager.FileManager object and gives
38 # you access to internals of ranger.
39 # self.fm.thisfile is a ranger.container.file.File object and is a
40 # reference to the currently selected file.
41 target_filename = self.fm.thisfile.path
42
43 # This is a generic function to print text in ranger.
44 self.fm.notify("Let's edit the file " + target_filename + "!")
45
46 # Using bad=True in fm.notify allows you to print error messages:
47 if not os.path.exists(target_filename):
48 self.fm.notify("The given file does not exist!", bad=True)
49 return
50
51 # This executes a function from ranger.core.acitons, a module with a
52 # variety of subroutines that can help you construct commands.
53 # Check out the source, or run "pydoc ranger.core.actions" for a list.
54 self.fm.edit_file(target_filename)
55
56 # The tab method is called when you press tab, and should return a list of
57 # suggestions that the user will tab through.
58 # tabnum is 1 for <TAB> and -1 for <S-TAB> by default
59 def tab(self, tabnum):
60 # This is a generic tab-completion function that iterates through the
61 # content of the current directory.
62 return self._tab_directory_content()