remap ctrl-k in atom doesn't work - atom-editor

I have the following entries in my keymap.cson:
'.workspace':
'ctrl-k': 'core:move-up'
'ctrl-j': 'core:move-down
The ctrl-j mapping works, the ctrl-k doesn't. Isn't it possible to remap ctrl-k ?

The following works:
'atom-text-editor':
'ctrl-k': 'core:move-up'

Related

Change a color in Powerlevel10k

How can I change the directories colors that appears as options for the autocomplete in zsh Powerlevel10k ?
As you can see in the image they don't really stand out very well with a dark background color.
I've tried to dig in the .oh-my-zsh/custom/themes/powerlevel10k/config but to no avail.
Thanks to Roman's answer, and after finding this post (so this question might be a duplicate) I have simply:
Created a ~/.dircolors (could be any path you'd like) file and copied the standard LS colors to it by doing
dircolors --print-database > ~/.dircolors
Found the line that deal with the directories' LS color and changed it (of course you can change to any color you'd like), i.e.
DIR 01;34
To this:
DIR 01;36
Sourced the new .dircolors file in my .zshrc by adding:
d=~/.dircolors
test -r $d && eval "$(dircolors $d)"
From their official docs, https://github.com/romkatv/powerlevel10k/blob/master/README.md#directory-is-difficult-to-see-in-prompt-when-using-rainbow-style.
for i in {0..255}; do print -Pn "%K{$i} %k%F{$i}${(l:3::0:)i}%f " ${${(M)$((i%6)):#3}:+$'\n'}; done
Execute this in your terminal to see the color code as well.

How to scroll up in Vim buffer with R (using Nvim-R)

I'm a happy user of the Nvim-R plugin, but I cannot find out how to scroll up in the buffer window that the plugin opens with R. Say for instance that I have a large output in console, but I cannot see the top of it - how do I scroll up to see this? In tmux for instance there's a copy mode that quite handily lets you do this, but how is this done in the R buffer?
An example below where I'm very curious to see what's on the line above the one begining with "is.na(a)...". How can this be achieved?
I have scoured the documentation found here, but without luck.
The answer is apparently to use Ctrl+\ Ctrl+n according to this answer on the bugreports for NVim-R.
Here's what my output looks like when I output mtcars:
When I hit Ctrl+\ Ctrl+n, I can move the cursor and I get line numbers:
To get back to interactive, I just use i, the same way I normally would.
Apparently, if you are using neovim, then you can add let R_esc_term = 0 in your ~/.vimrc file and you can then use the escape key, but if you don't use neovim, you are stuck using the two ctrl commands ¯\_(ツ)_/¯.
As pointed out by ZNK, it is about switching to normal mode in Vim's terminal. This, however, can easily fail due to cumbersome keybinding. If such is the case, remap the default keybinding to something reasonable, say, by putting this in your .vimrc:
tnoremap jk <C-\><C-n>
This works for me in Linux running Vim 8.0 in terminal (e.g. does not require Neovim). As you can see, I use 'jk' to switch from insert to normal mode. One can use Esc instead of jk, however, this makes me unable to use up arrow to retrieve command line history as been reported elsewhere.

Keybindings with ZSH

Can anyone tell me how to move back a word in ZSH? Ctrl+b will move back a character but not an entire word.
For instance a log command like this:
knife zero bootstrap mbigglesworth#10.10.1.108 --sudo-preserve-home --ssh-user mbigglesworth --sudo --policy-name linux_mint_wkstn -N linuxmint-vm -VV
...is painful to get to the middle of!
ESCAPE+b or ESCAPE+f to move back one word or forward one word respectively
EDIT
The mentioned above are the defaults(as far as I'm concerned)
#TyMac mentions that the defaults are uppercase in his system though (ESCAPE-B, ESCAPE-F)
You may perfectly set them manually by inserting the following lines in your zshrc
bindkey "^[b" backward-word
bindkey "^[f" forward-word
in case you don't like the defaults you may set it to some different key combo using this same syntax (I would suggest that it's preferable to use the defaults though but that's just personal opinion)
Ctrl+Left or Ctrl+Right to move back and forward one word.
It does, however, depend heavily on your configuration. Read more here.
A list of other handy default keybindings is here

zsh autocorrect, edit option. Possible to bring cursor to the wrong command?

This is only a tiny, tiny gripe I just experienced right now.
zsh will try to autocorrect car someTextFile.txt. Unfortunately zsh suggests xar someTextFile.txt when I really want cat.
When I choose the edit option (eat the [nyae] prompt), zsh presents me with this:
car someTextFile.txt| (the |is the cursor position). What I would really like is for zsh to place the cursor at the misspelled command. Like this: car| someTextFile.txt – is that possible?
Just a small annoyance :-)
I don't know how to accomplish what you desire. However, for commands that you commonly mistype you can add an alias to your .zshrc:
alias car='cat'
That way, when you mistype, 'car' will be run 'cat'.

Why do <C-PageUp> and <C-PageDown> not work in vim?

I have Vim 7.2 installed on Windows. In GVim, the <C-PageUp> and <C-PageDown> work for navigation between tabs by default. However, it doesn't work for Vim.
I have even added the below lines in _vimrc, but it still does not work.
map <C-PageUp> :tabp<CR>
map <C-PageDown> :tabn<CR>
But, map and works.
map <C-left> :tabp<CR>
map <C-right> :tabn<CR>
Does anybody have a clue why?
The problem you describe is generally caused by vim's terminal settings not knowing the correct character sequence for a given key (on a console, all keystrokes are turned into a sequence of characters). It can also be caused by your console not sending a distinct character sequence for the key you're trying to press.
If it's the former problem, doing something like this can work around it:
:map <CTRL-V><CTRL-PAGEUP> :tabp<CR>
Where <CTRL-V> and <CTRL-PAGEUP> are literally those keys, not "less than, C, T, R, ... etc.".
If it's the latter problem then you need to either adjust the settings of your terminal program or get a different terminal program. (I'm not sure which of these options actually exist on Windows.)
This may seem obvious to many, but konsole users should be aware that some versions bind ctrl-pageup / ctrl-pagedown as secondary bindings to it's own tabbed window feature, (which may not be obvious if you don't use that feature).
Simply clearing them from the 'Configure Shortcuts' menu got them working in vim correctly for me. I guess other terminals may have similar features enabeld by default.
I'm adding this answer, taking details from vi & Vim, to integrate those that are already been given/accepted with some more details that sound very important to me.
The alredy proposed answers
It is true what the other answer says:
map <C-PageUp> :echo "hello"<CR> won't work because Vim doesn't know what escape sequence corresponds to the keycode <C-PageUp>;
one solution is to type the escape sequence explicitly: map ^[[5^ :echo "hello"<CR>, where the escape sequence ^[[5^ (which is in general different from terminal to terminal) can be obtained by Ctrl+VCtrl+PageUp.
One additional important detail
On the other hand the best solution for me is the following
set <F13>=^[[5^
map <F13> :echo "hello"<CR>
which makes use of one of additional function key codes (you can use up to <F37>). Likewise, you could have a bunch of set keycode=escapesequence all together in a single place in your .vimrc (or in another dedicated file that you source from your .vimrc, why not?).

Resources