I want to be more comfortable with CLI, so I need practice. :D
I have a directory and within it I have more of them. I use ls to find their name, but the one I want to change into has a very long name.
Is it possible to change to that directory without typing his entire name?
Try to type few chars of that name and press Tab once to complete that name.
If it doesn't complete, press Tab twice to see available names that start with the character sequence that you entered. Then, add few more chars, so that sequence is unique for that name and press Tab to complete.
Related
I know about the Trim Trailing Whitespace command in the pallette, and I know I can run this on save.
Is there a way to trim trailing whitespace on ALL files in a workspace (either with some command combo, or a way to run "save" on every file)
I have seen other answers on how to trim trailing whitespaces using Unix tools, but I would rather use the built in tool from VSCode specifically. (I would accept an answer that shows how to do this in another GUI text editor like Sublime Text also).
I would prefer not to have answers that use Terminal or other Regex matching--I would prefer to use the exact algorithm that is used by GUI tools already, since I trust that they will do the thing I expect. I will be running this on potentially thousands of files, so mistakes could easily go through even after audit.
I am basically trying not to open every file and ⌘+S it manually.
I am on macOS if that changes anything (but I doubt it matters)
This can be done using the search-and-replace function (keyboard shortcuts given below are for Linux, likely similar to what exists on a Mac):
Ctrl-Shift-H (open the search-and-replace side panel)
Type +$ in the Search field (that is a space, a plus and a dollar, meaning one or more spaces anchored at the end of the line)
Click the .* regular expression button next to the Search field
Leave the Replace field empty
Press Ctrl-Alt-Enter (or press the Replace All button next to the Replace field)
Click Replace (or Alt-R) in the confirmation pop up which also tells you the number of occurrences and files that will be touched
Be careful, as a wrong search or replace argument can mess up many files all at once!
I am trying to copy a column from a text file to another with emacs.
I select the text with C-x, r, r, and then try to copy the same in another text with C-x,r,l + Enter. However, at the end it says: Register does not contain text. Is it because I am trying to copy from one file to another?
My crystal ball suggests that maybe you're copying from two different Emacs sessions. Registers only work within a single Emacs session.
Imagine you have these files in your project:
a/b/first.png
a/first.png
If I trigger projectile with C-c p f and write first.png, and I write first.png , it will show me both files. Is there a way to select the next file?
Example:
In the image below, the first file in the list is .document. Without writing any other letter, is it possible to switch through the list provided by projectile? Is there a combination that will cycle through those file names, like , press some key combination and then .gitignore is selected?
If I correctly understand, the projectile uses the ido package for file name completions, and other things. The ido (and many other packages) uses the C-s to switch to next file name, and C-r to switch to previous file. See "Using IDO" section in previous link
The keyboard arrow keys will toggle through options as well, and you can then hit enter when the file you want is highlighted next to the text you typed.
I am using Windows 7, EmacsW32 and Emacs23
I am trying to navigate inside a directory whose name has spaces with within Emacs. So, I try to navigate to it in Dired mode by:
C-x d
And then navigate to the directory name with spaces (e.g. My Documents) and the suggestion and auto-complete feature (upon pressing TAB) does not work. How can I navigate to folders and files within such directories without removing spaces?
UPDATE: I tried few other paths with spaces in some directories, and it works. i don't know in which situations it works and fails. It works for Program Files but fails for My Documents.
I am taking a shot in the dark, but unix's case escapes are "\ " and I believe windows does the same.
This may not solve your problem directly.
As you described, I think you may not use ido-mode now. The default tab complete in emacs is weak. Try ido-mode, it is fantastic.
I can't replicate this particular issue, however:
To enter a literal space, type C-qSPC
C-q runs the command quoted-insert which ensures that the next character typed is inserted into the current buffer, which can be useful when the key in question is bound to some function.
The problem is not with folders with spaces in it. The problem is only with My Documents, My Videos and similarly named folders.
When I go in the windows file browser and check the path of the folder My Documents, it appears as C:/..../Documents/...
So, I tried to open Documents instead of My Documents in Emacs and it works. Now I am able to access my files under Documents.
While trying to autocomplete a file (e.g. to open a file with C-x C-f) Emacs-helm shows a list of possible candidates.
If I then press Tab (which I would hope it would help me choose the first/closest match), I get the following in the minibuffer:
It looks like the minibuffer gets confused with escape characters, and it does not choose the file that I actually want to open (the top choice).
Helm requires this conceptual jump from the default Emacs completion, which is not so obvious:
You don't need to press a key to complete. The completion buffer refreshes
with new results after every input.
This is called "incremental" completion.
The normal tab functionality is not needed in "incremental"
completion. So tab was rebound to helm-select-action, which allows you to
choose an alternative action with the selection. But there is only one action
in read-file-name.
The error you're seeing could be clearer though, I've filed this issue on github.
Additionally, note Helm treats each space separated term as a filtering
regular expression. So, pressing space foo will filter
the current list down to those that contain foo in the name.