Sublime Forum

Add caret on line down

#1

I am trying to run sublime text on Linux Lubuntu.

When I try to add a caret on the line under, nothing happens, but my screen just sort of blinks.

What is the name of the command that adds a caret to the next line. I can not find it anywhere is the keymap.

I need to remap it, or I am guessing remap ctrl+shift+down is already mapped to something in lubuntu.

Also I can not find the keymap ctrl+shift+down anywhere in the keymappings file.

0 Likes

#2

I think the command you want is select_lines, but it’s bound to Alt+Shift+Up and Alt+Shift+Down by default:

{ "keys": ["alt+shift+up"], "command": "select_lines", "args": {"forward": false} },
{ "keys": ["alt+shift+down"], "command": "select_lines", "args": {"forward": true} },

The commands bound to Ctrl+Shift+Up and Ctrl+Shift+Down are swap_line_up and swap_line_down respectively:

{ "keys": ["ctrl+shift+up"], "command": "swap_line_up" },
{ "keys": ["ctrl+shift+down"], "command": "swap_line_down" },

select_lines adds an extra caret to the line above or below the current line, while swap_line_up and swap_line_down shift the location of the current line or selection up and down in the file.

These bindings are from the Default (Linux).sublime-keymap file. Something that sometimes trips me up when searching for things in the key map is that if you have the regex mode turned on, + is special to a regex and doesn’t match the way you expect, so that may be biting you.

A method to determine what command is bound to what keys is to open the Sublime console with Ctrl+` or View > Show Console and then enter the command sublime.log_commands(True) in the console to have it log commands as they execute (Do it again with False or restart Sublime to turn that off).

However if the problem is that the window manager is eating the key before Sublime sees it (which it sounds like it is) that’s not as useful when you’re trying to find what to remap to a key it’s not already using. :slight_smile:

0 Likes

#3

Yes my window manager is eating both ctrl+alt+down and alt+shift+down are being eaten!!

OMG that is so annoying, I don’t have any other good mappings to use, and I prefer to use ctrl+alt+down like my windows rig.

0 Likes

#4

I’m not familiar with that distribution, but there may possibly be some window manager settings to alter/disable default key bindings so that they become available for Sublime to use.

0 Likes

#5

I had the same issue on plain Ubuntu. I unmapped the keybindings with the following commands. I don’t know whether they’re of any help on Lubuntu, but maybe it’s a helpful starting point for further research.

gsettings set org.gnome.desktop.wm.keybindings switch-to-workspace-up "['']"
gsettings set org.gnome.desktop.wm.keybindings switch-to-workspace-down "['']"

If this doesn’t work and you want to reset it:

gsettings reset org.gnome.desktop.wm.keybindings switch-to-workspace-up
gsettings reset org.gnome.desktop.wm.keybindings switch-to-workspace-down
1 Like