GithubHelp home page GithubHelp logo

oliver / gedit-file-search Goto Github PK

View Code? Open in Web Editor NEW
43.0 7.0 11.0 899 KB

Gedit plugin to search a text in all files in a directory

Home Page: https://oliver.github.io/gedit-file-search/

Python 96.92% Makefile 3.08%
gedit gedit-plugin

gedit-file-search's Introduction

File Search Plugin for Gedit

This is a search plugin for Gedit to search for a text inside a directory.

The plugin was tested with Gedit 3.4.1 under Ubuntu 12.04, and with Gedit 3.8.3 under Fedora 19. It should also work under other versions of Gedit 3.

Note that Gedit 2 and older are not supported by this plugin any more (there is an old version of this plugin available, though, which supports Gedit 2).

Installation (from TGZ file)

  • download the plugin from https://github.com/oliver/gedit-file-search/releases
  • unpack the tgz file
  • copy the contents of the gedit-file-search folder to ~/.local/share/gedit/plugins/ (create that folder if necessary)
  • start Gedit, go to Edit -> Preferences -> Plugins, and enable "File Search"

Use Search -> Find in files, or right-click in a document and select Search files... to open the search dialog.

Note: if the plugin cannot be enabled, you might need to install support for Python-based plugins. For Ubuntu-like systems, run "sudo apt-get install gir1.2-gtksource-3.0" in terminal. For other systems, look for a software package like "gedit-plugins" - installing it should fix the problem.

Building from source

Prerequisites: install GNU Make, GNU Gettext, glib-compile-schemas, and Git. On Ubuntu, run "sudo apt-get install make gettext libglib2.0-bin git" to install these.

Then run:

git clone https://github.com/oliver/gedit-file-search.git
cd gedit-file-search
make tgz

This will compile translation files and gschema files, and will create a TGZ file containing the entire plugin ready for installation.

gedit-file-search's People

Contributors

ai avatar cleitonfco avatar jpfleury avatar martinbonnin avatar oliver avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

gedit-file-search's Issues

Installation does not create gschemas.compiled

Using Ubuntu 14.04, Gedit 3.10 complains that it cannot locate gschemas.compiled

This can be remedied by manually compiling the file io.github.oliver.gedit-file-search.gschema.xml in the plugin directory:

$ cd ~/.local/share/gedit/plugins/<file-search-dir>/
$ glib-compile-schemas ./

Find in directory of the currently opened file

A lot of time, I use "Ctrl+Shift+F" as I use "Ctrl+F", i.e. with the idea to search in the currently opened file (and other files in the same folder). However, I often must browse to set the folder of the currently opened file (or manually enter it).

I think it would be useful to automatically add directory of the currently opened file in the list of recent searched folders, so it would be easily and quickly selectable.

Doesn't work on Fedora 20

Hi, your plugin doens't work on Fedora 20 (gEdit 3.10).

The menu item "Search files" is visible, but nothing happens if I click it.

Plugin not working in last version of Gedit 43.2

I can see the plugin in the context-menu but when clicking on it, it does not do anything.
Have you any intention of updating the plugin or is this totally a dead project? If that is the case do you know of something similar? I loved the functionality your plugin adds, but I have not seen any alternative and I do not have any coding skills...

Option to collapse all matches in a specific folder

After searching, we can realize that all matches in a specific subfolder are not relevant for us. It would be very useful to have an option in the "right click menu" to collapse all these results. Example:

Say results are:

- folder1/file1
- folder1/file2
- folder2/file1
- folder2/file2
- folder3/file1
- folder4/file1
- folder4/file2
- folder4/file3
- folder4/file4
- folder4/file5
- folder4/file6
- folder4/file7
- folder4/file8
- folder4/file9
- folder4/file10
- folder5/file1

A lot of matches are in "folder4". If they are irrelevant for us, we could click right on any result of this subfolder and have the following choices:

Copy
----
Expand All
Collapse All
Collapse all matches in "folder4"

Written in a more generic form, the new option would be Collapse all matches in "%(folder of the clicked match)s".

doesn't work with gedit 3

gedit-file-search won't currently work with gedit 3 (found in Fedora 15 and the upcoming Ubuntu Oneiric).

(If you're not ready to migrate the master branch to gedit 3, you could create a separate git branch for that.)

Max width for "Results" tabs

Keywords searched are used as title for the "Results" tab in the bottom panel. The problem is when I search a long string. The "Results" tab makes my gedit window to exceed screen size. May "Results" tabs have a max width.

If regex is checked, results are not highlighted in the bottom panel

If regex is activated in gconf-editor (key /apps/gedit-2/plugins/file-search/is_reg_exp), results are not highlighted in the tab located in the bottom panel.

For example, if we search "Fi.d" (case sensitive) in gedit-file-search files, we get 2 results:

file-search.glade
8:     <property name="title" translatable="yes">Find in files</property>
searcher.py
24: # - SearchProcess (uses RunCommand to run Find, parses its output, and starts GrepProcess)

but matches (here the word "Find") are not highlighted in yellow. Now, uncheck /apps/gedit-2/plugins/file-search/is_reg_exp in gconf-editor, and search "Find" in gedit-file-search files. We'll get the same 2 results, but now the word "Find" is highlighted in yellow for both results.

Can't build/show window... please, help!

On gedit - Version 3.8.3 | Python 3.3.2 | gnome 3.8.4 | Fedora 19,
Does not show up window, when clicking on "Search files...".
Bellow, trace. I can't realize things thou... Thanks!

Traceback (most recent call last):
File "/home/careca/.local/share/gedit/plugins/file-search/plugin.py", line 127, in on_search_files_activate
self.openSearchDialog()
File "/home/careca/.local/share/gedit/plugins/file-search/plugin.py", line 131, in _openSearchDialog
self.searchDialog = SearchDialog(self, self.window)
File "/home/careca/.local/share/gedit/plugins/file-search/searchdialog.py", line 154, in init
self.gclient = self.initGSettings()
File "/home/careca/.local/share/gedit/plugins/file-search/search_dialog.py", line 172, in initGSettings
resourceDir, Gio.SettingsSchemaSource.get_default(), False)
File "/usr/lib64/python3.3/site-packages/gi/types.py", line 137, in constructor
return info.invoke(cls, args, *kwargs)
gi._glib.GError: Datei »/home/careca/.local/share/gedit/plugins/file-search/gschemas.compiled« konnte nicht geöffnet werden: open() ist gescheitert: Datei oder Verzeichnis nicht gefunden

  • translation of last line:
    "gi._glib.GError: File »/home/careca/.local/share/gedit/plugins/file-search/gschemas.compiled« could not be opened: open () failed: File or directory not found")

AttributeError: 'Document' object has no attribute 'get_location'

Hi,
I got this error when clicking on Search files...:

Traceback (most recent call last):
  File ".../.local/share/gedit/plugins/gedit-file-search/file-search/plugin.py", line 141, in on_search_files_activate
    self._openSearchDialog()
  File ".../.local/share/gedit/plugins/gedit-file-search/file-search/plugin.py", line 146, in _openSearchDialog
    self._searchDialog.show(searchText, searchDirectory)
  File ".../.local/share/gedit/plugins/gedit-file-search/file-search/search_dialog.py", line 194, in show
    gFilePath = self._window.get_active_tab().get_document().get_location()
AttributeError: 'Document' object has no attribute 'get_location'

Note: I had to create this directory /.local/share/gedit/plugins/ and grant permissions to the current user.
ubuntu 20.04.

No option in UI to check regex

gedit-file-search seems to already have all code needed to search using regular expression. However, we must activate it by hand in gconf-editor (key /apps/gedit-2/plugins/file-search/is_reg_exp).

It would be convenient to have a checkbox "Regular expression" under the search field, beside "Case sensitive" and "Whole word".

bugs in gedit3 port

Thanks a bunch for making the gedit3 version available! Here are some bug reports

(Tested: version at https://github.com/adam-yorba/gedit-file-search/tree/gedit-3/file-search from July 6, 2011, with Gedit 3.2.1 running on Xubuntu 11.10)

  1. Error message on activating plugin: "TypeError: on_search_files_activate() takes exactly 3 arguments (2 given)"
    Apparently relates to:
    ui.py, line 442: "def on_search_files_activate(self, action, user_data)"
    Probably needs to be changed to: "def on_search_files_activate(self, action)"
    Plugin loads properly with this change.

  2. Gedit exits with error message "segmentation fault" on executing search command. (Reason unclear.)

  3. after re-starting Gedit after this crash, I get another error already on opening the search-files dialog (presumably during execution of openSearchDialog):
    "TypeError: metaclass conflict: the metaclass of a derived class must be a (non-strict) subclass of the metaclasses of all its bases"

Refresh results button

Hi Oliver

Would it be possible to add a refresh button just above the close button in the results panel ?
I find it useful because it avoids having to search for the same query multiple times.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.