about summary refs log tree commit diff stats
path: root/ranger/core/actions.py
diff options
context:
space:
mode:
authorhut <hut@lavabit.com>2010-04-19 00:35:15 +0200
committerhut <hut@lavabit.com>2010-04-19 00:35:15 +0200
commite3eca034f794a056eb8a0df6b926c94d41fdfdac (patch)
tree1196e658fb8dc6a69515a9ab6821a1a204d72029 /ranger/core/actions.py
parent34414c3eae0c2b4d3a866ad00b2d995bb3312f53 (diff)
downloadranger-e3eca034f794a056eb8a0df6b926c94d41fdfdac.tar.gz
core.actions: abstracted searching strings in filenames
Diffstat (limited to 'ranger/core/actions.py')
-rw-r--r--ranger/core/actions.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/ranger/core/actions.py b/ranger/core/actions.py
index 5b18fae4..115faaa0 100644
--- a/ranger/core/actions.py
+++ b/ranger/core/actions.py
@@ -14,6 +14,7 @@
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 import os
+import re
 import shutil
 from os.path import join, isdir
 from os import symlink, getcwd
@@ -275,6 +276,12 @@ class Actions(FileManagerAware, EnvironmentAware, SettingsAware):
 	# -- Searching
 	# --------------------------
 
+	def search_file(self, text, regexp=True):
+		if isinstance(text, str) and regexp:
+			text = re.compile(text, re.L | re.U | re.I)
+		self.env.last_search = text
+		self.search(order='search')
+
 	def search(self, order=None, forward=True):
 		original_order = order
 		if self.search_forward: