Is there a way Ctrl-P can open all selected files as hidden buffer?
This is how I tried to load files into my buffer:
<c-p> (opens Ctrl-P in file mode)
<c-o>
a (marks all files in the match window)
i
The last "i" was intended to open the selected files as hidden buffers.
Instead "i" appeared in the search dialog.
From :help CtrlP
Opening multiple files:
<c-z>
- Mark/unmark a file to be opened with <c-o>.
- Mark/unmark a file to create a new file in its directory using <c-y>.
<c-o>
- Open files marked by <c-z>.
- When no file has been marked by <c-z>, open a console dialog with the
following options:
Open the selected file:
t - in a tab page.
v - in a vertical split.
h - in a horizontal split.
r - in the current window.
i - as a hidden buffer.
x - (optional) with the function defined in |g:ctrlp_open_func|.
Other options (not shown):
a - mark all files in the match window.
d - change CtrlP's local working directory to the selected file's
directory and switch to find file mode.
Here is how to open all selected files as hidden buffer.
Add this line to vimrc:
let g:ctrlp_open_multiple_files = 'ij'
where
i - all files as hidden buffers.
j - after opening, jump to the first opened tab or window.
In Vim:
<c-p> open Ctrl-P in file mode
<c-o> open a console dialog
a mark all files in the match window
<c-z> mark/unmark a file
<c-o> open marked files as hidden buffers
This also works:
" 1r - open the first file in the current window, and remaining opened as hidden buffers.
let g:ctrlp_open_multiple_files = '1r'
Related
If I compare a local file to its parent file, I can edit, in the right pane of VS, the local file if the file extension is cpp or h. If I compare text files that have a different extension (e.g. file.abc), the comparison is against a copy of the local file (e.g. file - copy 2.abc), not against the local file itself, and the copy is not editable.
The file extension must be registered with the c++ editor (Tools | Options... | Text Editor | File Extension).
The following command line generates copies of the compared files.
devenv /diff c:\file.abc d:\file.abc compares c:\temp\file copy.abc to c:\temp\file copy 2.abc.
Is it possible to have the same behavior as for cpp & h?
The header of the attachments menu in neomutt gives the options
q:Exit s:Save |:Pipe p:Print ?:Help
I assumed that the Pipe option would allow me to pipe a chosen attachment to the shell. In particular, maybe I want to open a file in a way that bypasses the mailcap defaults.
Suppose I wanted to open a file from the attachment menu with open. Is there a way to achieve this with Pipe and not by going to edit my mailcap?
Thanks
The only downfall of this is you need to specify all types, because wildcard can be only in subtype - */* or * doesn't work
Store original mailcap file location in a variable
Define macro in attach menu that changes mailcap file to a new one, run view-attach (which uses open to open a file with) and return to original mailcap_path configuration.
~/.muttrc
set my_origmailcap=$mailcap_path
macro attach <Space> "\
<enter-command>set mailcap_path=~/.mailcap2<enter>\
<view-attach>\
<enter-command>set mailcap_path=$my_origmailcap<enter>\
"
~/.mailcap2
audio/* ; open %s
image/* ; open %s
text/* ; open %s
video/* ; open %s
I know that using ctrl+shift+f we can find the text in folder we want and simple ctrl+f will find the text in a opened file or we can right folder and click on a option Find in Folder... to search the text
I am looking for, how can I find the file in a Folder/Project.
You can use the Goto Anything feature (Ctrl+P on Windows and Linux, Cmd+P on macOS) and type the name of the file you're looking for. If there are multiple hits, you can select the appropriate file using cursor keys. It also supports powerful operators, that let you jump to specific parts inside a file.
Examples:
file.js opens that file
:100 jumps to line 100 in current file
file.js:100 jumps to line 100 in file.js
#loadFile lists all files with classes/functions named loadFile (shortcut: Ctrl+R, Cmd+R on macOS)
file.js#loadFile jumps to a loadFile() in file.js
This can be done using:
Windows: Ctrl + P
Mac: Cmd + P
It works much like ItelliJ's Shift - 2 times, with a faster and accurate prediction.
How to (easily) get current file path in Sublime Text 3
I don't often use ST console (I used it only once to install package manager), but I suppose it could be good way to :
get current file path like some kind pwd command.
But it doesn't work.
Does anyone know an easy way to get current file path?
to clipboard : better not a strict objective in the answer
not necessary by ST command, maybe package?
Right click somewhere in the file (not on the title tab) --> Copy file path
If you don't want to use the mouse, you could set up a keyboard shortcut as explained here https://superuser.com/questions/636057/how-to-set-shortcut-for-copy-file-path-in-sublime-text-3
To easily copy the current file path, add the following to Key Bindings - User:
{ "keys": ["ctrl+alt+c"], "command": "copy_path" },
Source
Key Bindings - User can be opened via the command palette (command + p on OSX)
Easy to understand using image. On Right Click you will get this.
Transcribed code in image for convenience:
import sublime, sublime_plugin, os
class CopyFilenameCommand(sublime_plugin.TextCommand):
def run(self, edit):
if len(self.view.file_name()) > 0:
filename = os.path.split(self.view.file_name())[1]
sublime.set_clipboard(filename)
sublime.status_message("Copied file name: %s" % filename)
def is_enabled(self):
return self.view.file_name()... # can't see
Mac OS X - Sublime Text 3
Right click > Copy File Path
A lot of these answers involve touching the mouse. Here's how to do get the path without any mouse clicks using SideBarEnhancements
Install SideBarEnhancements using PackageControl.
Click super + shift + P to open the command palette
In the command palette begin typing path until you see File: Copy Path
Select File: Copy Path
Now the path to file you are working in is copied into your clipboard.
There is a Sublime Package which gives your current file location inside a status bar. I just cloned them directly to my /sublime-text-3/Packages folder.
git clone git#github.com:shagabutdinov/sublime-shell-status.git ShellStatus;
git clone git#github.com:shagabutdinov/sublime-status-message.git StatusMessage;
You have to check/read the description on GitHub. Even it is listed in package control it would not install properly for me. You can actually edit the shell output as you want. If you have the right skills with python/shell.
Looks like this (Material Theme)
If you're like me and always click on items in the sidebar just to realize that copying the path only works when clicking in the editor area, have a look at the SideBarEnhancements package. It has a huge bunch of options to copy file paths in a variety of different ways.
Installation is available via Package Control (despite the webpage only mentions installation via manual download).
Note: The package “sends basic, anonymous statistics”. The webpage explains how to opt out from that.
Go to this link. The code in the link is given by robertcollier4.
Create a file named CpoyFileName.py or whatever you like with .py extension.
Save the file in Sublime Text 3\Packages\User folder. Then paste the above given key bindings in your Preferences: Key Bindings file.
Now, you can use the specified key bindings to copy just filename or total (absolute) filepath.
Please note that the filename or filepath do contain file extension.
Fastest Solution ( No Packages Needed + Comprehensive ):
Folder Path:
Folder in "Sidebar"
Right Click
"Find In Folder"
"Where" field contains everything you need
File Path:
File in current "Tab"
Right Click
"Copy File Path"
Because of all the sub-directories my code typically lives in, whenever I do a Find In File for something, the code gets run off the screen because the results window has wasted so much valuable real estate by repeating the long file path for every object in my solution. More often than not, they are in the same parent directory, or I don't really care where there from.
Is there an option to shorten the path name to perhaps just the file?
Also, the Display File Names Only option in the Find in Files dialog does not do this, it only omits the code from the result.
You can change the VS search result formatting by changing the registry.
According to the article Customize how Find in Files results are displayed in the Find Results Window:
Open up RegEdit
Go to HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\10.0\Find
Add a new string called Find result format with a value of $f$e($l,$c):$t\r\n
DANGER: This involves hacking the Registry so use this tip at your own risk!
Further, here's the syntax to use if you'd like to customize the string further:
Files
$p - path
$f - filename
$v - drive/unc share
$d - dir
$n - name
$e - .ext
Location
$l - line
$c - col
$x - end col if on first line, else end of first line
$L - span end line
$C - span end col
Text
$0 - matched text
$t - text of first line
$s - summary of hit
$T - text of spanned lines
Char
\n - newline
\s - space
\t - tab
\\ - slash
\$ - $
Things are different on Visual Studio 2017. You won't find the registry keys for Visual Studio 2017 anymore as Visual Studio 2017 now stores registry keys in a private binary file under %VsAppDataFolder%\privateregistry.bin.
However, according to this link, there is still a way to find and modify registry keys for Visual Studio 2017.
Close Visual Studio 2017
Open regedit
Select HKEY_LOCAL_MACHINE from the left bar
Select File > Load Hive...
Load the privateregistry.bin file from %localappdata%\Microsoft\VisualStudio\15.0_[instanceid]{RootSuffix}\privateregistry.bin. The RootSuffix for a normal VS installation will be blank. This is mostly used for the experimental instance
Name the key whatever you want (e.g. "VS2017") when prompted
From there, you should be able to view the entries just like any normal registry.
Customise it according to accepted answer's suggestions.
Important! Once you're finished, you need to make sure that you "Unload" the private registry, by selecting the "root" key ("VS2017" in this example) and selecting File > Unload Hive . If you don't do this, VS won't be able to read the privateregistry.bin file when it runs, causing major problems.
Update:
It also works on Visual Studio 2019 (version 16.0) too.
There is an option you can select "Find results table".
Then you can do a Ctrl+ALL and copy the tab delimited results to a spreadsheet such as Excel. Then you can see only the code instead of file names.