AstroNvim: An Aesthetic & Feature-rich Neovim Config

AstroNvim

AstroNvim is an aesthetic and feature-rich neovim config that is extensible and easy to use with a great set of plugins

🌟 Preview

Dashboard Preview Image Coding Preview Image Debugging Preview Image

✨ Features

⚑ Requirements

  • Nerd Fonts (Optional with manual intervention: See Documentation on customizing icons)
  • Neovim 0.8+ (Not including nightly)
  • Tree-sitter CLI (Note: This is only necessary if you want to use auto_install feature with Treesitter)
  • A clipboard tool is necessary for the integration with the system clipboard (see :help clipboard-tool for supported solutions)
  • Terminal with true color support (for the default theme, otherwise it is dependent on the theme you are using)
  • Optional Requirements:
    • ripgrep - live grep telescope search (<leader>fw)
    • lazygit - git ui toggle terminal (<leader>tl or <leader>gg)
    • go DiskUsage() - disk usage toggle terminal (<leader>tu)
    • bottom - process viewer toggle terminal (<leader>tt)
    • Python - python repl toggle terminal (<leader>tp)
    • Node - node repl toggle terminal (<leader>tn)

Note when using default theme: For MacOS, the default terminal does not have true color support. You will need to use iTerm2 or another terminal emulator that has true color support.

πŸ› οΈ Installation

Make a backup of your current nvim and shared folder

mv ~/.config/nvim ~/.config/nvim.bak
mv ~/.local/share/nvim ~/.local/share/nvim.bak

Clone the repository

git clone --depth 1 https://github.com/AstroNvim/AstroNvim ~/.config/nvim
nvim

πŸ“¦ Basic Setup

Install LSP

Enter :LspInstall followed by the name of the server you want to install
Example: :LspInstall pyright

Install language parser

Enter :TSInstall followed by the name of the language you want to install
Example: :TSInstall python

Install Debugger

Enter :DapInstall followed by the name of the debugger you want to install
Example: :DapInstall python

Manage plugins

Run :Lazy check to check for plugin updates

Run :Lazy update to apply any pending plugin updates

Run :Lazy clean to remove any disabled or unused plugins

Run :Lazy sync to update and clean plugins

Update AstroNvim

Run :AstroUpdate to get the latest updates from the repository
 

Update AstroNvim Packages

Run :AstroUpdatePackages (<leader>pa) to update both Neovim plugins and Mason packages

πŸ—’οΈ Links

AstroNvim Documentation Core AstroNvim LUA API Documentation

πŸ“Ή Videos

There have been some great review videos released by members of the community! Here are a few:

πŸš€ Contributing

If you plan to contribute, please check the contribution guidelines first.

⭐ Credits

Sincere appreciation to the following repositories, plugin authors and the entire neovim community out there that made the development of AstroNvim possible.


Download Details:

Author: AstroNvim
Source Code: https://github.com/AstroNvim/AstroNvim 
License: GPL-3.0 license

#vim #lua #neovim #ide #neovim #configuring 

AstroNvim: An Aesthetic & Feature-rich Neovim Config
Lawrence  Lesch

Lawrence Lesch

1678560240

Codeium.vim: Free, ultrafast Copilot alternative for Vim & Neovim

Codeium


codeium.vim

Free, ultrafast Copilot alternative for Vim and Neovim

Codeium autocompletes your code with AI in all major IDEs. We launched this implementation of the Codeium plugin for Vim and Neovim to bring this modern coding superpower to more developers. Check out our playground if you want to quickly try out Codeium online.

Contributions are welcome! Feel free to submit pull requests and issues related to the plugin.

Example

πŸš€ Getting started

Install Vim (at least 9.0.0185) or Neovim (at least 0.6)

Install Exafunction/codeium.vim using your vim plugin manager of choice, or manually. See Installation Options below.

Run :Codeium Auth to set up the plugin and start using Codeium.

You can run :help codeium for a full list of commands and configuration options, or see this guide for a quick tutorial on how to use Codeium.

πŸ› οΈ Configuration

For a full list of configuration options you can run :help codeium. A few of the most popular options are highlighted below.

⌨️ Keybindings

Codeium provides the following functions to control suggestions:

ActionFunctionDefault Binding
Clear current suggestioncodeium#Clear()<C-]>
Next suggestioncodeium#CycleCompletions(1)<M-]>
Previous suggestioncodeium#CycleCompletions(-1)<M-[>
Insert suggestioncodeium#Accept()<Tab>
Manually trigger suggestioncodeium#Complete()<M-Bslash>

Codeium's default keybindings can be disabled by setting

let g:codeium_disable_bindings = 1

or in Neovim:

vim.g.codeium_disable_bindings = 1

If you'd like to just disable the <Tab> binding, you can alternatively use the g:codeium_no_map_tab option.

If you'd like to bind the actions above to different keys, this might look something like the following in Vim:

imap <script><silent><nowait><expr> <C-g> codeium#Accept()
imap <C-;>   <Cmd>call codeium#CycleCompletions(1)<CR>
imap <C-,>   <Cmd>call codeium#CycleCompletions(-1)<CR>
imap <C-x>   <Cmd>call codeium#Clear()<CR>

Or in Neovim (using wbthomason/packer.nvim or folke/lazy.nvim):

-- Remove the `use` here if you're using folke/lazy.nvim.
use {
  'Exafunction/codeium.vim',
  config = function ()
    -- Change '<C-g>' here to any keycode you like.
    vim.keymap.set('i', '<C-g>', function () return vim.fn['codeium#Accept']() end, { expr = true })
    vim.keymap.set('i', '<c-;>', function() return vim.fn['codeium#CycleCompletions'](1) end, { expr = true })
    vim.keymap.set('i', '<c-,>', function() return vim.fn['codeium#CycleCompletions'](-1) end, { expr = true })
    vim.keymap.set('i', '<c-x>', function() return vim.fn['codeium#Clear']() end, { expr = true })
  end
}

(Make sure that you ran :Codeium Auth after installation.)

β›” Disabling Codeium

Codeium can be disabled for particular filetypes by setting the g:codeium_filetypes variable in your vim config file (vimrc/init.vim):

let g:codeium_filetypes = {
    \ "bash": v:false,
    \ "typescript": v:true,
    \ }

Codeium is enabled by default for most filetypes.

You can also disable codeium by default with the g:codeium_enabled variable:

let g:codeium_enabled = v:false

Instead, if you would like to just disable the automatic triggering of completions:

let g:codeium_manual = v:true

Show Codeium status in statusline

Codeium status can be generated by calling codeium#GetStatusString() function. It produce 3 char long string with status:

  • '3/8' - third suggestion out of 8
  • '0' - Codeium returned no suggestions
  • '*' - waiting for Codeium response

In normal mode, status shows if Codeium is enabled or disabled by showing 'ON' or 'OFF'.

In order to show it in status line add following line to your .vimrc:

set statusline+=\{…\}%3{codeium#GetStatusString()}

Shorter variant without Codeium logo:

set statusline+=%3{codeium#GetStatusString()}

Please check :help statusline for further information about building statusline in VIM.

For vim-airline extension you can use following config:

let g:airline_section_y = '{…}%3{codeium#GetStatusString()}'

πŸ’Ύ Installation Options

πŸ”Œ vim-plug

Plug 'Exafunction/codeium.vim'

πŸ“¦ Vundle

Plugin 'Exafunction/codeium.vim'

πŸ“¦ packer.nvim:

use 'Exafunction/codeium.vim'

πŸ’ͺ Manual

πŸ–₯️ Vim

Run the following. On windows, you can replace ~/.vim with $HOME/vimfiles:

git clone https://github.com/Exafunction/codeium.vim ~/.vim/pack/Exafunction/start/codeium.vim

πŸ’» Neovim

Run the following. On windows, you can replace ~/.config with $HOME/AppData/Local:

git clone https://github.com/Exafunction/codeium.vim ~/.config/nvim/pack/Exafunction/start/codeium.vim

Download Details:

Author: Exafunction
Source Code: https://github.com/Exafunction/codeium.vim 
License: MIT license

#typescript #javascript #ruby #python #vim #go #editor #rust 

Codeium.vim: Free, ultrafast Copilot alternative for Vim & Neovim
Lawrence  Lesch

Lawrence Lesch

1678220820

A Lightweight & Opinionated Neovim Config for Web Development

πŸ’« CosmicNvim

CosmicNvim is a lightweight and opinionated Neovim config for web development, specifically designed to provide a πŸ’« COSMIC programming experience!

Screen Shot 2021-12-19 at 1 25 24 PM

πŸš€ Stellar Features

Native LSP

Full featured native LSP functionality!

  • πŸ“˜ Go-to definition
  • πŸ” Find references/type def/declaration
  • πŸ’‘ Code actions
  • 🚨 Statusline diagnostics
  • πŸ”§ Formatting/linting thanks to null-ls

Additional features

While CosmicNvim is geared specifically toward TypeScript/JavaScript development, it should be able to provide a great experience with any LSP supported language.

πŸ›  Installation

Quick guide

Prerequisites

Install

  # move to config dir
  cd ~/.config
  # back up current config
  cp -r nvim nvim.backup
  # clone repository
  git clone git@github.com:CosmicNvim/CosmicNvim.git nvim
  # open nvim and install plugins
  nvim

By default, this will assume the Cosmic git directory is placed at vim.fn.stdpath('config'), i.e. ~/.config/nvim. If you are symlinking your pulled repo to ~/.config/nvim, you must define the shell environment variable COSMICNVIM_INSTALL_DIR that points to your installation.

Additional CosmicNvim installation details.

Additional LSP server installation details.

CosmicNvim uninstallation details.

🎨 Theming

New documentation coming soon!

βš™οΈ Configuration

General Info

Cosmic configurations

Add additional vim options

✨ Cosmic Commands

Update CosmicNvim

Updates CosmicNvim to the latest version

:CosmicUpdate

πŸ—Ί Default Mappings

File navigation

File explorer

Terminal

LSP

Other

πŸ“· Screenshots

See more


Download Details:

Author: CosmicNvim
Source Code: https://github.com/CosmicNvim/CosmicNvim 
License: GPL-3.0 license

#typescript #javascript #react #vim #dotfiles 

A Lightweight & Opinionated Neovim Config for Web Development
Lawrence  Lesch

Lawrence Lesch

1677712080

Coc-tsserver: Tsserver Language Server Extension for Coc.nvim

coc-tsserver

Tsserver language server extension for coc.nvim.

Tsserver is part of TypeScript which provide rich language features for javascript and typescript.

This extension is a fork of typescript-language-features extension which is bundled with VSCode. File type detect and syntax highlight are not supported by this extension, use other vim plugin instead.

Important note: from v2.0.0, tsserver module resolved first from global configuration tsserver.tsdk and use bundled module when not found, if tsserver.useLocalTsdk is enabled, workspace folder configured tsserver.tsdk or typescript module inside current workspace folder would be used when exists.

Install

In your vim/neovim, run command:

:CocInstall coc-tsserver

For yarn2 ( >= v2.0.0-rc.36) user want to use local typescript module:

Run command yarn dlx @yarnpkg/sdks vim, which will generate .vim/coc-settings.json, with content:

{
  "eslint.packageManager": "yarn",
  "eslint.nodePath": ".yarn/sdks",
  "workspace.workspaceFolderCheckCwd": false,
  "tsserver.tsdk": ".yarn/sdks/typescript/lib"
}

Features

Almost the same as VSCode.

  • Supports javascript & typescript and jsx/tsx.
  • Installs typings automatically.
  • Commands to work with tsserver, including:
    • tsserver.reloadProjects
    • tsserver.openTsServerLog
    • tsserver.goToProjectConfig
    • tsserver.restart
    • tsserver.watchBuild
    • tsserver.findAllFileReferences
  • Code completion support.
  • Go to definition (more info in microsoft/TypeScript#37777)
  • Code validation.
  • Document highlight.
  • Document symbols of current buffer.
  • Folding and folding range of current buffer.
  • Format current buffer, range format and format on type.
  • Hover for documentation.
  • Implementations codeLens and references codeLens.
  • Organize imports command.
  • Quickfix using code actions.
  • Code refactor using code actions.
  • Source code action, including:
    • Fix all fixable JS/TS issues.
    • Remove all unused code.
    • Add all missing imports.
    • Organize Imports.
    • Sort Imports.
    • Remove Unused Imports
  • Find references.
  • Signature help.
  • Call hierarchy.
  • Selection range.
  • Semantic tokens.
  • Rename symbols support.
  • Automatic tag closing.
  • Rename imports on file rename, require watchman installed in your $PATH.
  • Search for workspace symbols.
  • Inlay hints support using virtual text feature of neovim, which requires:
    • TypeScript >= 4.4.0
    • Neovim >= 0.4.0
    • Enabled by options starts with typescript.inlayHints or javascript.inlayHints.

Tsserver module first resolved from your local workspace. If it's not found, use tsserver from tsserver.tsdk configuration or use bundled tsserver with this extension.

Commands

Commands contributed to :CocList commands

  • tsserver.reloadProjects Reload current project
  • tsserver.openTsServerLog Open log file of tsserver.
  • tsserver.goToProjectConfig Open project config file.
  • tsserver.restart Restart tsserver
  • tsserver.findAllFileReferences Find File References
  • tsserver.goToSourceDefinition Go to Source Definition
  • tsserver.watchBuild Run tsc --watch for current project by use vim's job feature.
  • tsserver.executeAutofix Fix autofixable problems of current document.
  • tsserver.chooseVersion Choose different typescript version for current project.

Configuration options

Checkout :h coc-configuration for guide of coc.nvim's configuration.

  • tsserver.enable: Enable running of tsserver. Default: true
  • tsserver.tsconfigPath: Path to tsconfig file for the tsserver.watchBuild command. Default: "tsconfig.json"
  • tsserver.locale: Sets the locale used to report JavaScript and TypeScript errors. Defaults to use VS Code's locale. Default: "auto" Valid options: ["auto","de","es","en","fr","it","ja","ko","ru","zh-CN","zh-TW"]
  • tsserver.useLocalTsdk: Use tsserver from typescript module in workspace folder, ignore tsserver.tsdk configuration. Default: false
  • tsserver.maxTsServerMemory: Set the maximum amount of memory to allocate to the TypeScript server process Default: 3072
  • tsserver.watchOptions: Configure which watching strategies should be used to keep track of files and directories. Requires using TypeScript 3.8+ in the workspace.
  • tsserver.tsdk: Specifies the folder path to the tsserver and lib*.d.ts files under a TypeScript install to use for IntelliSense, for example: ./node_modules/typescript/lib. - When specified as a user setting, the TypeScript version from tsserver.tsdk automatically replaces the built-in TypeScript version. - When specified as a workspace setting, the tsserver is used when tsserver.useLocalTsdk is true. Use command :CocCommand tsserver.chooseVersion to choose different typescript version. Default: ""
  • tsserver.npm: Specifies the path to the npm executable used for Automatic Type Acquisition. Default: ""
  • tsserver.log: Log level of tsserver Default: "off" Valid options: ["normal","terse","verbose","off"]
  • tsserver.trace.server: Trace level of tsserver Default: "off" Valid options: ["off","messages","verbose"]
  • tsserver.enableTracing: Enables tracing TS server performance to a directory. These trace files can be used to diagnose TS Server performance issues. The log may contain file paths, source code, and other potentially sensitive information from your project. Default: false
  • tsserver.pluginPaths: Additional paths to discover TypeScript Language Service plugins. Default: []
  • tsserver.reportStyleChecksAsWarnings: Report style checks as warnings. Default: true
  • tsserver.implicitProjectConfig.checkJs: Enable checkJs for implicit project Default: false
  • tsserver.implicitProjectConfig.module: Sets the module system for the program. See more: https://www.typescriptlang.org/tsconfig#module. Default: "ESNext" Valid options: ["CommonJS","AMD","System","UMD","ES6","ES2015","ES2020","ESNext","None","ES2022","Node12","NodeNext"]
  • tsserver.implicitProjectConfig.target: Set target JavaScript language version for emitted JavaScript and include library declarations. See more: https://www.typescriptlang.org/tsconfig#target. Default: "ES2020" Valid options: ["ES3","ES5","ES6","ES2015","ES2016","ES2017","ES2018","ES2019","ES2020","ES2021","ES2022","ESNext"]
  • tsserver.implicitProjectConfig.strictNullChecks: Enable/disable strict null checks in JavaScript and TypeScript files that are not part of a project. Existing jsconfig.json or tsconfig.json files override this setting. Default: true
  • tsserver.implicitProjectConfig.strictFunctionTypes: Enable/disable strict function types in JavaScript and TypeScript files that are not part of a project. Existing jsconfig.json or tsconfig.json files override this setting. Default: true
  • tsserver.implicitProjectConfig.experimentalDecorators: Enable experimentalDecorators for implicit project Default: false
  • tsserver.disableAutomaticTypeAcquisition: Disables automatic type acquisition. Automatic type acquisition fetches @types packages from npm to improve IntelliSense for external libraries. Default: false
  • tsserver.useSyntaxServer: Controls if TypeScript launches a dedicated server to more quickly handle syntax related operations, such as computing code folding. Default: "auto" Valid options: ["always","never","auto"]
  • tsserver.experimental.enableProjectDiagnostics: (Experimental) Enables project wide error reporting. Default: false
  • typescript.check.npmIsInstalled: Check if npm is installed for Automatic Type Acquisition. Default: true
  • typescript.showUnused: Show unused variable hint. Default: true
  • typescript.showDeprecated: Show deprecated variable hint. Default: true
  • typescript.updateImportsOnFileMove.enabled: Enable/disable automatic updating of import paths when you rename or move a file in VS Code. Default: "prompt" Valid options: ["prompt","always","never"]
  • typescript.implementationsCodeLens.enabled: Enable codeLens for implementations Default: false
  • typescript.referencesCodeLens.enabled: Enable codeLens for references Default: false
  • typescript.referencesCodeLens.showOnAllFunctions: Enable/disable references CodeLens on all functions in typescript files. Default: false
  • typescript.preferences.importModuleSpecifier: Preferred path style for auto imports. Default: "shortest" Valid options: ["shortest","relative","non-relative","project-relative"]
  • typescript.preferences.importModuleSpecifierEnding: Preferred path ending for auto imports. Default: "auto" Valid options: ["auto","minimal","index","js"]
  • typescript.preferences.jsxAttributeCompletionStyle: Preferred style for JSX attribute completions. Default: "auto" Valid options: ["auto","braces","none"]
  • typescript.preferences.includePackageJsonAutoImports: Enable/disable searching package.json dependencies for available auto imports. Default: "auto" Valid options: ["auto","on","off"]
  • typescript.preferences.quoteStyle: Preferred quote style to use for quick fixes. Default: "auto" Valid options: ["auto","single","double"]
  • typescript.preferences.useAliasesForRenames: Enable/disable introducing aliases for object shorthand properties during renames. Requires using TypeScript 3.4 or newer in the workspace. Default: true
  • typescript.preferences.autoImportFileExcludePatterns: Specify glob patterns of files to exclude from auto imports. Requires using TypeScript 4.8 or newer in the workspace.
  • typescript.preferences.renameShorthandProperties: Enable/disable introducing aliases for object shorthand properties during renames. Requires using TypeScript 3.4 or newer in the workspace. Default: true
  • typescript.suggestionActions.enabled: Enable/disable suggestion diagnostics for TypeScript files in the editor. Requires using TypeScript 2.8 or newer in the workspace. Default: true
  • typescript.validate.enable: Enable/disable TypeScript validation. Default: true
  • typescript.suggest.enabled: Enabled/disable autocomplete suggestions. Default: true
  • typescript.suggest.paths: Enable/disable suggest paths in import statement and require calls Default: true
  • typescript.suggest.autoImports: Enable/disable auto import suggests. Default: true
  • typescript.suggest.completeFunctionCalls: Enable snippet for method suggestion Default: true
  • typescript.suggest.includeCompletionsForImportStatements: Enable/disable auto-import-style completions on partially-typed import statements. Requires using TypeScript 4.3+ in the workspace. Default: true
  • typescript.suggest.includeCompletionsWithSnippetText: Enable/disable snippet completions from TS Server. Requires using TypeScript 4.3+ in the workspace. Default: true
  • typescript.suggest.classMemberSnippets.enabled: Enable/disable snippet completions for class members. Requires using TypeScript 4.5+ in the workspace Default: true
  • typescript.suggest.jsdoc.generateReturns: Enable/disable generating @return annotations for JSDoc templates. Requires using TypeScript 4.2+ in the workspace. Default: true
  • typescript.format.enable: Enable format for typescript. Default: true
  • typescript.format.insertSpaceAfterCommaDelimiter: Defines space handling after a comma delimiter. Default: true
  • typescript.format.insertSpaceAfterConstructor: Defines space handling after the constructor keyword. Default: false
  • typescript.format.insertSpaceAfterSemicolonInForStatements: Defines space handling after a semicolon in a for statement. Default: true
  • typescript.format.insertSpaceBeforeAndAfterBinaryOperators: Defines space handling after a binary operator. Default: true
  • typescript.format.insertSpaceAfterKeywordsInControlFlowStatements: Defines space handling after keywords in a control flow statement. Default: true
  • typescript.format.insertSpaceAfterFunctionKeywordForAnonymousFunctions: Defines space handling after function keyword for anonymous functions. Default: true
  • typescript.format.insertSpaceBeforeFunctionParenthesis: Defines space handling before function argument parentheses. Default: false
  • typescript.format.insertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis: Defines space handling after opening and before closing non-empty parenthesis. Default: false
  • typescript.format.insertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets: Defines space handling after opening and before closing non-empty brackets. Default: false
  • typescript.format.insertSpaceAfterOpeningAndBeforeClosingEmptyBraces: Defines space handling after opening and before closing empty braces. Default: false
  • typescript.format.insertSpaceAfterOpeningAndBeforeClosingNonemptyBraces: Defines space handling after opening and before closing non-empty braces. Default: false
  • typescript.format.insertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces: Defines space handling after opening and before closing template string braces. Default: false
  • typescript.format.insertSpaceAfterOpeningAndBeforeClosingJsxExpressionBraces: Defines space handling after opening and before closing JSX expression braces. Default: false
  • typescript.format.insertSpaceAfterTypeAssertion: Defines space handling after type assertions in TypeScript. Default: false
  • typescript.format.placeOpenBraceOnNewLineForFunctions: Defines whether an open brace is put onto a new line for functions or not. Default: false
  • typescript.format.placeOpenBraceOnNewLineForControlBlocks: Defines whether an open brace is put onto a new line for control blocks or not. Default: false
  • typescript.format.semicolons: Defines handling of optional semicolons. Requires using TypeScript 3.7 or newer in the workspace. Default: "ignore" Valid options: ["ignore","insert","remove"]
  • typescript.suggest.includeAutomaticOptionalChainCompletions: Enable/disable showing completions on potentially undefined values that insert an optional chain call. Requires TS 3.7+ and strict null checks to be enabled. Default: true
  • typescript.workspaceSymbols.scope: Controls which files are searched by go to symbol in workspace. Default: "allOpenProjects" Valid options: ["allOpenProjects","currentProject"]
  • typescript.autoClosingTags: Enable/disable automatic closing of JSX tags. Default: true
  • javascript.showUnused: Show unused variable hint. Default: true
  • javascript.showDeprecated: Show deprecated variable hint. Default: true
  • javascript.updateImportsOnFileMove.enabled: Enable/disable automatic updating of import paths when you rename or move a file in VS Code. Default: "prompt" Valid options: ["prompt","always","never"]
  • javascript.implementationsCodeLens.enabled: Enable/disable implementations CodeLens. This CodeLens shows the implementers of an interface. Default: false
  • javascript.referencesCodeLens.enabled: Enable/disable references CodeLens in JavaScript files. Default: false
  • javascript.referencesCodeLens.showOnAllFunctions: Enable/disable references CodeLens on all functions in JavaScript files. Default: false
  • javascript.preferences.importModuleSpecifier: Preferred path style for auto imports. Default: "shortest" Valid options: ["shortest","relative","non-relative","project-relative"]
  • javascript.preferences.importModuleSpecifierEnding: Preferred path ending for auto imports. Default: "auto" Valid options: ["auto","minimal","index","js"]
  • javascript.preferences.jsxAttributeCompletionStyle: Preferred style for JSX attribute completions. Default: "auto" Valid options: ["auto","braces","none"]
  • javascript.preferences.quoteStyle: Preferred quote style to use for quick fixes. Default: "auto" Valid options: ["auto","single","double"]
  • javascript.preferences.useAliasesForRenames: Enable/disable introducing aliases for object shorthand properties during renames. Requires using TypeScript 3.4 or newer in the workspace. Default: true
  • javascript.preferences.autoImportFileExcludePatterns: Specify glob patterns of files to exclude from auto imports. Requires using TypeScript 4.8 or newer in the workspace.
  • javascript.preferences.renameShorthandProperties: Enable/disable introducing aliases for object shorthand properties during renames. Requires using TypeScript 3.4 or newer in the workspace. Default: true
  • javascript.validate.enable: Enable/disable JavaScript validation. Default: true
  • javascript.suggestionActions.enabled: Enable/disable suggestion diagnostics for JavaScript files in the editor. Requires using TypeScript 2.8 or newer in the workspace. Default: true
  • javascript.suggest.names: Enable/disable including unique names from the file in JavaScript suggestions. Note that name suggestions are always disabled in JavaScript code that is semantically checked using @ts-check or checkJs. Default: true
  • javascript.suggest.enabled: Enabled/disable autocomplete suggestions. Default: true
  • javascript.suggest.paths: Enable/disable suggest paths in import statement and require calls Default: true
  • javascript.suggest.autoImports: Enable/disable auto import suggests. Default: true
  • javascript.suggest.completeFunctionCalls: Enable snippet for method suggestion Default: true
  • javascript.suggest.includeCompletionsForImportStatements: Enable/disable auto-import-style completions on partially-typed import statements. Requires using TypeScript 4.3+ in the workspace. Default: true
  • javascript.suggest.classMemberSnippets.enabled: Enable/disable snippet completions for class members. Requires using TypeScript 4.5+ in the workspace Default: true
  • javascript.suggest.jsdoc.generateReturns: Enable/disable generating @return annotations for JSDoc templates. Requires using TypeScript 4.2+ in the workspace. Default: true
  • javascript.format.enable: Enable format for javascript. Default: true
  • javascript.format.insertSpaceAfterCommaDelimiter: Default: true
  • javascript.format.insertSpaceAfterConstructor: Default: false
  • javascript.format.insertSpaceAfterSemicolonInForStatements: Default: true
  • javascript.format.insertSpaceBeforeAndAfterBinaryOperators: Default: true
  • javascript.format.insertSpaceAfterKeywordsInControlFlowStatements: Default: true
  • javascript.format.insertSpaceAfterFunctionKeywordForAnonymousFunctions: Default: true
  • javascript.format.insertSpaceBeforeFunctionParenthesis: Default: false
  • javascript.format.insertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis: Default: false
  • javascript.format.insertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets: Default: false
  • javascript.format.insertSpaceAfterOpeningAndBeforeClosingEmptyBraces: Default: false
  • javascript.format.insertSpaceAfterOpeningAndBeforeClosingNonemptyBraces: Default: false
  • javascript.format.insertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces: Default: false
  • javascript.format.insertSpaceAfterOpeningAndBeforeClosingJsxExpressionBraces: Default: false
  • javascript.format.insertSpaceAfterTypeAssertion: Default: false
  • javascript.format.placeOpenBraceOnNewLineForFunctions: Default: false
  • javascript.format.placeOpenBraceOnNewLineForControlBlocks: Default: false
  • javascript.suggest.includeAutomaticOptionalChainCompletions: Enable/disable showing completions on potentially undefined values that insert an optional chain call. Requires TS 3.7+ and strict null checks to be enabled. Default: true
  • typescript.inlayHints.parameterNames.enabled: Enable/disable inlay hints of parameter names. Default: "none" Valid options: ["none","literals","all"]
  • typescript.inlayHints.parameterNames.suppressWhenArgumentMatchesName: Suppress parameter name hints on arguments whose text is identical to the parameter name. Default: true
  • typescript.inlayHints.parameterTypes.enabled: Enable/disable inlay hints of parameter types. Default: false
  • typescript.inlayHints.variableTypes.enabled: Enable/disable inlay hints of variable types. Default: false
  • typescript.inlayHints.propertyDeclarationTypes.enabled: Enable/disable inlay hints of property declarations. Default: false
  • typescript.inlayHints.functionLikeReturnTypes.enabled: Enable/disable inlay hints of return type for function signatures. Default: false
  • typescript.inlayHints.enumMemberValues.enabled: Enable/disable inlay hints of enum member values. Default: false
  • typescript.inlayHints.variableTypes.suppressWhenTypeMatchesName: Suppress type hints on variables whose name is identical to the type name. Requires using TypeScript 4.8+ in the workspace. Default: true
  • javascript.inlayHints.parameterNames.enabled: Enable/disable inlay hints of parameter names. Default: "none" Valid options: ["none","literals","all"]
  • javascript.inlayHints.parameterNames.suppressWhenArgumentMatchesName: Suppress parameter name hints on arguments whose text is identical to the parameter name. Default: true
  • javascript.inlayHints.parameterTypes.enabled: Enable/disable inlay hints of parameter types. Default: false
  • javascript.inlayHints.variableTypes.enabled: Enable/disable inlay hints of variable types. Default: false
  • javascript.inlayHints.propertyDeclarationTypes.enabled: Enable/disable inlay hints of property declarations. Default: false
  • javascript.inlayHints.functionLikeReturnTypes.enabled: Enable/disable inlay hints of return type for function signatures. Default: false
  • javascript.inlayHints.enumMemberValues.enabled: Enable/disable inlay hints of enum member values. Default: false
  • javascript.inlayHints.variableTypes.suppressWhenTypeMatchesName: Suppress type hints on variables whose name is identical to the type name. Requires using TypeScript 4.8+ in the workspace. Default: true
  • javascript.autoClosingTags: Enable/disable automatic closing of JSX tags. Default: true
  • javascript.format.semicolons: Defines handling of optional semicolons. Requires using TypeScript 3.7 or newer in the workspace. Default: "ignore" Valid options: ["ignore","insert","remove"]
  • javascript.suggest.completeJSDocs: Enable/disable suggestion to complete JSDoc comments. Default: true
  • typescript.suggest.completeJSDocs: Enable/disable suggestion to complete JSDoc comments. Default: true
  • javascript.suggest.objectLiteralMethodSnippets.enabled: Enable/disable snippet completions for methods in object literals. Requires using TypeScript 4.7+ in the workspace Default: true
  • typescript.suggest.objectLiteralMethodSnippets.enabled: Enable/disable snippet completions for methods in object literals. Requires using TypeScript 4.7+ in the workspace Default: true

Most Configurations are the same as with VSCode. Install coc-json and try completion with tsserver, typescript or javascript in your coc-settings.json.

Differences between VSCode

Added configurations by coc-tsserver:

  • tsserver.useLocalTsdk only works when used as workspace folder configuration.
  • tsserver.tsconfigPath
  • tsserver.enable

Removed configurations:

  • typescript.tsserver.useSeparateSyntaxServer Use tsserver.useSyntaxServer instead.
  • typescript.enablePromptUseWorkspaceTsdk No propmpts given.
  • typescript.tsc.autoDetect Used for task, no such feature.
  • typescript.surveys.enabled No such feature.

Renamed configurations to use tsserver as prefix:

  • typescript.tsdk => tsserver.tsdk
  • typescript.disableAutomaticTypeAcquisition => tsserver.disableAutomaticTypeAcquisition
  • typescript.npm => tsserver.npm
  • typescript.locale => tsserver.locale
  • typescript.tsserver.maxTsServerMemory => tsserver.maxTsServerMemory
  • typescript.tsserver.watchOptions => tsserver.watchOptions
  • typescript.tsserver.useSyntaxServer => tsserver.useSyntaxServer
  • typescript.tsserver.log => tsserver.log
  • typescript.tsserver.trace => tsserver.trace.server
  • typescript.tsserver.enableTracing => tsserver.enableTracing
  • typescript.tsserver.pluginPaths => tsserver.pluginPaths
  • typescript.reportStyleChecksAsWarnings => tsserver.reportStyleChecksAsWarnings
  • js/ts.implicitProjectConfig.checkJs => tsserver.implicitProjectConfig.checkJs
  • js/ts.implicitProjectConfig.experimentalDecorators => tsserver.implicitProjectConfig.experimentalDecorators
  • js/ts.implicitProjectConfig.module => tsserver.implicitProjectConfig.module
  • js/ts.implicitProjectConfig.target => tsserver.implicitProjectConfig.target
  • js/ts.implicitProjectConfig.strictNullChecks => tsserver.implicitProjectConfig.strictNullChecks
  • js/ts.implicitProjectConfig.strictFunctionTypes => tsserver.implicitProjectConfig.strictFunctionTypes
  • typescript.tsserver.experimental.enableProjectDiagnostics => tsserver.experimental.enableProjectDiagnostics

Related extensions

Troubleshooting

  • Add "tsserver.log": "verbose" to your coc-settings.json (opened by command :CocConfig)
  • To trace LSP communication, add "tsserver.trace.server": "verbose" to your coc-settings.json
  • Restart coc server by command :CocRestart
  • Make the issue happen.
  • Open tsserver log file by command CocCommand tsserver.openTsServerLog
  • Open tsserver output channel by command CocCommand workspace.showOutput tsserver

If you find any issues, please create an issue.

Q & A

Q: Automatic type acquisition not work.

A: configure tsserver.npm to your global npm path or configure "tsserver.disableAutomaticTypeAcquisition": false to disable automatic typings installation.

Q: The extension needs some time to work.

A: The initialize of tsserver requires some time, you can add g:coc_status to your status line, see :h coc-status. If your tsserver get slow, try exclude unnecessary files in your jsconfig.json/tsconfig.json, make sure typescript version > 4.9 and disable logging (disabled by default).

Q: Update import on file rename not work.

A: Make sure install watchman in your $PATH. Use command :CocCommand workspace.showOutput watchman to check watchman output.

Q: Not work with buffer just created.

A: Tsserver treat buffer without a disk file belongs to implicit project, VSCode could work because VSCode create empty file first for buffer, save the buffer to disk to make tsserver work.

Q: Not work with my javascript project.

A: Configure jsconfig.json to make tsserver understand your code. Some features may still not work well, it's recommended to use typescript.

Q: Not work on WSL.

A: Copy you project files from mounted dirs to linux home otherwise tsserver may not work properly.


Download Details:

Author: Neoclide
Source Code: https://github.com/neoclide/coc-tsserver 
License: MIT

#typescript #vim #neovim 

Coc-tsserver: Tsserver Language Server Extension for Coc.nvim
Monty  Boehm

Monty Boehm

1677566280

Learn-Vim: Learning Vim and Vimscript Doesn't Have to Be Hard

Learn Vim (the Smart Way)

What's This?

Learn Vim (the Smart Way) is a guide to learn the good parts of Vim.

There are many places to learn Vim: the vimtutor is a great place to start and the help manual has all the references you will ever need. However, the average user needs something more than vimtutor and less than the help manual. This guide attempts to bridge that gap by highlighting only the key features to learn the most useful parts of Vim in the least time possible.

This guide is written for both beginner and advanced Vimmers. It starts out with broad and simple concepts and ends with specific and advanced concepts. If you're an advanced user already, I would encourage you to read this guide from start to finish anyway, because you will learn something new!

I Want More Vim Tips!

Follow @learnvim for updates, Vim tips, etc.

Support This Project

This guide is and will always be free.

If you want to financially support this project, you can purchase this guide on Leanpub.

Table Of Contents

Prologue

Part 1: Learn Vim the Smart Way

Part 2: Customize Vim the Smart Way

Part 3: Learn Vimscript the Smart Way

Translations


Download Details:

Author: iggredible
Source Code: https://github.com/iggredible/Learn-Vim 
License: View license

#vim #editor #linux #learning 

Learn-Vim: Learning Vim and Vimscript Doesn't Have to Be Hard
Monty  Boehm

Monty Boehm

1676368391

How to Find and Replace in Vim / Vi

How to Find and Replace in Vim / Vi

This article describes how to find and replace text in Vim / Vi.

Vim is the most popular command-line text editor. It comes preinstalled on macOS and most Linux distributions. Finding and replacing text in Vim is quick and easy.

Basic Find and Replace

In Vim, you can find and replace text using the :substitute (:s) command.

To run commands in Vim, you must be in normal mode, the default mode when starting the editor. To go back to normal mode from any other mode, just press the β€˜Esc’ key.

The general form of the substitute command is as follows:

:[range]s/{pattern}/{string}/[flags] [count]

The command searches each line in [range] for a {pattern}, and replaces it with a {string}. [count] is a positive integer that multiplies the command.

If no [range] and [count] are given, only the pattern found in the current line is replaced. The current line is the line where the cursor is placed.

For example, to search for the first occurrence of the string β€˜foo’ in the current line and replace it with β€˜bar’, you would use:

:s/foo/bar/

To replace all occurrences of the search pattern in the current line, add the g flag:

:s/foo/bar/g

If you want to search and replace the pattern in the entire file, use the percentage character % as a range. This character indicates a range from the first to the last line of the file:

:%s/foo/bar/g

If the {string} part is omitted, it is considered as an empty string, and the matched pattern is deleted. The following command deletes all instances of the string β€˜foo’ in the current line:

:s/foo//g

Instead of the slash character (/), you can use any other non-alphanumeric single-byte character except as a delimiter. This option is useful when you have the β€˜/’ character in the search pattern or the replacement string.

:s|foo|bar|

To confirm each substitution, use the c flag:

:s/foo/bar/gc
replace with bar (y/n/a/q/l/^E/^Y)?

Press y to replace the match or l to replace the match and quit. Press n to skip the match and q or Esc to quit substitution. The a option substitutes the match and all remaining occurrences of the match. To scroll the screen down, use CTRL+Y, and to scroll up, use CTRL+E.

You can also use regular expressions as a search pattern. The command bellow replaces all lines starting with β€˜foo’ with β€˜Vim is the best’:

:%s/^foo.*/Vim is the best/gc

The ^ (caret) symbol matches the beginning of a line and .* matches any number of any characters.

 

Case Sensitivity

 

By default, the search operation is case sensitive; searching for β€œFOO” will not match β€œFoo”.

 

To ignore case for the search pattern, use the i flag:

:s/Foo/bar/gi

Another way to force ignore case is to append \c after the search pattern. For example, /Linux\c performs ignore case search.

If you changed the default case setting and you want to perform case sensitive search, use the I flag:

:s/foo/bar/gi

Uppercase \C after the pattern also forces case match search.

Search Range

When no range is specified the substitute command operates only in the current line.

The range can be either one line or a range between two lines. The line specifiers are separated with the , or ; characters. The range can be specified using the absolute line number or special symbols.

For example, to substitute all occurrences of β€˜foo’ to β€˜bar’ in all lines starting from line 3 to line 10 you would use:

:3,10s/foo/bar/g

The range is inclusive, which means that the first and last lines are included in the range.

The dot . character indicates the current line and $ - the dollar sign the last line. To substitute β€˜foo’ in all lines starting from the current line to the last one:

:.,$s/foo/bar/

The line specifier can also be set using the β€˜+’ or β€˜-’ symbol,followed by a number that is added or subtracted from the preceding line number. If the number after the symbol is omitted, it defaults to 1.

For example to substitute each β€˜foo’ with β€˜bar’ starting from the current line and the four next lines, type:

:.,+4s/foo/bar/g

Substituting Whole Word

The substitute command looks for the pattern as a string, not a whole word. If, for example, you were searching for β€œgnu”, the search find matches where β€œgnu” is embedded in larger words, such as β€œcygnus” or β€œmagnum”.

To search for a whole word, type \< to mark the beginning of a word, enter the search pattern, type \> to mark the end of a word:

For example, to search for the word β€œfoo” you would use \<foo\>:

 

:s/\<foo\>/bar/

Substitute History

Vim keeps track of all the commands you run in the current session. To browse the history for previous substitute commands, enter :s and use the arrow up/down keys to find a previous substitute operation. To run the command, simply press Enter. You can also edit the command before performing the operation.

Examples

Comment lines (add # before the line) from 5 to 20:

:5,20s/^/#/

Uncomment lines from 5 to 20, revert the previous changes:

:5,20s/^#//

Replace all instances of β€˜apple’, β€˜orange’, and β€˜mango’ with β€˜fruit’:

:%s/apple\|orange\|mango/fruit/g

Remove trailing whitespace at the end of each line:

:%s/\s\+$//e

Conclusion

Searching and replacing is a powerful feature of Vim, which allows you to make changes to your text quickly.

Feel free to leave a comment if you have any questions.
 

Original article source at: https://linuxize.com/

#vim #replace #find 

How to Find and Replace in Vim / Vi
Lawrence  Lesch

Lawrence Lesch

1675874286

TSuquyomi: A Vim plugin for TypeScript

Tsuquyomi

Make your Vim a TypeScript IDE.

Features

Tsuquyomi works as a client for TSServer (which is an editor service bundled into TypeScript). So, installing Tsuquyomi, your vim gets the following features provided by TSServer:

  • Completion (omni-completion)
  • Navigate to the location where a symbol is defined.
  • Show location(s) where a symbol is referenced.
  • Display a list of syntax and semantics errors to Vim quickfix window.
  • and so on,,,
capture

Relevant plugins

Tsuquyomi does not provide syntax-highlight nor indentation. You can use the following Vim plugins for writing .ts:

How to install

Tsuquyomi requires the following:

Install TypeScript

npm -g install typescript

Install Tsuquyomi

Download zip.file from here, or use your favorite Vim plugin manager.

Pathogen

See https://github.com/tpope/vim-pathogen for instructions to install pathogen itself (very simple one-line install, one-line config)

# create bundle folder if it doesn't exist
mkdir -p ~/.vim/bundle

# Install and compile procvim.vim
git clone https://github.com/Shougo/vimproc.vim.git ~/.vim/bundle/vimproc.vim
pushd ~/.vim/bundle/vimproc.vim
make
popd

# Install tsuquyomi
git clone https://github.com/Quramy/tsuquyomi.git ~/.vim/bundle/tsuquyomi

NeoBundle

If you use NeoBundle for Vim plugin management, append the following to your .vimrc:

NeoBundle 'Shougo/vimproc.vim', {
\ 'build' : {
\     'windows' : 'tools\\update-dll-mingw',
\     'cygwin' : 'make -f make_cygwin.mak',
\     'mac' : 'make -f make_mac.mak',
\     'linux' : 'make',
\     'unix' : 'gmake',
\    },
\ }

NeoBundle 'Quramy/tsuquyomi'

And exec :NeoBundleInstall.

(About vimproc installation, please see the original install guide.)

How to use

Completion

Tsuquyomi supports Omni-Completion.

By the default, type <C-x> <C-o> in insert mode, Tsuquyomi shows completions.

Customize completion

You can configure completion with the completeopt option.

If you don't want the popup menu:

autocmd FileType typescript setlocal completeopt-=menu

If you want to show a method's signature in the popup menu, set g:tsuquyomi_completion_detail. Remarks: This option makes completion slow

let g:tsuquyomi_completion_detail = 1

If you want to show a method's signature in the preview window when you complete this method's arguments (default):

(The preview window isn't shown when completion properties or variables)

autocmd FileType typescript setlocal completeopt+=menu,preview

Navigations

Definition

Type <C-]> in normal mode or visual mode, Tsuquyomi navigates to the location where the symbol under the cursor is defined.

Alternatively, call the Ex command :TsuquyomiDefinition or :TsuDefinition. (All Tsuquyomi's commands have aliases with short prefix 'Tsu'.)

And type <C-t> , Tsuquyomi moves the cursor to the location where the last <C-]> was typed.

Type Definition

:TsuTypeDefinition command is similar to :TsuDefinition. :TsuTypeDefinition navigates to the location where the type of the symbol under the cursor is defined.

References

Type <C-^> in normal mode or visual mode, Tsuquyomi shows a list of location where the symbol under the cursor is referenced.

Alternatively, call the Ex command :TsuReferences.

If you want where an interface is implemented, use :TsuImplementation.

Keyword search

Call the Ex command :TsuSearch {keyword} to get the list of locations which contain the keyword. This command searches the keyword from opened or referenced files in your project.

The search term minimum length can be configured with let g:tsuquyomi_search_term_min_length = 3.

Disable default mappings

If you do not want to use the above key mappings please add let g:tsuquyomi_disable_default_mappings = 1 to your .vimrc file.

Show compile errors

When a buffer is saved, Tsuquyomi checks syntax and semantics. Alternatively call the Ex command :TsuGeterr. And if it contains errors, Tsuquyomi shows them to Vim quickfix window.

If your use TypeScript v1.6.0 or later, you can use :TsuGeterrProject command. This command shows all compilation errors contained in your project to quickfix window.

Quick fix

If the cursor is on an error and TypeScript's LanguageService has a code fix for this error, call :TsuQuickFix. The code fix will be applied.

Configure compile options

Make tsconfig.json.

For example:

{
  "compilerOptions": {
    "noImplicitAny": true,
    "target": "es5",
    "module": "commonjs"
  }
}

When you change tsconfig.json after opening *.ts files, you should exec :TsuquyomiReloadProject command. So, the changes of tsconfig.json are reflected in the TSServer.

Integrate with syntastic

If you use syntastic, you can use syntastic for displaying syntax and semantics errors instead of vim's default quickfix window. To integrate syntastic, write the following setting to your .vimrc.

let g:tsuquyomi_disable_quickfix = 1
let g:syntastic_typescript_checkers = ['tsuquyomi'] " You shouldn't use 'tsc' checker.

syntastic has default TypeScript checker whose name is 'tsc'. You shouldn't use it with running Tusuquyomi because they don't share compile options. Tusuquyomi's checker whose name is 'tsuquyomi' uses tsserver and your tsconfig.json.

Refactor

Rename symbols

Using the command :TsuRenameSymbol, you can rename the identifier under the cursor to a new name.

If you want to rename identifiers including in comments, you can use :TsuRenameSymbolC command. For example, this command is useful when you want rename opt in the following code:

/**
*
* @param opt
*
**/
var someFunc = (opt: any) => {...};

This feature does not have the default key mapping. If you need, configure your .vimrc . For example:

autocmd FileType typescript nmap <buffer> <Leader>e <Plug>(TsuquyomiRenameSymbol)
autocmd FileType typescript nmap <buffer> <Leader>E <Plug>(TsuquyomiRenameSymbolC)

Tooltip

Tsuquyomi can display tooltip window about symbol under the mouse cursor. If you want to use this feature, configure .vimrc as follows:

set ballooneval
autocmd FileType typescript setlocal balloonexpr=tsuquyomi#balloonexpr()

The ballonexpr option is not available in terminal Vim. So, Tsuquyomi also provides a tooltip function tsuquyomi#hint().

For example:

autocmd FileType typescript nmap <buffer> <Leader>t : <C-u>echo tsuquyomi#hint()<CR>

The above example works in terminal Vim.

Unite sources

Tsuquyomi provides some unite sources.

Show project information(a source of unite)

Execute the following command, your project information is displayed.

:Unite tsproject

The project information contains:

  • tsconfig.json which the current buffer use.
  • .ts(or .tsx) source files which TypeScript compiles. These files are determined by tsconfig.json

This feature requires TypeScript@1.6.0 or later.

Show outline(an extension of unite-outline)

This feature requires Vim plugins:

If you have installed these plugins, calling the following Ex command, the outline of the current buffer is displayed.

:Unite outline

Use TypeScript installed locally

By the default, Tsuquyomi searches locally installed TypeScript. If not hit, Tsuquyomi uses TypeScript installed globally.

And execute the following command, you can confirm the path of tsserver:

:echo tsuquyomi#config#tsscmd()

Create es6 import declaration

It's highly experimental

For example, if your buffer is the following state:

readFile('hoge', 'utf-8', (err, content) => {
  if(!err) console.log(content);
});

Move cursor onto readFile and call :TsuImport, so Tsuquyomi appends the import declaration.

import { readFile } from 'fs';
readFile('hoge', 'utf-8', (err, content) => {
  if(!err) console.log(content);
});

To allow Tsuquyomi to import the shortest path instead of the complete one (where the initial module declaration is) one, put this in your .vimrc:

let g:tsuquyomi_shortest_import_path = 1

For example, if your project has the following 2 files, the plugin will use: import { foo } from './lib'; instead of: import { foo } from './lib/foo';.

/* lib/index.ts */
export * from './foo';
/* lib/foo.ts */
export const foo = 'FOO'

More details

If you want more details, please see doc.

Contribute

How to test

Prepare test

cd test/
yarn install
cd ..

Run test cases

# Run all test cases with all supported TypeScript version
./runtest-all-ts.sh

# Run all test cases with the latest TypeScript version
./runtest.sh

# Run all test cases with the specified TypeScript version
VERSION=2.3 ./runtest.sh

# Run a test file
./run-one-test.sh test/path/to/test.spec.vim

# Run a test file with the specified TypeScript version
VERSION=2.3 ./run-one-test.sh

Download Details:

Author: Quramy
Source Code: https://github.com/Quramy/tsuquyomi 
License: MIT

#typescript #vim #plugins 

TSuquyomi: A Vim plugin for TypeScript
Lawrence  Lesch

Lawrence Lesch

1675426637

Open Source Productivity tool Drawing inspiration From Workflowy & Vim

Vimflowy

An open source productivity tool drawing inspiration from workflowy and vim 

NOTE: I don't have time to maintain this anymore, sorry!

This is a productivity tool which draws some inspiration from workflowy and vim.

FEATURES

  • Workflowy features
    • tree-like outlining
    • collapsing and zooming into bullets
    • basic text formatting, strike through task completion
  • Vim features
    • (configurable) vim keybindings
    • modal editing
    • undo history, location history, macros, etc.
  • Plugins system (see plugins.md)
    • marks (not like vim's)
    • easy-motion for moving between bullets quickly
    • time tracking
    • LaTeX and HTML rendering
  • Other
    • data import from or export as text file (native Vimflowy format or Workflowy-compatible format)
    • loads data lazily (good for huge documents)
    • search (not like vim's)
    • cloning (bullets duplicated in multiple locations in a document)
    • customizable visual themes

LIMITATIONS

  • No collaborative editing
  • Global search is slow for large documents (so you'll want to use marks)
  • You may need a relatively modern browser (minimally HTML5 LocalStorage and Flexbox). I test only in recent versions of Chrome and Firefox.

DATA STORAGE

Vimflowy was designed to work with multiple storage backends.

By default, you own your own data, as it is stored locally on your computer. However, you can let Google host it for you, or host it yourself.

See here for more info.

SELF-HOSTING

See the deployment documentation for details. You can deploy with docker, or build from source yourself.

NOTES FOR DEVELOPERS

Contributions are very welcome! See dev_setup.md to see how to get started with a development setup.

FAQ (AKA questions I imagine people would ask me)

see here

Try it out now!

Deploy yourself with docker!

Download Details:

Author: WuTheFWasThat
Source Code: https://github.com/WuTheFWasThat/vimflowy 
License: MIT license

#typescript #vim #productivity 

Open Source Productivity tool Drawing inspiration From Workflowy & Vim
Rupert  Beatty

Rupert Beatty

1675075462

Swift.vim: Vim Runtime Files for Swift

Swift.vim

Syntax and indent files for Swift

If you don't have a preferred installation method check out vim-plug.

Examples

Syntastic Integration

swift.vim can show errors inline from swift package manager or from swiftlint using syntastic.

Usage

Install syntastic

swiftpm integration will be automatically enabled if you're running vim from a directory containing a Package.swift file.

SwiftLint integration will be automatically enabled if you have SwiftLint installed and if you're running vim from a directory containing a .swiftlint.yml file.

To enable both at once add this to your vimrc:

let g:syntastic_swift_checkers = ['swiftpm', 'swiftlint']

Download Details:

Author: Keith
Source Code: https://github.com/keith/swift.vim 
License: MIT license

#swift #vim 

Swift.vim: Vim Runtime Files for Swift
Lawrence  Lesch

Lawrence Lesch

1674119060

Typescript-vim: Typescript Syntax Files for Vim

Typescript Syntax for Vim

Syntax file and other settings for TypeScript. The syntax file is taken from this blog post.

Checkout Tsuquyomi for omni-completion and other features for TypeScript editing.

Install

From Vim 8 onward, the plugin can be installed as simply as (Unix/Mac):

git clone https://github.com/leafgarland/typescript-vim.git ~/.vim/pack/typescript/start/typescript-vim

On Windows/Powershell, use the following:

git clone https://github.com/leafgarland/typescript-vim.git $home/vimfiles/pack/typescript/start/typescript-vim

For older versions of Vim, the simplest way to install is via a Vim add-in manager such as Plug, Vundle or Pathogen.

See the Installation Wiki

Pathogen

git clone https://github.com/leafgarland/typescript-vim.git ~/.vim/bundle/typescript-vim

If you want to install manually then you need to copy the files from this repository into your vim path, see the vim docs for :help runtimepath for more information. This might be as simple as copying the files and directories to ~/.vim/ but it depends on your Vim install and operating system.

Usage

Once the files are installed the syntax highlighting and other settings will be automatically enabled anytime you edit a .ts file.

Indenting

This plugin includes a custom indenter (based on pangloss/vim-javascript's indenter), it works pretty well but there are cases where it fails. If these bother you or want to use other indent settings you can disable it by setting a flag in your .vimrc:

let g:typescript_indent_disable = 1

If you want the indenter to automatically indent chained method calls as you type.

something
    .foo()
    .bar();

Then add something like setlocal indentkeys+=0. to your .vimrc, see :help 'indentkeys' in vim for more information.

If you use the = operator to re-indent code it will always indent chained method calls - this can be disabled by changing the regex the indent script uses to identify indented lines. In this case removing '.' from the regex means that it wont indent lines starting with '.'. Note, this is not ideal as the regex may change making your setting out of date.

let g:typescript_opfirst='\%([<>=,?^%|*/&]\|\([-:+]\)\1\@!\|!=\|in\%(stanceof\)\=\>\)'

Compiler settings

This plugin contains compiler settings to set makeprg and errorformat. The compiler settings enable you to call the tsc compiler directly from Vim and display any errors or warnings in Vim's QuickFix window.

To run the compiler, enter :make, this will run tsc against the last saved version of your currently edited file.

The default for makeprg is tsc $* %. You can enter other compiler options into your :make command line and they will be inserted in place of $*.

There are options to change the compiler name and to insert default options.

let g:typescript_compiler_binary = 'tsc'
let g:typescript_compiler_options = ''

These options will be passed to the binary as command arguments. For example, if g:typescript_compiler_binary = 'tsc' and g:typescript_compiler_options = '--lib es6', l:makeprg will be: tsc --lib es6 $* %.

You can completely override this plugin's compiler settings with something like this in your .vimrc, where you can set makeprg to whatever you want.

  autocmd FileType typescript :set makeprg=tsc

Note, this plugin's compiler settings are not used by Syntastic which has its own way of changing the options. See https://github.com/scrooloose/syntastic#faqargs.

You can use something like this in your .vimrc to make the QuickFix window automatically appear if :make has any errors.

autocmd QuickFixCmdPost [^l]* nested cwindow
autocmd QuickFixCmdPost    l* nested lwindow

Syntax highlighting

Syntax highlighting for TypeScript can be customized by following variables.

  • g:typescript_ignore_typescriptdoc: When this variable is defined, doccomments will not be highlighted.
  • g:typescript_ignore_browserwords: When this variable is set to 1, browser API names such as window or document will not be highlighted. (default to 0)

Obligatory screenshot

Download Details:

Author: leafgarland
Source Code: https://github.com/leafgarland/typescript-vim 

#typescript #vim 

Typescript-vim: Typescript Syntax Files for Vim
Nigel  Uys

Nigel Uys

1673921040

Helix: A Post-modern Modal Text Editor

Helix 

A Kakoune / Neovim inspired editor, written in Rust.

The editing model is very heavily based on Kakoune; during development I found myself agreeing with most of Kakoune's design decisions.

Screenshot

Features

  • Vim-like modal editing
  • Multiple selections
  • Built-in language server support
  • Smart, incremental syntax highlighting and code editing via tree-sitter

It's a terminal-based editor first, but I'd like to explore a custom renderer (similar to Emacs) in wgpu or skulpin.

Note: Only certain languages have indentation definitions at the moment. Check runtime/queries/<lang>/ for indents.scm.

Installation

Packages are available for various distributions (see Installation docs).

If you would like to build from source:

git clone https://github.com/helix-editor/helix
cd helix
cargo install --locked --path helix-term

This will install the hx binary to $HOME/.cargo/bin and build tree-sitter grammars in ./runtime/grammars.

Helix needs its runtime files so make sure to copy/symlink the runtime/ directory into the config directory (for example ~/.config/helix/runtime on Linux/macOS, or %AppData%/helix/runtime on Windows).

OSCommand
Windows (Cmd)xcopy /e /i runtime %AppData%\helix\runtime
Windows (PowerShell)xcopy /e /i runtime $Env:AppData\helix\runtime
Linux / macOSln -s $PWD/runtime ~/.config/helix/runtime

Starting with Windows Vista you can also create symbolic links on Windows. Note that this requires elevated privileges - i.e. PowerShell or Cmd must be run as administrator.

PowerShell:

New-Item -ItemType SymbolicLink -Target "runtime" -Path "$Env:AppData\helix\runtime"

Cmd:

cd %appdata%\helix
mklink /D runtime "<helix-repo>\runtime"

The runtime location can be overridden via the HELIX_RUNTIME environment variable.

NOTE: if HELIX_RUNTIME is set prior to calling cargo install --locked --path helix-term, tree-sitter grammars will be built in $HELIX_RUNTIME/grammars.

If you plan on keeping the repo locally, an alternative to copying/symlinking runtime files is to set HELIX_RUNTIME=/path/to/helix/runtime (HELIX_RUNTIME=$PWD/runtime if you're in the helix repo directory).

Packages already solve this for you by wrapping the hx binary with a wrapper that sets the variable to the install dir.

NOTE: running via cargo also doesn't require setting explicit HELIX_RUNTIME path, it will automatically detect the runtime directory in the project root.

If you want to customize your languages.toml config, tree-sitter grammars may be manually fetched and built with hx --grammar fetch and hx --grammar build.

In order to use LSP features like auto-complete, you will need to install the appropriate Language Server for a language.

Packaging status

Adding Helix to your desktop environment

If installing from source, to use Helix in desktop environments that supports XDG desktop menu, including Gnome and KDE, copy the provided .desktop file to the correct folder:

cp contrib/Helix.desktop ~/.local/share/applications
cp contrib/helix.png ~/.local/share/icons

To use another terminal than the default, you will need to modify the .desktop file. For example, to use kitty:

sed -i "s|Exec=hx %F|Exec=kitty hx %F|g" ~/.local/share/applications/Helix.desktop
sed -i "s|Terminal=true|Terminal=false|g" ~/.local/share/applications/Helix.desktop

macOS

Helix can be installed on macOS through homebrew:

brew install helix

Contributing

Contributing guidelines can be found here.

Getting help

Your question might already be answered on the FAQ.

Discuss the project on the community Matrix Space (make sure to join #helix-editor:matrix.org if you're on a client that doesn't support Matrix Spaces yet).

Credits

Thanks to @JakeHL for designing the logo!

For more information, see the website or documentation.

All shortcuts/keymaps can be found in the documentation on the website.

Troubleshooting

Download Details:

Author: Helix-editor
Source Code: https://github.com/helix-editor/helix 
License: MPL-2.0 license

#rust #vim #editor 

Helix: A Post-modern Modal Text Editor
Nigel  Uys

Nigel Uys

1673456700

A Vim Plugin for Syntax Highlighting ansible's Common Filetypes

Introduction

This is a vim syntax plugin for Ansible 2.x, it supports YAML playbooks, Jinja2 templates, and Ansible's hosts files.

  • YAML playbooks are detected if:
    • they are in the group_vars or host_vars folder
    • they are in the tasks, roles, or handlers folder and have either a .yml or .yaml suffix
    • they are named playbook.y(a)ml, site.y(a)ml, or main.y(a)ml
  • Jinja2 templates are detected if they have a .j2 suffix
  • Files named hosts will be treated as Ansible hosts files

You can also set the filetype to yaml.ansible, *.jinja2, or ansible_hosts if auto-detection does not work (e.g. :set ft=yaml.ansible or :set ft=ruby.jinja2). Note: If you want to detect a custom pattern of your own, you can easily add this in your .vimrc using something like this:

au BufRead,BufNewFile */playbooks/*.yml set filetype=yaml.ansible

If you want to override the default file type detection you can easily do this in your .vimrc. For example if you use YAML syntax for hosts include something like this:

augroup ansible_vim_fthosts
  autocmd!
  autocmd BufNewFile,BufRead hosts setfiletype yaml.ansible
augroup END

This plugin should be quite reliable, as it sources the original formats and simply modifies the highlights as appropriate. This also enables a focus on simplicity and configurability instead of patching bad syntax detection.

examples (with solarized colorscheme)

Bright (and selective highlight)Dim

installation

Use your favorite plugin manager, or try vim-plug if you're looking for a really nice one!

vim-plug: Plug 'pearofducks/ansible-vim'

vim-plug with post-update hook: Plug 'pearofducks/ansible-vim', { 'do': './UltiSnips/generate.sh' }

Note: Because of Ansible API changes, generate.sh may require the latest (or near-latest) version of Ansible.

Note2: generate.sh can receive some parameters, for more info see its Readme

vundle: Plugin 'pearofducks/ansible-vim'

pathogen: git clone https://github.com/pearofducks/ansible-vim ~/.vim/bundle/ansible-vim

Arch Linux: Package vim-ansible is available in the community repository.

Fedora: The vim-ansible package is available in the default repository.

RHEL/CentOS: The vim-ansible package is available in the EPEL repository.

options

g:ansible_unindent_after_newline

let g:ansible_unindent_after_newline = 1

When this variable is set, indentation will completely reset (unindent to column 0) after two newlines in insert-mode. The normal behavior of YAML is to always keep the previous indentation, even across multiple newlines with no content.

g:ansible_yamlKeyName

let g:ansible_yamlKeyName = 'yamlKey'

This option exists to provide additional compatibility with stephpy/vim-yaml.

g:ansible_attribute_highlight

let g:ansible_attribute_highlight = "ob"

Ansible modules use a key=value format for specifying module-attributes in playbooks. This highlights those as specified. This highlight option is also used when highlighting key/value pairs in hosts files.

Available flags (bold are defaults):

  • a: highlight all instances of key=
  • o: highlight only instances of key= found on newlines
  • d: dim the instances of key= found
  • b: brighten the instances of key= found
  • n: turn this highlight off completely

g:ansible_name_highlight

let g:ansible_name_highlight = 'd'

Ansible modules commonly start with a name: key for self-documentation of playbooks. This option enables/changes highlight of this.

Available flags (this feature is off by default):

  • d: dim the instances of name: found
  • b: brighten the instances of name: found

g:ansible_extra_keywords_highlight

let g:ansible_extra_keywords_highlight = 1

Note: This option is enabled when set, and disabled when not set.

Highlight the following additional keywords: become become_exe become_flags become_method become_user become_pass prompt_l10n debugger always_run check_mode diff no_log args tags force_handlers vars vars_files vars_prompt delegate_facts delegate_to any_errors_fatal ignore_errors ignore_unreachable max_fail_percentage connection hosts port remote_user module_defaults environment fact_path gather_facts gather_subset gather_timeout async poll throttle timeout order run_once serial strategy.

By default we only highlight: include include_role include_tasks include_vars import_role import_playbook import_tasks when changed_when failed_when block rescue always notify listen register action local_action post_tasks pre_tasks tasks handlers roles collections and loop keywords with_.+, loop, loop_control, until, retries, delay.

g:ansible_extra_keywords_highlight_group

let g:ansible_extra_keywords_highlight_group = 'Statement'

Accepts any syntax group name from :help E669 - e.g. Comment, Constant, Identifier

Note: Defaults to 'Structure' when not set.

g:ansible_normal_keywords_highlight

let g:ansible_normal_keywords_highlight = 'Constant'

Accepts any syntax group name from :help E669 - e.g. Comment, Constant, Identifier

Note: Defaults to 'Statement' when not set.

This option change the highlight of the following common keywords: include include_role include_tasks include_vars import_role import_playbook import_tasks when changed_when failed_when block rescue always notify listen register action local_action post_tasks pre_tasks tasks handlers roles collections.

g:ansible_loop_keywords_highlight

let g:ansible_loop_keywords_highlight = 'Constant'

Accepts any syntax group-name from :help E669 - e.g. Comment, Constant, Identifier

Note: Defaults to 'Statement' when not set.

This option changes the highlight of all with_.+, loop, loop_control, until, retries and delay keywords.

g:ansible_template_syntaxes

let g:ansible_template_syntaxes = { '*.rb.j2': 'ruby' }

Accepts a dictionary in the form of 'regex-for-file': 'filetype'.

  • regex-for-file will receive the full filepath, so directory matching can be done.
  • filetype is the root filetype to be applied, jinja2 will be automatically appended

All files ending in *.j2 that aren't matched will simply get the jinja2 filetype.

g:ansible_ftdetect_filename_regex

let g:ansible_ftdetect_filename_regex = '\v(playbook|site|main|local|requirements)\.ya?ml$'

Accepts a regex string that is used to match the filename to determine if the file should use the Ansible filetype

Can be used to avoid clashes with other files that are named the same - e.g. main.yaml used in github workflows by removing main from the regex

goto role under cursor (similar to gf)

This behavior is not supported out of the box, but you can use this snippet in your vimrc.

You'll then be able to go to a role's definition with <leader>gr.

bugs, suggestions/requests, & contributions

bugs

It's unlikely that there will be bugs in highlighting that don't exist in the core format. Where appropriate these will be fixed in this plugin, but if the problem is with the original syntax we should probably focus on fixing that instead.

Indenting a full document - e.g with gg=G - will not be supported and is not a goal of this plugin (unless someone else develops it!). Please do not file a bug report on this.

suggestions/requests

Suggestions for improvements are welcome, pull-requests with completed features even more so. :)

Download Details:

Author: Pearofducks
Source Code: https://github.com/pearofducks/ansible-vim 
License: MIT license

#ansible #vim 

A Vim Plugin for Syntax Highlighting ansible's Common Filetypes
Nigel  Uys

Nigel Uys

1673428588

Cheat-sheet-pdf: A Cheat-Sheet Collection From The WWW

Cheat-Sheet Collection for DevOps, Engineers, IT and more

Cheat Sheet

πŸ“œ Rules

  • PDF only :exclamation:
  • Contributors are WELCOME :+1:
  • If you like it - Give me a :star:

πŸ“Œ List of cheat-sheet

Nginx is open source software for web serving, reverse proxying, caching, load balancing, media streaming, and more.

Docker is a tool designed to make it easier to create, deploy, and run applications by using containers.

  1. Docker
  2. Docker by JRebel
  3. Docker Security

Ansible is the simplest way to automate apps and IT infrastructure.

Python is an interpreted, high-level, general-purpose programming language.

  1. Python 3 the basics
  2. Python

Go also known as Golang, is a statically typed, compiled programming language designed at Google.

Git is the open source distributed version control system that facilitates GitHub activities on your laptop or desktop.

  1. Git by Atlassian.
  2. Git by GitHub.
  3. Git by Git-Tower
  4. Git/GitHub - Pull Request

Regular expression also known as Regex is a special text string for describing a search pattern.

  1. Regex
  2. Regex for Python

PowerShell is a task automation and configuration management framework from Microsoft.

VIM aka Vi IMproved is a highly configurable text editor for efficiently creating and changing any kind of text.

Jenkins an open source automation server which enables developers around the world to reliably build, test, and deploy their software.

CI/CD Continuous Integration and Continuous Delivery (CI/CD) have made the practice of software development increasingly complexβ€”and overwhelming.

Kubernetes is an open-source system for automating deployment, scaling, and management of containerized applications.

  1. Kubernetes K8s Cheat-Sheet.
  2. Kubectl is a command line interface for running commands against Kubernetes clusters.

Linux

  1. Bash is a Unix shell and command language written by Brian Fox for the GNU Project as a free software replacement for the Bourne shell.
    1. Linux Commands 1
    2. Linux Commands 2
    3. Linux Commands 3
    4. Linux Network Tools, Every Linux networking tool I know
  2. Network-tools: ping, curl, wget, ssh and more network tools.
    1. Cron is a time-based job scheduler in Unix-like computer operating systems.
    2. Rsync is a fast and extraordinarily versatile file copying tool. It can copy locally, to/from another host over any remote shell, or to/from a remote rsync daemon.
    3. cURL
    4. SSH
    5. NC
    6. Nmap
      1. Nmap Cheat Sheet by comparitech.
    7. OpenSSL
    8. Ethtool
    9. ngrep
    10. grep
    11. xargs
    12. find
    13. awk
    14. sed
    15. tar
    16. ps
    17. top
    18. Wireshark is a free and open-source packet analyzer.

Redis is an in-memory data structure store, used as a database, cache and message broker.

Slack is a messaging tool for making communication fast and easy. It lets you share messages and files with your team, organized by channel.

Puppet lets you automate the enforcement, security, and delivery of your hybrid or cloud-native infrastructure.

Google Cloud Developer builds scalable and highly available applications using Google recommended practices and tools that leverage fully managed services.

AI, Neural Networks, Machine Learning, Deep Learning & Data Science is intelligence demonstrated by machines.

PostgreSQL is a free and open-source relational database management system (RDBMS) emphasizing extensibility and SQL compliance.

Ajax AJAX = Asynchronous JavaScript And XML.

Amazon Web Services (AWS) is a subsidiary of Amazon providing on-demand cloud computing platforms and APIs to individuals, companies, and governments, on a metered pay-as-you-go basis.

  1. AWS: The Basic
  2. AWS Services
  3. AWS Cost Information

Infrastructure as code (IaC), is the process of managing and provisioning computer data centers through machine-readable definition files, rather than physical hardware configuration or interactive configuration tools.

  1. Terraform is an open-source infrastructure as code software tool that provides a consistent CLI workflow to manage hundreds of cloud services.

Download Details:

Author: sk3pp3r
Source Code: https://github.com/sk3pp3r/cheat-sheet-pdf 
License: MIT license

#python #vim #cheatsheet #linux #slack 

Cheat-sheet-pdf: A Cheat-Sheet Collection From The WWW
Hunter  Krajcik

Hunter Krajcik

1673270520

Dotfiles: New Mac Web Dev Setup scripts

New Mac Web Dev Setup scripts

Customizing

I do NOT recommend installing all of my setup without looking through what is happening and customizing it for yourself. Fork this repo and update anything you like.

Look through the shell scripts in setup folder to see what programs are being installed. You can add or remove everything from there. Most likely, if you are not a VIM power user you will want to modify some of the shell and atom plugins/config to suit yours preferences.

Pre-Setup (If you don't have Homebrew and/or Github setup with SSH access)

Install Homebrew and git, and set up SSH for Github

curl --remote-name https://raw.githubusercontent.com/colbycheeze/dotfiles/master/setup/pre-setup.sh
chmod a+x pre-setup.sh
./pre-setup.sh

Manually Install latest (non beta) Xcode from the app store

Setup

git clone git@github.com:colbycheeze/dotfiles.git ~/dotfiles && cd ~/dotfiles/setup && git checkout amazon && chmod a+x applications.sh && chmod a+x finishSetup.sh ./applications.sh

Finishing touches

  1. open tmux and install plugins: CTRL + A, I
  2. open nvim and run :PlugInstall and :UpdateRemotePlugins
  3. Register Divvy and add any hotkeys for window management
  4. Change key repeat rate / delay to fast/short in keyboard preferences
  5. Swap ESC and CAPS key in keyboard preferences (OSX Sierra now supports this)
  6. Connect iterm2 profile to dotfiles: (instructions)

Download Details:

Author: Colbycheeze
Source Code: https://github.com/colbycheeze/dotfiles 
License: View license

#atom #ruby #vim #shell #dotfiles 

Dotfiles: New Mac Web Dev Setup scripts
Yvette  Bell

Yvette Bell

1673055535

Dart Vim Plugin: Syntax Highlighting for Dart in Vim

Dart Support for Vim

dart-vim-plugin provides filetype detection, syntax highlighting, and indentation for Dart code in Vim.

Looking for auto-complete, diagnostics as you type, jump to definition and other intellisense features? Try a vim plugin for the Language Server Protocol such as vim-lsc configured to start the Dart analysis server with the --lsp flag.

Looking for an IDE experience? See the Dart Tools page.

Commands

:DartFmt

Installation

Install as a typical vim plugin using your favorite approach. If you don't have a preference vim-plug is a good place to start. Below are examples for common choices, be sure to read the docs for each option.

vim-plug

call plug#begin()
"... <snip other plugins>
Plug 'dart-lang/dart-vim-plugin'

call plug#end()

Then invoke :PlugInstall to install the plugin.

pathogen

Clone the repository into your pathogen directory.

mkdir -p ~/.vim/bundle && cd ~/.vim/bundle && \
git clone https://github.com/dart-lang/dart-vim-plugin

Ensure your .vimrc contains the line execute pathogen#infect()

vundle

set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
"... <snip other plugins>
Plugin 'dart-lang/dart-vim-plugin'

call vundle#end()

Configuration

Enable HTML syntax highlighting inside Dart strings with let dart_html_in_string=v:true (default false).

Highlighting for specific syntax groups can be disabled by defining custom highlight group links. See :help dart-syntax

Enable Dart style guide syntax (like 2-space indentation) with let g:dart_style_guide = 2

Enable DartFmt execution on buffer save with let g:dart_format_on_save = 1

Configure DartFmt options with let g:dartfmt_options (discover formatter options with dartfmt -h)

FAQ

Why doesn't the plugin indent identically to dart format?

The indentation capabilities within vim are limited and it's not easy to fully express the indentation behavior of dart format. The major area where this plugin differs from dart format is indentation of function arguments when using a trailing comma in the argument list. When using a trailing comma (as is common in flutter widget code) dart format uses 2 space indent for argument parameters. In all other indentation following an open parenthesis (argument lists without a trailing comma, multi-line assert statements, etc) dart format uses 4 space indent. This plugin uses 4 space indent indent by default. To use 2 space indent by default, let g:dart_trailing_comma_indent = v:true.

How do I configure an LSP plugin to start the analysis server?

The Dart SDK comes with an analysis server that can be run in LSP mode. The server ships with the SDK. Assuming the bin directory of the SDK is at $DART_SDK the full command to run the analysis server in LSP mode is $DART_SDK/dart $DART_SDK/snapshots/analysis_server.dart.snapshot --lsp. If you'll be opening files outside of the rootUri sent by your LSP client (usually cwd) you may want to pass onlyAnalyzeProjectsWithOpenFiles: true in the initializationOptions. See the documentation for your LSP client for how to configure initialization options. If you are using the vim-lsc plugin there is an additional plugin which can configure everything for you at vim-lsc-dart. A minimal config for a good default experience using vim-plug would look like:

call plug#begin()
Plug 'dart-lang/dart-vim-plugin'
Plug 'natebosch/vim-lsc'
Plug 'natebosch/vim-lsc-dart'
call plug#end()

let g:lsc_auto_map = v:true

Download details:

Author: dart-lang
Source code: https://github.com/dart-lang/dart-vim-plugin

License: BSD-3-Clause license

#dart #vim 

Dart Vim Plugin: Syntax Highlighting for Dart in Vim