I want to reconfigure certain keys in the ideavim plugin for phpstorm. Specifcally change 0 to act like ^ in normal mode.
Is this possible? I tried looking at the keymaps settings for vim, but it doesn't have an action called go to beginning of line(ignoring whitespace) and strangely all the keys for vim are shown as regular keys (home , end etc) and not vim keys.
Anybody knows whats up?
Figured it out !
settings > keymaps > select the chosen keymap (vim) > in the list drill down to plugins > ideavim > and edit away!
The IdeaVim plugin also supports a subset of the vimrc commands.
You have to store your file in ~/.ideavimrc
You could for example enter there:
nnoremap 0 ^
Related
I'm trying to set auto-complete for readline to enable a user to navigate through the filesystem directories when running a script through CLI.
I found out PHP has a function called readline_completion_function for this purpose but every time I hit tab to complete a word, it adds a space at the end.
readline_completion_function(function() {
return ['aaa', 'bbb', 'ccc'];
});
// Input a or b or c
readline('Add char and tab: ');
I've create fiddle for you to test this:
https://repl.it/#rmdev/Readline-Completion-Tab-Extra-Space
I saw on Python readline configs that there's a configuration called set_completer_delims to set a character to be apendend after tab is hit but in PHP there are only two configurations and none of them apply to the completer delims.
I also saw some posts referring to this as a known bug but it seems it has been fixed on most of the integrations although I don't see any reference to a fix for the PHP one.
Is there any way to remove this space?
I'm using PHP 7.2.12 on a Mac.
I'm intending to format the selection (indentation) for the PHP code, but it does not work.
I already made sure that there aren't duplicate shortcuts.
I also disabled all extensions.
I changed the keyboard shortcut from Ctrl+K Ctrl+f to Ctrl+k Ctrl+y.
None of these helped.
Is the only language that does not work for me to format selection
Eye. It's not because I'm missing the closing tag (?>).
To see menu bar if not present press
Left Alt
then go:
Preferences > Keyboard Shortcuts
type in the search bar
ctrl+k ctrl+f
you should see
perhaps you have a collision and other command has the same shortcut defined or your shortcut is not defined at all.
You can double click on shortcut to edit it.
Note at the picture When this is when the command works because one shortcut may work only if you are currently editing document and other when you are browsing files so once you set a shortcut make sure your checking it in different places of editor to see if its working or not.
If you use shortcut:
Ctrl+Shift+P
and select command:
You'll see whole bunch of shortcuts and there should be there one you are missing:
{ "key": "ctrl+k ctrl+f", "command": "editor.action.formatSelection",
"when": "editorHasDocumentSelectionFormattingProvider && editorHasDocumentSelectionFormattingProvider && editorTextFocus && !editorReadonly" },
I think that you can just copy the one above, paste to your file if it is not present and save that file, restart your Code and all should be working. Remember that the file is JSON so keep its format - look how other keys are presented there and your pasting should not make JSON invalid.
.vue file doesn't have formate selection.
This function depends on your file type.
I checked that this key binding was indeed still specified, there was no duplicate key binding, etc.; still, Visual Studio Code refused to recognize the key combination. Then I quit visual studio code and restarted it, and the key combination started working again.
Sometimes, the basic quit-and-restart is the answer!
If nothing is working you can create your own "format selection" with multiple commands. You would need a code formatter and a macro extension to run multiple commands from one keybinding,I'm using "prettier" and "multi-command" extension.
You can use this keybinding in your keybindings.json (Click File -> Preferences -> Keyboard shortcuts. Use the tab that opens up to edit and find available key bindings) with the multi-command extension - no need for anything in settings.json:
{
"key": "Shift+Alt+A", // or whatever keybinding you wish
"command": "extension.multiCommand.execute",
"args": {
"sequence": [
"editor.action.formatDocument",
"editor.action.clipboardCopyAction",
"undo",
"editor.action.clipboardPasteAction",
]
},
"when": "editorHasDocumentFormattingProvider && editorTextFocus && !editorReadonly"
}
I use it because "format selection" is not working with "*.vue" files.
I'm trying to get some "repl-like" feature for PHP, inside vim.
Basically, what I want is to be able to visually select a part of my script, execute it, and see the result in a separate buffer.
But I don't want to execute the whole current file (so :!php % doesn't do the trick ...)
I found the vim-quickrun plugin, which seems to greatly fit that need, but can't make it work and when looking for more documentation, most of the result I get are in japanese (I don't speak japanese :( ... )
For now, I have installed the plugin via Vundle, but have not added any extra configuration to my .vimrc
From inside a file, I can type
...
echo 'hello quickrun sh test'
...
=> visual select the date line, and type
:QuickRun sh
I got my hello world printed, all fine
But if I do
...
echo 'hellow quickrun php'
...
=> visual select ...
:QuickRun php
I just get a buffer with just the same text that I typed, no execution ...
Does someone already achieved something like this ?
Thanks a lot !
EDIT :
PHP is correctly added to my PATH. Added the 2 config lines suggested below ... Sadly, it doesn't change anything :(
You need to put the php flags around your php code, like any php script (it always starts in plain text mode):
...
<?php
echo 'hellow quickrun php';
?>
....
Then you can select only one part with QuickRun, but don't forget to select the flags as well.
I don't use that plugin, but I think you need to configure something like this in your ~/.vimrc:
let g:quickrun_config = {}
let g:quickrun_config.php = {'command' : 'php'}
and have the php executable in your PATH.
The following solution does not use vim-quickrun but allows you to visually select, execute and see the result just as you like. You need vim-slime with phpsh :
First, install the vim-slime plugin. It allows to send lines and visually selected chunks of code from VIM to a screen or tmux session.
Now install screen: On Ubuntu, do sudo apt-get install screen.
Open a terminal and start screen with a session name: screen -S sessionname.
Open a second terminal and start vim. Write some code, visually select it and press <C-c><C-c>, that is two times CTRL+C. You will be asked for the session name, use sessionname as before. The selected lines will be sent to the first terminal just as if you had written them directly there.
To make use of this functionality, you need to start an interactive PHP shell in the first terminal, such as phpsh.
question like this post:
How to disable default English dictionary in Pspell and use only Custom dictionary?
I create my custom dictionary. And test in console - all work fine. Console query like this:
echo Engenier | aspell -a -d /var/www/Lib/profiles.rws
result - only 1 suggestion. It`s correct result
But i cant repeat this result with pspell
I try this variant (http://board.phpbuilder.com/showthread.php?10298706-Resolved-pspell-hell), but this doesn`t help me
All time in many variants load base "EN" dictionary with my custom. But i need only custom
How I can use only my dict?
PS: pspell - aspell for php
http://www.php.net/manual/en/ref.pspell.php
Hi i have followed the below procedure to enable my custom dictionary only.
Creation of custom dictionary:
1. Create a file called custom.txt in your home directory
touch ~/custom.txt
Add the words that you'd like to add to the dictionary, where each word is on a separate line, then run the following command
sudo aspell --lang=en create master /usr/lib/aspell/custom.rws < ~/custom.txt
To finish adding it to the dictionary change into the dictionary directory by running the following:
cd /usr/lib/aspell/
then edit the following file:
en.multi
and add the following line:
add custom.rws
5 .Then the new words should be available to you in Aspell. If you want to add words to this list in future, edit the ~/custom.txt file and run this command again:
sudo aspell --lang=en create master /usr/lib/aspell/custom.rws < ~/custom.txt
Removing default english dictionary:
Open usr/lib/aspell/en.multi file. And comment the following line
#add en-wo_accents.multi
Then the custom words only should be available to you in Aspell.
I'm using Eclim, in doc Suggested Vim Mappings , I know a mapping for PHP
nnoremap <silent> <buffer> <cr> :PhpSearchContext<cr>
but it opens a horizontal window, how to change it to a vertical window?
Just like diff between :help and :vert bo help
Place in your .vimrc the following:
let g:EclimDefaultFileOpenAction = 'vsplit'
Or, you can add such settings for PHP only:
let g:EclimPhpSearchSingleResult = 'vsplit'
Unfortunately, such value 'vsplit' is not stated in the Eclim's documentation, I just remember the same question in the eclim-user mailing list.