My Positron Setup Guide

Author

zenggyu

Published

2024-07-09

Modified

2025-11-10

Abstract
Guidance on setting up a fresh Positron installation.

Introduction

This is one of a series of posts where I document software configurations for personal reference. This post documents the configurations for Positron.

Extensions

  • Databot:
    • In positron: ctrl + p -> ext install posit.databot.
  • GitLens:
    • In positron: ctrl + p -> ext install eamodio.gitlens.
  • Mermaid Chart:
    • In positron: ctrl + p -> ext install mermaidchart.vscode-mermaid-chart.
  • pastum:
    • In positron: ctrl + p -> ext install atsyplenkov.pastum.
  • shellcheck:
    • In shell: sudo apt install shellcheck.
    • In positron: ctrl + p -> ext install timonwong.shellcheck.
  • shell-format:
    • Download shfmt executable binary, rename it as shfmt, save it to /usr/local/bin/, and make it executable.
    • In positron: ctrl + p -> ext install foxundermoon.shell-format.
  • SQL Formatter VSCode:
    • In positron: ctrl + p -> ext install renesaarsoo.sql-formatter-vsc
  • sqltools:
    • In positron: ctrl + p -> ext install mtxr.sqltools

Settings

Go to “Preferences” - “Settings” and change the following settings:

  • Text Editor
    • Tab Size: 2
    • Word Wrap: "on"
    • Find
      • Auto Find In Selection: "multiline"
    • Font
      • Font Family: 'Ubuntu Mono', 'Droid Sans Mono', 'monospace', monospace, 'Droid Sans Fallback'
    • Formatting
      • Format On Save: true
    • Suggestion
      • Accept Suggestion On Enter: "off"
    • Files
      • Auto Guess Encoding: true
  • Workbench
    • Color Theme: "Positron Dark"
  • Features
    • Extensions
      • Auto Check Updates: false
      • Auto Update: None
      • Ignore Recommendations: true
    • Terminal
      • Integrated: Cursor Blinking: true
      • Integrated: Enable Visual Bell: true
      • Integrated: Scrollback: 10000
  • Application:
    • Proxy:
      • Proxy: socks5://127.0.0.1:1080
  • Security
    • Workspace
      • Trust: Untrusted Files: "open"
  • Extensions:
    • Databot:
      • Research Preview Acknowledgment: Acknowledged
    • shell-format configuration
      • Shellformat: Path: "/usr/local/bin/shfmt"
    • Positron Assistant:
      • Assistant: Enable: true
    • SQL Formatter:
      • Data Type Case: upper
      • Function Case: upper
      • Identifier Case: lower
      • Keyword Case: upper

Keybindings

Go to “Preferences” - “Keyboard Shortcuts” and change the following shorcuts:

  • Reindent Selected Lines: Ctrl + K Ctrl + I when editorTextFocus && !editorReadonly (remove conflicting keybinding for “Show or Focus Hover”)

Useful shortcuts that use default:

  • Change Language Mode: Ctrl + K M
  • Console: Execute Code: Ctrl + Enter
  • File: New Untitled Text File: Ctrl + N
  • File: Open Folder: Ctrl + K Ctrl + O
  • Format Selection: Ctrl + K Ctrl + F
  • Help: Show Help at Cursor: F1
  • Quarto: Insert Code Cell: Ctrl + Shift + I
  • R: Insert the pipe operator: Ctrl + Shift + M
  • Show All Commands: Ctrl + Shift + P
  • Toggle Line Comment: Ctrl + /
  • View: Split Editor: Ctrl + \
  • View: Copy Editor into New Window: Ctrl + K O

Snippets

Go to “Preferences” - “Configure Snippets” and add the following snippets:

  • r:
"httr2-request": {
    "prefix": "httr2-request",
    "body": [
        "library(httr2)",
        "",
        "req <- request(\"$1\") |>",
        "\treq_method(\"${2:POST}\") |>",
        "\treq_headers(",
        "\t\tAuthorization = \"${3}\",",
        "\t\t`Content-Type` = \"application/json\"",
        "\t) |>",
        "\treq_body_json(",
        "\t\tlist()",
        "\t)",
        "",
        "resp <- req |>",
        "\treq_perform()",
        "",
        "resp |>",
        "\tresp_body_json()",
        ""
    ]
}