Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How can I make 'S' do a replace in normal mode like in vim? #3910

Closed
pmalek opened this issue Jul 22, 2019 · 4 comments
Closed

How can I make 'S' do a replace in normal mode like in vim? #3910

pmalek opened this issue Jul 22, 2019 · 4 comments

Comments

@pmalek
Copy link

pmalek commented Jul 22, 2019

Describe the bug
"S" in normal mode doesn't work.

I've tried the following in settings.json

"vim.normalModeKeyBindings": [
    {
        "before": ["S"],
        "after": ["cc"]
    }
]

but it also didn't work.

To Reproduce
Steps to reproduce the behavior:

  1. go to a line in editor and press "S" (Shift + S)
  2. expect the line content to be delete and to end up in insert mode

Expected behavior
I would expect to delete the whole line contents and go to insert mode.
To my surprise "cc" works (exactly like I'd like "S" to work).

Environment (please complete the following information):

  • Extension (VsCodeVim) version:v1.8.2 (2019-07-15)
  • VSCode version: 1.36.1
  • OS: Ubuntu 18.04
  • settings.json
{
    "window.title": "${activeEditorLong}${separator}${rootName}",

    // make the side bar smaller
    "window.zoomLevel": 2,
    "terminal.integrated.fontSize": 13,
    "terminal.integrated.shell.linux": "/usr/bin/zsh",

    "update.mode": "default",
    "blockhighlight.background": [220, 220, 250, 0.1],
    "diffEditor.ignoreTrimWhitespace": false,

    "[markdown]": {
        "editor.wordWrap": "off",
        "editor.quickSuggestions": true,
        "editor.rulers": [80],
    },
    "[makefile]": {
        "editor.tabSize": 4,
        "editor.insertSpaces": false,
        "editor.detectIndentation": false,
    },
    "editor.renderLineHighlight": "all",
    "editor.multiCursorModifier": "alt",
    "editor.renderControlCharacters": false,
    "editor.minimap.enabled": false,
    "editor.hover.delay": 200,
    "editor.parameterHints.cycle": true,
    "editor.parameterHints.enabled": true,
    "editor.hover.sticky": true,
    "editor.suggest.snippetsPreventQuickSuggestions":false,
    "editor.occurrencesHighlight": true,
    "editor.selectionHighlight": true,
    "editor.maxTokenizationLineLength": 705000,
    "editor.lineHeight": 12.5,
    "editor.fontSize": 12,
    "editor.letterSpacing": -0.2,
    "editor.fontFamily": "Menlo, Monaco, 'Courier New', monospace",
    // "editor.fontFamily": "FiraCode-Retina",
    // "editor.fontFamily": "Fira Code",
    // "editor.fontWeight": "300", // Light
    // "editor.fontWeight": "400", // Regular
    // "editor.fontWeight": "500", // Medium
    // "editor.fontWeight": "600", // Bold
    "editor.fontLigatures": false,


    // Go
    "[go]": {
        "editor.rulers": [ 80, 100],
        "editor.snippetSuggestions": "top",
        "editor.formatOnSave": true,
        "editor.codeActionsOnSave": {
            "source.organizeImports": true
        },
        "editor.tabSize": 4,
        "editor.insertSpaces": true,
    },
    "go.testFlags": ["-count", "1", "-v"],
    // "go.liveErrors": {
    //     "enabled": true,
    //     "delay": 1000
    // },
    "go.formatTool": "goimports",
    "go.formatFlags": ["-v", "-w", "-trace", "/tmp/trace"],
    "go.vetOnSave": "off",
    "go.buildOnSave": "off",
    "go.autocompleteUnimportedPackages": true,
    "go.useLanguageServer": true,
    "go.alternateTools": {
        "go-langserver": "gopls", 
    },
    // TODO change when gopls gets official support
    // "gopls": {
    //     "usePlaceholders": true, // add parameter placeholders when completing a function
    //     "enhancedHover": true,   // experimental to improve quality of hover (will be on by default soon)
    // },
    "go.languageServerExperimentalFeatures": {
        "findReferences": true,
        "workspaceSymbols": true,
        "format": true,
        "autoComplete": true,
        "diagnostics": true,
        "goToDefinition": true,
        "hover": true,
        "signatureHelp": true,
        "goToTypeDefinition": true,
        "documentSymbols": true,
    },
    "go.languageServerFlags": [
        "-logfile", "/tmp/gopls.log",
    ],
    "go.lintOnSave": "off",
    "go.lintTool": "golangci-lint",
    "go.lintFlags": [
        "--fast",
        "--exclude", "unsafeptr",
        "--skip-dirs", "/Users/pmalek/.gvm/gos/.*",
    ],

    "code-runner.fileDirectoryAsCwd": true,
    "code-runner.saveFileBeforeRun": true,
    "code-runner.clearPreviousOutput": false,
    "code-runner.runInTerminal": true,
    "code-runner.ignoreSelection": true,

    // "markdown-preview-enhanced.liveUpdate": true,
    "markdownlint.config": {
        "MD013": false,
        "MD040": false,
        "MD010": false,
    },

    "todohighlight.isEnable": true,
    "todohighlight.include": [
        "**/*.go"
    ],
    "todohighlight.exclude": [
        "**/vendor/**",
        "**/pkg/**",
        "**/node_modules/**",
        "**/bower_components/**",
        "**/dist/**",
        "**/build/**",
        "**/.vscode/**",
        "**/.github/**",
        "**/_output/**",
        "**/*.min.*",
        "**/*.map",
        "**/.next/**"
    ],
    "todohighlight.keywordsPattern": "TODO:?|TODO\\(([^)]+)\\)|FIXME:",
    // "todohighlight.keywordsPattern": "TODO:?|TODO|FIXME:",

    "vim.disableExtension": false,
    "vim.debug.silent": true,
    "vim.leader": ",",
    "vim.enableNeovim": true,
    "vim.neovimPath": "/usr/local/bin/nvim",
    "vim.hlsearch": true,
    "vim.incsearch": true,
    "vim.foldfix": true,
    "vim.timeout": 500,
    "vim.easymotion": true,
    "vim.sneak": true,
    "vim.handleKeys": {
        "<C-f>": false
    },
    "vim.insertModeKeyBindings": [
        {
            "before": ["k", "j"],
            "after": ["<Esc>"]
        },
    ],
    "vim.normalModeKeyBindings": [
        {
            "before": [";"],
            "after": [":"]
        },
        {
            "before": ["S"],
            "after": ["cc"]
        },
        {
            "before": [ "<leader>", "d" , "w"],
            "after": [],
            "commands": [
                {
                    "command": "editor.action.previewDeclaration",
                    "args": []
                }
            ]
        },
        {
            "before": [ "<leader>", "d" , "d"],
            "after": [],
            "commands": [
                {
                    "command": "editor.action.goToDeclaration",
                    "args": []
                }
            ]
        },
        {
            "before": [ "<leader>", "d" , "s"],
            "after": [],
            "commands": [
                {
                    "command": "editor.action.openDeclarationToTheSide",
                    "args": []
                }
            ]
        },
        {
            "before": [
                "u"
            ],
            "after": [],
            "commands": [
                {
                    "command": "undo"
                }
            ]
        },
        {
            "before": [
                "<C-r>"
            ],
            "after": [],
            "commands": [
                {
                    "command": "redo"
                }
            ]
        },
    ],
    "vim.normalModeKeyBindingsNonRecursive": [
        {
            "before": ["<leader>", "m"],
            "commands": [
                "bookmarks.toggle"
            ]
        },
        {
            "before": ["<leader>", "b"],
            "commands": [
                "bookmarks.list"
            ]
        }
    ],

    "auto-comment-blocks.singleLineBlockOnEnter": true,
    "auto-comment-blocks.slashStyleBlocks": [
        "go",
    ],
    "files.associations": {
        "*.Makefile": "makefile"
    },

    // Explorer
    "explorer.confirmDelete": false,
    "explorer.confirmDragAndDrop": false,

    // Visuals
    "workbench.iconTheme": "vscode-great-icons",
    "workbench.editor.enablePreview": false,
    "workbench.colorCustomizations": {
        // in the editor itself
        "editor.selectionHighlightBackground": "#ffbb00",
        "editor.selectionBackground": "#00aaff",

        // Scrollbar
        // SCM
        "editorOverviewRuler.addedForeground": "#00bb00",
        // "editorOverviewRuler.modifiedForeground": "#0000",
        "editorOverviewRuler.deletedForeground": "#0000",
        // selection
        "editorOverviewRuler.selectionHighlightForeground": "#ffbb00",
    
        // Gutter (on the left)
        "editorGutter.addedBackground": "#00bb00",
        "editorGutter.modifiedBackground": "#ff8800",
        // "editorGutter.deletedBackground": "#ff0000"
    },
    //"workbench.statusBar.feedback.visible": false,
    "workbench.editor.showTabs": true,
    "workbench.colorTheme": "Solarized Light",
    "workbench.tree.indent": 22,

    "git.autofetch": true,
    "git.autofetchPeriod": 300,

    "gitlens.blame.format": "${author|10} ${message|20?} ${agoOrDate|12-}",
    "gitlens.blame.avatars": false,
    "gitlens.codeLens.recentChange.enabled": false,
    "gitlens.codeLens.authors.enabled": false,

    // "breadcrumbs.enabled": true,
    // "breadcrumbs.filePath": "on",

    // Disable all telemetry.
    "gitlens.advanced.telemetry.enabled": false,
    "telemetry.enableCrashReporter": false,
    "telemetry.enableTelemetry": false,
    //"githubPullRequests.telemetry.enabled": false,
}
@evaera
Copy link

evaera commented Jul 24, 2019

Instead of "after": ["cc"], use "after": ["c", "c"]

@pmalek
Copy link
Author

pmalek commented Jul 24, 2019

@evaera Thanks! It worked!

BTW: Where can I find special keys definitions for this plugin to create key mappings? For instance I'm looking into remapping Capslock and I've tried <capslock> and <Capslock> but none of them worked.

@evaera
Copy link

evaera commented Jul 24, 2019

Check out this issue, there are a few solutions on there for that. If you are just binding Capslock to Esc then you should probably look at this comment.

It looks like from what they are saying though that it will still toggle your system's caps lock toggle, so if you don't want that to happen you should probably use a program like AutoHotKey to interrupt it at the system level.

@J-Fields
Copy link
Member

J-Fields commented Aug 5, 2019

Closing as this seems resolved.

@J-Fields J-Fields closed this as completed Aug 5, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants