How to make MacVim launch with the -y option by default? - macvim

Right now I have to go to a terminal and type: "mvim -y &".
I want to be able to launch MacVim with -y option enabled even when clicking on the .app icon or when launching it through the "Open with..." context menu.
I know about the gvimrc and vimrc files under MacVim.app/Contents/Resources/vim, so I just need someone to tell me what to add in which file.
Thanks a lot.

I believe you should be able to add set insertmode to either your .vimrc or .gvmirc files.
If you are setting this because it is your personal preference, you might consider adding the line to the .gvim file in your home directory instead. Modifying the configuration of the application it's self would probably affect other users on the machine.

Related

Setting up Prettier on PhpStorm 2019.1.3

I have Prettier enabled in the plugins. The question is simply, where are these settings? Folder permissions or what? The picture where they are showing is from the intellij-support website. The picture with the question mark is with the settings on my PhpStorm
A possibility to run Prettier on Save has been introduced in PhpStorm 2020.1; if upgrading the IDE is not an option for you, I can only suggest setting it up as a file watcher in in Preferences | Tools | File Watchers and make sure that Auto-save edited files to trigger the watcher (https://www.jetbrains.com/help/webstorm/2019.1/using-file-watchers.html?section=Windows%20or%20Linux#ws_filewatcher_advanced_options) is disabled
So, basically, if you want to use Prettier with PhpStorm 2019.1.3 you need to install it with npm like this jetbrains.com/help/webstorm/2019.1/prettier.html and setup the configuration of it in the package.json under "prettier" key. Then you have to right-click on the file and select "Reformat with prettier". Maybe you can set hotkey for Prettier somewhere, the default ones do not work for me for some reason. If you want your code to be automatically formatted on save you need to install this plugin: https://plugins.jetbrains.com/plugin/7642-save-actions/versions "Save Actions". I installed 2.2.0 because it has support for 2018+.Then - because I couldn't find the place where you can change default formatting tool to "Prettier" you can setup the configuration under Settings->Editor->Code Style->choose the language you desire and then configure it. Could not find a way to setup prettier without json config or after setting it up to make it work on "Save" action. Answering this just because it might help somebody somewhere.

How to open a project in PhpStorm from command line on Windows

How to open a project in PhpStorm from command line on Windows?
I tired this:
How to open a directory in PHPStorm or IntelliJ (or any JetBrains IDE) from the command line? but can't find Tools -> Create command line launcher on Windows.
I am using latest PhpStorm.
To open the current directory just run:
phpstorm64 .
If you are using git bash on Windows run:
cmd "/C phpstorm64 ."
Make sure that C:\Program Files\JetBrains\PhpStorm 2018.3.3\bin is in your environment variable PATH (it is by default after the installation)
Edit 2021:
Install Jetbrains Toolbox
Go to settings
Enable "Shell Scripts" and follow the instructions
Now you can use "phpstorm ." to open the current directory.
On macOS ( I assume on windows too) there is option to "Create Command-line Launcher". Just click that and you are good to go next time you open a terminal.
You can even specify how you would like to start "pstorm" / "phpstorm" / "ps" etc.. up to you.
Command-line launcher is currently only available fo UNIX; there is a feature request for providing it on Windows, IDEA-114307, please feel free to vote for it.
If you like to start PhpStorm from command prompt, open cmd console, cd to %PS_install_dir%/bin and run either phpstorm64.exe or phpstorm.bat, passing a path to project folder to it, like it's described in https://www.jetbrains.com/help/phpstorm/opening-files-from-command-line.html. If you like to start it from any directory, add %PS_install_dir%/bin to your system %PATH%
I know this is too late, but it will help others if they need it:
if you want to open phpStorm in the current directory via cmd/Powershell, just use this command:
phpstorm64.exe .
Or if you want to open it in another directory, just use:
phpstorm64.exe YOUR_DIRECTORY_PATH
as simple as that!
go to your project using terminal
Cd myproject
and write
phpstorm64.exe
then hit enter
I see this is a little old but I wanted to supply my answer as I was grappling with this yesterday. My solution was to use cygwin.
Track down the phpstorm bin folder called something like C:\Users\UserName\AppData\Local\JetBrains\Toolbox\apps\PhpStorm\ch-0\201.7223.96\bin and add it to your windows system Path environment variable.
Next fire up a cygwin terminal and navigate into your project directory. I'm not a bash expert so I struggled to sort out the code as an alias but if you run:
crntproj=$(cygpath -w $PWD)
phpstorm.bat $crntproj
You need cygpath because simply running phpstorm.bat $PWD doesn't work as PHPStorm tries to open a folder called $PWD. I tried a bunch of variations trying to get it to open and none seemed to work.
It will fire up phpstorm with the current folder as the project path. And you now have a terminal feed from your project too.

How to install colortheme in NeoVim in Mac OS X?

I just installed NeoVim VimR 0.13.1 from https://github.com/qvacua/vimr/releases
for Mac OSX. I was able to set default options by creating a file at
~/.config/nvim/init.vim
Now I am having a hard time trying use a color theme. For example I am interested with OceanicNext theme from https://github.com/mhartington/oceanic-next
So I downloaded the zip file, unzipped it then it creates a folder called
oceanic-next-master
So I moved this folder to
~/.config/nvim/oceanic-next-master
Added necessary code to the init.vim file
" For Neovim 0.1.3 and 0.1.4
let $NVIM_TUI_ENABLE_TRUE_COLOR=1
" Or if you have Neovim >= 0.1.5
if (has("termguicolors"))
set termguicolors
endif
" Theme
syntax enable
colorscheme OceanicNext
But even restarting the VimR, nothing happens. So I tried renaming the folder name from
~/.config/nvim/oceanic-next-master
to
~/.config/nvim/OceanicNext
Still no luck. So tried to copy the actual OceanicNext.vim file to
~/.config/nvim/OceanicNext.vim
Still didn't work restarting it. So I tried running the command directly
colorscheme OceanicNext
But it give me the following error message
Cannot find color scheme 'OceanicNext'
I also tried install other color scheme from https://github.com/frankier/neovim-colors-solarized-truecolor-only but still wasn't able to make it work.
I also have MacVim installed and just copy and pasting the plugins into the ~/.vim worked, but looks like NeoVim is different? What am I doing wrong?
Thank you.
The nvim documentation on the colorscheme command :help colorscheme
:colo[rscheme] {name}
Load color scheme {name}. This searches 'runtimepath' for the file
"colors/{name}.vim". The first one that is found is loaded. Also
searches all plugins in 'packpath', first below "start" and then under
"opt".
You can put the color scheme file into ~/.config/nvim/colors f older. Where ~ is your user home directory.
Consider you have "nord.vim" colorscheme. The full path to it will be ~/.config/nvim/colors/nord.vim.
Then the :colorscheme nord command will be able to load the theme.
By the way, vim-plug plugin is great for managing vim and neovim plugins and colorschemes. It will install/update/delete plugins including colorschemes for you. Give it a try.
Had to install vim-plug manager from https://github.com/junegunn/vim-plug
by placing the plug.vim file to
~/.config/nvim/autoload
to install the plugins.

Sublime Text 2 - Package Control installed but the list not shown

I am using Sublime Text 2 for Mac. I have installed the Package Control for Sublime Text 2, following the instructions from https://sublime.wbond.net/installation#st2 without any trouble. However, when I open up Ctrl+Shif+P to search for available packages, it does not show any.
See the image screenshot here
Do you have any solutions for it? I try restart Sublime but it doesn't solve the problem.
Take a look in your user Preferences.sublime-settings and remove the Package Control from the "ignored_packages" list if it is there.
If you use a Linux based system, you may have to check permissions of /home/user/.config/sublime-text-3. Check if the directory is owned by your user. If not, change the owner user for that directory.
Click the Preferences > Browse Packages and check whether Package control file is there or not.
You can manually put package control file there by downloading it from here and get rid of issues.
I had the same problem. I had to restart my computer to properly reset Sublime Text 2. It seems from your comment that you also got the Package Control list to show up after restarting your computer.
Your screenshot image is currently broken, but make sure you have the zipfile "Package Control.sublime-package" in the Installed Packages directory.
Open the console and run this command:
curl http://sublime.wbond.net/Package%20Control.sublime-package -o ~/Library/Application\ Support/Sublime\ Text\ 2/Installed\ Packages/Package\ Control.sublime-package
Then restart sublime.
See this issue: https://github.com/wbond/sublime_package_control/issues/652

How to use GVIM to edit a remote file?

I use GVIM on Ubuntu 9.10. I'm looking for the right way to configure GVIM to be able to edit remote files (HTML, PHP, CSS) by for exemple ftp.
When i use :e scp://username#remotehost/./path/to/file i get: error detected while processing BufEnter Auto commands for "*":E472: Command failed.
When i open a file on remote via Dolphin or Nautilus, i cannot use other files with NERDTree.
Finally when i edit on remote a file via Dolphin the rights are changing to access interdit.
So how to use GVIM to edit remote files like on my localhost?
I've found running the filesystem over ssh (by means of sshfs) a better option than having the editor handle that stuff or running the editor itself over an ssh tunnel.
So you need to
apt-get install sshfs
and then
sshfs remoteuser#remotehost:/remote/path /local/mountpoint
And that will let you edit your remote files as if they were on your local file system.
To make it even smoother you can add a line to /etc/fstab
sshfs#remoteusername#remotehost:/remote/path /local/mountpoint fuse user,noauto
For some reason I find that I have to use fusermount -u /local/mountpoint rather then just umount /local/mountpoint when experimenting with this. Maybe that's just my distro.
Recently I've also noted that the mounting user must be in the fuse group. So:
sudo addgroup <username> fuse
An other popular option of course, would be to run vim (rather then gvim) inside a GNU Screen session on one machine and connect to that session via ssh from wherever you happen to be. Code along all day at work and in the evening you ssh into your office computer, reattach to your gnu screen session and pick up exactly where you left off. I used find the richer color palette to be the only thing I really missed from gvim when using vim, but that can actually be fixed thanks to a fork of urxvt that will let you customize the entire 256 position color palette, not just the 16 first positions of the palette that most terminal emulators will let you customize.
There is one way and that is using the remote host's copy, using SSH to forward the X11 client to you, like so:
user#local:~/$ ssh -X user#host
...
user#host:~/$ gvim file
The latter command should open gvim on your desktop. Of course, this relies on the remote host having X11 / gnome / gvim installed in the first place, which might not be the solution you're looking for / an option in your case.
Note: X11 forwarding can be a security risk.
In order for netrw to work seamlessly, I believe you need to not be in compatibility mode.
Try
:set nocompatible
then
:edit scp://host/path/to/file
Try this
:e scp://username#remotehost//path/to/file
Note that the use of // is intentional after remotehost it gives the absolute path of your file
:)
http://www.celsius1414.com/2009/08/19/how-to-edit-remote-files-with-local-vim/
The vim tips wiki has an article on this, Editing remote files via scp in vim.
EDIT: Key authentication is not necessary for opening files over ssh. Vim will prompt for password.
It would be useful to note if netrw.vim was loaded by vim when it started.
:echo exists("g:loaded_netrwPlugin")
For opening files over ssh, you need your local machine's public key in the server's authorized keys. Following help section in vim documentation explains it pretty well.
:help netrw-ssh-hack
Quick way to export public key would be by using ssh-copy-id (if available).
ssh-copy-id user#host
And have a look at netrw documentation for network file editing over other protocols.
:help netrw
HTH.
According to the docs BufEnter is processed after the file has been read and the buffer created, so my guess is that netrw successfully read the file but you have a plugin that assumes the file is on the local filesystem and is trying to access it, e.g. to run ctags.
Try disabling all your plugin scripts except the default Vim ones, and then editing the file.
Also, try editing a directory to see if netrw can read that - you need to put the / on the end so that netrw knows it is a dir.
About your command, :e scp://username#remotehost/./path/to/file : note that with netrw, scp is taken relative to your home directory on that remote host. To avoid home-relative pathing, drop that "."; ie. :e scp://username#remotehost//path/to/file .
to accomplish this on windows download/install the Dokan library and Dokan SSHFS, which are the first and last links on this page.
I didn't think you were going to be able to directly edit a remote file using GVIM running locally. However, as others have pointed out, this is defintiely possible. This looks very interesting; I will check this out. I will leave the rest of my post up here, in case it is useful to anyone else, as an alternative method. This method will work even if you don't have SSH access to the file (ie, you only have FTP, or S3, or whatever).
You may get that effect, though, by tying GVIM into a graphical file transfer application. For example, on OS X, I use CyberDuck to transfer files (FTP, SFTP, etc). Then, I have it configured to use GVIM as my editor, so I can just double-click on a file in the remote listing, and CyberDuck will download a copy of that remote file, and open it in GVIM. When I save it in GVIM, CyberDuck uploads the file back to the remote host.
I'm sure that this functionality is not unique to CyberDuck, and is probably present in most nicer file transfer utilities.