How do I exactly search a file in my project with atom? - atom-editor

I know I have a file called 'mwc-fab' in my dependency,
so How can I search this file with the file name?
In vscode, i just type mwc with my node_modules file select and I get the file I want.

If you're using a Windows computer the command is Ctrl+T or Ctrl+P and on Mac Cmd+T or Cmd+P
https://flight-manual.atom.io/getting-started/sections/atom-basics/

There is an Atom package named incremental search that you can use to search thru open files. After installing incremental-search you can type command-i and this opens a text box near bottom of screen where you can input your search string. After that you can command-i repeatedly to go to next matching string. Be sure to read the directions for more useful commands.

Related

Where is Atom keeping its state?

I'm on OSX and had a file open in Atom which I hadn't given a name to. I had to restart my computer and when it came back again I clicked the wrong thing and it forgot all the old file names, and the unnamed file seems to be gone without a trace. If I use Time Machine to restore the .atom file to an old state it detects that something is 'wrong' and pulls the most recent state from some other location (it gets recent filenames from somewhere). Any idea where it's getting that state from?
The literal answer to my question, found using some aggressive grepping, is ./Library/Application Support/Atom/IndexedDB/file__0.indexeddb.leveldb.
It appears to be that the dialog which caused Atom to forget my file list was shown as the result of a real bug rather than bad intentional UX.
Here are the instructions which got my file contents back (courtesy someone in the Atom slack channel):
Open the Chrome Dev Tools in Atom using Cmd + Option + I
Click the Application tab
In the tree view on the left of this tab, expand IndexedDB > AtomEnvironments and click on the table states
In the grid on the right, you'll see one or more entries keyed with editor-<some hash>
For each of those entries, expand the Object in the Value column and then expand this tree: Object > value > project > buffers
For each file in the "buffers" list, expand it and try to find the untitled file, it won't have a filePath property. The text field will have the file contents.

Retain Project Find Result Tab in Atom Editor

I'm trying to use Atom 1.8.0 for grokking code, at most a few thousand Java and XML files. When I perform a global search with Ctrl+Shift+F , the results appear in a tab named "Project Find Results". However, if I do another global search the new results appear in the same tab, replacing older results. I'd like Atom to open show results in a new tab every time. Is it possible?
Note: There seems to be a similar feature request here but I cannot access GitHub at work.

Complete directory names using the end of the string on command completition

Let's say I have a directory with the following contents:
/Project.Presentation
/Project.Presentation.API
/Project.Presentation.Web
/Project.Presentation.Infra
/Project.Presentation.Util
I want to do this -> Project.Presentation: API and let it autocomplete to Project.Presentation.API. Inside Project.Presentation to type API and <tab>.
Is it possible to let zsh use this 'forgiving' way of ?
You're overcomplicating your solution.
If you want to execute a command with a file inside these directories, or just cd in one of these directories.
Just write cd (or other command) first, then press tab that will complete Project.Presentation. then you can either write API or write A and press tab.
By the way, you can have a way to navigate through the possibilities with an extra tab key.
Read man zshoptions for to discover options available in zsh.

Batch file write to txt

I want to make a batch file that will ask user for input, than write that input to a specific position in an already written txt file(called commands.txt which contains query) and call sqlite3 < commands.txt
I need this so inside the commands.txt where the query is, in LIKE 'userinput' i will add the users choice (parameter)
Although your question is not really specific enough and verging on the kind of inappropriate question that for stackoverflow (it does not include code), as hinted at by the comment, I'll take it at face value and assume there is much you need help with.
First let me deal with the question "I need to make a batch file"
A batch file is a simple text file with the extension .bat. You can create it with a text editor like notepad. We do not know what kind of system you have (Windows, linux, Mac etc) but lets assume Windows as you asked for a batch file. We do not know which version of windows (7 or 8 etc), So I'll try and be generic.
All windows machines come with a simpe text file editor called notepad. You can open this by typing notepad into the search box on windows 7 or 8. Lets start with a simple batch file:
:: This is a batch file
#echo off
echo Hello World
exit /b
Type (or paste) those 4 lines into notepad. Now select the file menu and select Save As, now in the Save As Type: selector choose All Files. In the File name: box type the desired name with the bat extension, such as doit.bat. Ensure you choose a suitable directory to place your new batch file. Leave the encoding as ASCII. Click Save. You have now made your first batch file.
Now you need to execute that batch file. Using the Windows File Explorer find the folder where you saved that batch file. While viewing the folder, hold down the shift key on the keyboard and then right click in the background of the folder and select Open Command window here. You will now have a command prompt window. You can now execute your new batch file by typing its name doit. It will display:
Hello World
OK - Now you have created your first working batch file.
Now for the next part; Asking the user for input. This is done with the set /p command. Add this to your batch file (before the exit line):
Set /P Like="Give me your input: "
echo Your input was: %Like%
That has solved the second part. Now the third part, edit the commands.txt file. If you do an internet search for a similar problem (editing files in batch files) you might find this help page: http://www.ousob.com/ng/edlin/ng96d9.php. This shows a generic way of changing any text string to any other in a file using EDLIN from a batch file; unfortunately EDLIN (and EDIT) are no longer included in windows so these batch files are not much help.
A search of stackoverflow finds similar queries which contain an answer for you.
So now you have all the parts of the answer:
How to make a batch file
How to prompt the user for input
How to replace lines of text in the commands.txt
You should be able to put it together and get it to work....

How to set user command in Qt Fakevim?

(1) For example, I want to set map gd g* in Qt's Fakevim like below but failed.
(2) And also I'd like to set F3 as the save command, how to do it?
(3) In Fakevim, it provides an option "Read .vimrc", but where to find the file .vimrc?
Thank you!
It doesn't look like there is a lot of documentation for FakeVim, so official sources might not exist. Most of this was obtained by experimentation.
If you want to dig deeper, I guess there's no source as official as the actual source: http://qt.gitorious.org/qt-creator/qt-creator/blobs/0809986e501415fe2c8508800b94b5b3169dc048/src/plugins/fakevim/fakevimplugin.cpp
User commands
First off, realize that in Tools>Options>FakeVim>User Command Mapping, you're only setting what your user actions will perform, not how you perform them.
By default, user command #1 is triggered by pressing Alt-V, then 1.
Alt-V, then 2, triggers user action #2, and so on.
You can change the keyboard shortcuts through the general QtCreator configuration interface, under Tools>Options>Environment>Keyboard. There is a "FakeVim" section with all the user actions listed. Select your user action of choice, press the little "erase" icon in the input field under "Shortcut", then press your desired shortcut key, which should appear in the input field.
Second, to finish a command where you would normally press enter, you should literally type in <CR> after the commands. You also need to enter in ':' to enter command mode.
So if you wanted to map the vim save command, ":w", to F3 via FakeVim, you would:
Go to Tools>Options>FakeVim>User Command Mapping.
Enter ":w<CR>" as one of the user commands (say #7).
Go to Tools>Options>Environment>Keyboard.
Find the FakeVim action "UserAction7".
Set F3 as a shortcut for it.
Now, every time you're in the editor, you should be able to click F3 and have the FakeVim :w command execute, which will save your file.
Note that there is also an option to set a shortcut for "Save" directly in the QtCreator keyboard settings, so for this particular shortcut you don't actually need to go through FakeVim.
Setting shortcuts for other vim commands should be similar. Note that you're restricted to the subset of vim commands that FakeVim implements. Refer to the source, linked above, for checking any particular command you're wondering about.
Vimrc file
On Linux this would be ~/.vimrc, a file in the user's home directory. I presume you're asking about Windows.
The best source I can find is this bug report about it being hard to use Fakevim's vimrc on Windows: https://bugreports.qt.io/browse/QTCREATORBUG-8748
Following that, the file Fakevim looks for is ".vimrc" in %USERPROFILE% (you can enter a name like that in Explorer to go to the folder). However, it's tricky to access a file with a name like that on Windows. (Thus why the real vim uses '_vimrc' on Windows -- but FakeVim apparently doesn't, at least at the moment.)
Here is a superuser page with workarounds for how to create such files on Windows: https://superuser.com/questions/64471/create-rename-a-file-folder-that-begins-with-a-dot-in-windows

Resources