Shift + right-click feels unintuitive to me.
How can I tell ST3 to allow Alt + drag to do column selection, like in many other programs?
I got this to work on Windows 7 using Sublime Text 3.
I created a file "C:\Users\\AppData\Roaming\Sublime Text 3\Packages\User\Default (Windows).sublime-mousemap", and put this in it:
[
{
"button": "button1","modifiers": ["alt"],
"press_command": "drag_select",
"press_args": {"by": "columns"}
},
]
The accepted answer by dwn is correct, but it is not complete answer.
This is more complex, because sometimes you need select two columns or just unselect some.You need something like this:
[
{
"button": "button1", "modifiers": ["alt"],
"press_command": "drag_select",
"press_args": {"by": "columns"}
},
{
"button": "button1", "modifiers": ["alt", "shift"],
"press_command": "drag_select",
"press_args": {"by": "columns", "additive": true}
},
{
"button": "button1", "modifiers": ["alt", "ctrl"],
"press_command": "drag_select",
"press_args": {"by": "columns", "subtractive": true}
}
]
Tested on Win 7 and Sublime Text 3
Related
I am trying to open my PDF document with Skim from Visual Studio Code. I would like the View LaTeX PDF file command to open in Skim my PDF document and update it automatically. Unfortunately, when I click on the View LaTeX PDF file button, it does not open Skim.
I am forced :
To open Skim myself;
And then to open the PDF file;
When I do this, everything works fine. The file updates correctly each time I save the LaTeX file.
So I would like to be able to open Skim with the PDF document directly from Visual Studio Code. As I try to do at the beginning of the video.
Note that I have already read these questions SyncTex with Skim pdf viewer?, PDF Preview in Visual Studio Code and the documentation.
My configuration is the following:
macOS (12.1)
Visual Studio Code (1.63.0)
LaTeX Workshop plug-in (v8.22.0).
Skim 1.6.7 (137)
pdfTeX 3.141592653-2.6-1.40.22 (TeX Live 2021) kpathsea version 6.3.3
Latexmk, John Collins, 29 September 2020. Version 4.70b
settings.json
{
"workbench.colorTheme": "Cobalt2",
"editor.formatOnSave": true,
"[javascript]": {
"editor.formatOnSave": true
},
"[javascriptreact]": {
"editor.formatOnSave": true
},
"prettier.disableLanguages": [
"javascript",
"javascriptreact"
],
"workbench.startupEditor": "newUntitledFile",
"latex-workshop.intellisense.package.enabled": true,
"latex-workshop.intellisense.unimathsymbols.enabled": true,
"latex-workshop.latex.recipes": [
{
"name": "latexmk 🔃",
"tools": [
"latexmk"
]
},
{
"name": "pdflatex ➞ bibtex ➞ pdflatex`×2",
"tools": [
"pdflatex",
"bibtex",
"pdflatex",
"pdflatex"
]
}
],
"latex-workshop.latex.tools": [
{
"name": "latexmk",
"command": "latexmk",
"args": [
"-shell-escape",
"-synctex=1",
"-interaction=nonstopmode",
"-file-line-error",
"-pdf",
"-outdir=%OUTDIR%",
"%DOC%"
],
"env": {}
},
{
"name": "pdflatex",
"command": "pdflatex",
"args": [
"-synctex=1",
"-interaction=nonstopmode",
"-file-line-error",
"%DOC%"
],
"env": {}
},
{
"name": "bibtex",
"command": "bibtex",
"args": [
"%DOCFILE%"
],
"env": {}
},
{
"name": "latexmk",
"command": "latexmk",
"args": [
"-xelatex",
"-synctex=1",
"-interaction=nonstopmode",
"-file-line-error",
"%DOC%"
]
}
],
"latex-workshop.latex.clean.subfolder.enabled": true,
"git.autofetch": true,
"terminal.integrated.fontFamily": "Inconsolata for Powerline",
"latex-workshop.view.pdf.viewer": "external",
"editor.minimap.enabled": false,
"editor.suggestSelection": "first",
"vsintellicode.modify.editor.suggestSelection": "automaticallyOverrodeDefaultValue",
"files.exclude": {
"**/.classpath": true,
"**/.project": true,
"**/.settings": true,
"**/.factorypath": true
},
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true
},
"workbench.iconTheme": "material-icon-theme",
"prolog.executablePath": "/Applications/SWI-Prolog.app/Contents/MacOS/swipl",
"python.languageServer": "Microsoft",
"editor.wordWrap": "on",
"latex-workshop.view.pdf.zoom": "page-fit",
"latex-workshop.view.pdf.external.viewer.args": [
"0",
"%PDF%"
],
"latex-workshop.view.pdf.external.viewer.command": "/Applications/Skim.app/Contents/SharedSupport/displayline",
"latex-workshop.view.pdf.external.synctex.command": "/Applications/Skim.app/Contents/SharedSupport/displayline",
"latex-workshop.view.pdf.external.synctex.args": [
"-r",
"-b",
"%LINE%",
"%PDF%",
"%TEX%"
],
"latex-workshop.latex.autoBuild.cleanAndRetry.enabled": true,
"latex-workshop.latex.autoClean.run": "onBuilt",
"latex-workshop.latex.clean.fileTypes": [
"*.aux",
"*.bbl",
"*.blg",
"*.idx",
"*.ind",
"*.lof",
"*.lot",
"*.out",
"*.toc",
"*.acn",
"*.acr",
"*.alg",
"*.glg",
"*.glo",
"*.gls",
"*.ist",
"*.fls",
"*.log",
"*.fdb_latexmk",
"*.snm",
"*.nav",
"*.synctex.gz",
"*.run.xml",
"*.bcf",
"__latexindent_temp.tex"
],
"explorer.confirmDelete": false,
"latex-workshop.latexindent.path": "/usr/local/texlive/2021/bin/universal-darwin/latexindent",
"security.workspace.trust.untrustedFiles": "open",
"editor.fontSize": 16
}
So...In fact, the problem does not come from the setting file. It is well formed and valid. The problem is a scripting support bug in Monterey12.1. The sdef parser can't handle synonyms. This has been documented here.
A workaround while waiting for an update is to edit the file /Applications/Skim.app/Contents/Resources/Skim.sdef and comment these lines of code
<!-- <synonym name="selection for"/> -->
<!-- <synonym name="get preferences"/> -->
It's not the kind of solution I like, but, in the meantime, it does the job here at first.
When I click on the line number at the left or if I triple click the text in the line, I don't want the following new line/line break to be selected. Is there any simple way to change the settings for this? It would save a lot of time when copying/pasting.
This won't help with clicking on the line number, but here's how you can change the triple-click. In Default (Windows).sublime-mousemap, the triple-click is defined like this:
// Drag select by lines
{
"button": "button1", "count": 3,
"press_command": "drag_select",
"press_args": {"by": "lines"},
},
You can override that definition by creating a corresponding Default (Windows).sublime-mousemap file in your User package, and then redefine it like this:
[
// Drag select by lines
{
"button": "button1", "count": 3,
"press_command": "drag_select",
"press_args": {"by": "lines"},
"command": "move",
"args": {"by": "characters", "extend": true, "forward": false}
},
]
Note: The press_command/press_args lines are what happens on the button's way down (the third time in this case). Adding the command/args lines tells it what to do when the button comes back up.
Likewise, you can define an alternative to the Expand Selection to Line command keybinding (ctrl+L) in your User\Default (Windows).sublime-keymap:
{ "keys": ["alt+l"], "command": "chain", "args": {
"commands": [
["expand_selection", {"to": "line"}],
["move", {"by": "characters", "extend": true, "forward": false}],
]
}
}
In this case, you can't have two command/arg lines directly in the same binding, so we go through the "chain" command.
I've been using Sublime Text for a little while now (on MacBook Pro), and want to make it keystroke compatible with the shell.
In the shell, to jump to the beginning/end of line I press fn+Left/fn+Right.
In Sublime Text, I understand how to set up key bindings for fn+Left/fn+Right, but I see no key name for the fn key (not the f1, f2, etc. function keys, I am referring to the key marked "fn").
How can I make this work in Sublime Text?
I guess I was making it too hard on myself.
the fn button does not have a key name in Sublime Text.
fn+Left/fn+Right is read as Home/End. Simply mapping Home and End did the job.
Specifically:
Sublime Text | Preferences | Key Bindings - User
Add the following between the [ ]:
{ "keys": ["home"], "command": "move_to", "args": { "to": "hardbol" } },
{ "keys": ["end"], "command": "move_to", "args": { "to": "hardeol" } }
I discovered this by opening up the SublimeText console:
ctrl+`
sublime.log_input(True)
Now, typing any keys reveal their Sublime Text key names. fn did not elicit a response, but fn+Left/fn+Right yielded Home/End.
sublime.log_input(False)
Hope that helps.
For me(on MBP):
cmd and left worked as Home
cmd and Right worked as End
Without changing any configuration in Preferences.
Open menu Sublime Text > Preferences > Key Bindings
Add the following to the array (between square brackets []):
{ "keys": ["home"], "command": "move_to", "args": {"to": "bol"} },
{ "keys": ["end"], "command": "move_to", "args": {"to": "eol"} },
{ "keys": ["shift+end"], "command": "move_to", "args": {"to": "eol", "extend": true} },
{ "keys": ["shift+home"], "command": "move_to", "args": {"to": "bol", "extend": true } }
You can now use the following combinations:
Go to beginning of line: Home
Go to end of line: End
Select from cursor position to beginning of line: ⇧+Home
Select from the cursor position to end of line: ⇧+End
For adding the keybindings to ST4 on Macbook Pro (to match the windows ones with home and end), this worked
[
{ "keys": ["home"], "command": "move_to", "args": {"to": "bol"} },
{ "keys": ["end"], "command": "move_to", "args": {"to": "eol"} },
{ "keys": ["ctrl+home"], "command": "move_to", "args": {"to": "bof"} },
{ "keys": ["ctrl+end"], "command": "move_to", "args": {"to": "eof"} },
{ "keys": ["shift+end"], "command": "move_to", "args": {"to": "eol", "extend": true} },
{ "keys": ["shift+home"], "command": "move_to", "args": {"to": "bol", "extend": true } },
{ "keys": ["ctrl+shift+end"], "command": "move_to", "args": {"to": "eof", "extend": true} },
{ "keys": ["ctrl+shift+home"], "command": "move_to", "args": {"to": "bof", "extend": true } },
]
When i choose in REPL, EVAL or TRANSFER i have the following error running a py:
Cannot find REPL for 'python'
I use python 3, and reading other post i make this changes to use in sublime text 3
1.Create a file name: Python3.sublime.build with the following code:
{
"path": "/Library/Frameworks/Python.framework/Versions/3.3/bin/",
"cmd": ["python3.3", "-u", "$file"],
"env":{},
"file_regex": "^[ ]*File \"(...*?)\", line ([0-9]*)",
"selector": "source.python"
}
Then i have the option to build a Python3 System
2.In settings in sublime REPL - Default i put this:
"default_extend_env": {"PATH": "/Library/Frameworks/Python.framework/Versions/3.3/bin/python3:{PATH}"},
and change the file Main.sublime-menu in located in Packages/SublimeREPL/config/Python with this:
[
{
"id": "tools",
"children":
[{
"caption": "SublimeREPL",
"mnemonic": "r",
"id": "SublimeREPL",
"children":
[
{"caption": "Python",
"id": "Python",
"children":[
{"command": "repl_open",
"caption": "Python 3",
"id": "repl_python3",
"mnemonic": "p",
"args": {
"type": "subprocess",
"encoding": "utf8",
"cmd": ["/Library/Frameworks/Python.framework/Versions/3.3/bin/python3", "-i", "-u"],
"cwd": "$file_path",
"syntax": "Packages/Python/Python.tmLanguage",
"external_id": "python",
"extend_env": {"PYTHONIOENCODING": "utf-8"}
}
},
{"command": "repl_open",
"caption": "Python 3 - IPython",
"id": "repl_python_ipython3",
"mnemonic": "p",
"args": {
"type": "subprocess",
"encoding": "utf8",
"autocomplete_server": true,
"cmd": {
"osx": ["/Library/Frameworks/Python.framework/Versions/3.3/bin/python3", "-u", "${packages}/SublimeREPL/config/Python/ipy_repl.py"],
"linux": ["/Library/Frameworks/Python.framework/Versions/3.3/bin/python3", "-u", "${packages}/SublimeREPL/config/Python/ipy_repl.py"],
"windows": ["/Library/Frameworks/Python.framework/Versions/3.3/bin/python3", "-u", "${packages}/SublimeREPL/config/Python/ipy_repl.py"]
},
"cwd": "$file_path",
"syntax": "Packages/Python/Python.tmLanguage",
"external_id": "python",
"extend_env": {
"PYTHONIOENCODING": "utf-8",
"SUBLIMEREPL_EDITOR": "$editor"
}
}
}
]}
]
}]
}
]
I think there's must be an easy way to refer python 3 but i don't find it or not find clear, when i choose in Tools, SublimeREPL, Python and Python 3 it open a new tab with python 3
Set Layout to "2 Rows" under View Menu.
Select "SublimeREPL:Python" from the Command Palette under Tools.
~Morgan (very new at this)
"https://superuser.com/questions/755320/sublime-text-cant-find-interpreters-for-sublimerepl"
Was the deal/fix on my side. ** REPL needs to be open first. . . . **
Dunno if its the same for others, but this small detail was the key for me.
lol.
Hope that helps
I am wanting to force myself to use hjkl to navigate while practising VIM in Sublime text. I.e. I would like to map the cursor keys to do nothing in insert mode.
Add the following lines in your "Packages/User/Default.sublime-keymap".
[
{"keys": ["up"], "command": "pass",
"context": [{ "key": "setting.command_mode", "operand": false }]},
{"keys": ["down"], "command": "pass",
"context": [{ "key": "setting.command_mode", "operand": false }]},
{"keys": ["left"], "command": "pass",
"context": [{ "key": "setting.command_mode", "operand": false }]},
{"keys": ["right"], "command": "pass",
"context": [{ "key": "setting.command_mode", "operand": false }]}
]
(If you already have the file, insert {"keys" ... }]} lines before the last ] in your file.)