All Projects → bluk → swifty-vim

bluk / swifty-vim

Licence: Apache-2.0 license
⌨️ A Vim plugin for Swift which provides file detection, syntax highlighting, support for compiling and running tests, and optional support for formatting and linting tools.

Programming Languages

Vim Script
2826 projects

Projects that are alternatives of or similar to swifty-vim

Vim Todo Lists
Vim plugin for TODO lists
Stars: ✭ 126 (+600%)
Mutual labels:  vim-plugin, vim-plugins
Vim Dadbod Completion
Database autocompletion powered by https://github.com/tpope/vim-dadbod
Stars: ✭ 163 (+805.56%)
Mutual labels:  vim-plugin, vim-plugins
Ale
Check syntax in Vim asynchronously and fix files, with Language Server Protocol (LSP) support
Stars: ✭ 11,380 (+63122.22%)
Mutual labels:  vim-plugin, vim-plugins
Vim Systemd Syntax
Syntax highlighting for systemd service files in Vim.
Stars: ✭ 57 (+216.67%)
Mutual labels:  vim-plugin, vim-plugins
Vifm.vim
Vim plugin that allows use of vifm as a file picker
Stars: ✭ 197 (+994.44%)
Mutual labels:  vim-plugin, vim-plugins
Fzf Filemru
File MRU with fzf.vim
Stars: ✭ 76 (+322.22%)
Mutual labels:  vim-plugin, vim-plugins
Targets.vim
Vim plugin that provides additional text objects
Stars: ✭ 2,114 (+11644.44%)
Mutual labels:  vim-plugin, vim-plugins
Context.vim
Vim plugin that shows the context of the currently visible buffer contents
Stars: ✭ 688 (+3722.22%)
Mutual labels:  vim-plugin, vim-plugins
vim-phpstan
A Vim plugin for PHPStan - https://github.com/phpstan/phpstan. It calls `phpstan` to do static analysis of your PHP code and displays the errors in Vim's quickfix list.
Stars: ✭ 26 (+44.44%)
Mutual labels:  vim-plugin, vim-plugins
Visual Split.vim
Vim plugin to control splits with visual selections or text objects
Stars: ✭ 190 (+955.56%)
Mutual labels:  vim-plugin, vim-plugins
Vim Strand
A barebones Vim plugin manger written in Rust
Stars: ✭ 38 (+111.11%)
Mutual labels:  vim-plugin, vim-plugins
vim-sass-colors
sass/scss/less/css color literal and color variable highlighting (works with imports)
Stars: ✭ 24 (+33.33%)
Mutual labels:  vim-plugin, vim-plugins
Hot Reload.vim
A (Neo)vim plugin for Flutter to automatically hot reload the project every time a file is saved
Stars: ✭ 33 (+83.33%)
Mutual labels:  vim-plugin, vim-plugins
Vimpanel
A modern side panel for Vim
Stars: ✭ 97 (+438.89%)
Mutual labels:  vim-plugin, vim-plugins
Vimcompletesme
You don't Complete Me; Vim Completes Me! A super simple, super minimal, super light-weight tab completion plugin for Vim.
Stars: ✭ 752 (+4077.78%)
Mutual labels:  vim-plugin, vim-plugins
Vimux
easily interact with tmux from vim
Stars: ✭ 1,980 (+10900%)
Mutual labels:  vim-plugin, vim-plugins
Tmux Complete.vim
Vim plugin for insert mode completion of words in adjacent tmux panes
Stars: ✭ 447 (+2383.33%)
Mutual labels:  vim-plugin, vim-plugins
Alchemist.vim
Elixir Integration Into Vim
Stars: ✭ 632 (+3411.11%)
Mutual labels:  vim-plugin, vim-plugins
Exit Vim
Vim plugin that exits Vim on startup
Stars: ✭ 176 (+877.78%)
Mutual labels:  vim-plugin, vim-plugins
Nerdtree
A tree explorer plugin for vim.
Stars: ✭ 16,380 (+90900%)
Mutual labels:  vim-plugin, vim-plugins

⌨️ swifty-vim

A Vim plugin for Swift which provides file detection, syntax highlighting, support for compiling and running tests, and optional support for formatting and linting tools.

It is inspired by vim-go and rust.vim.

Requirements

Installation

Use one of the following package managers:

  • Vim 8 packages:
    • git clone https://github.com/bluk/swifty-vim ~/.vim/pack/plugins/start/swifty-vim
  • Pathogen:
    • git clone --depth=1 https://github.com/bluk/swifty-vim.git ~/.vim/bundle/swifty-vim
  • vim-plug:
    • Add Plug 'bluk/swifty-vim' to ~/.vimrc
    • :PlugInstall or $ vim +PlugInstall +qall
  • dein.vim:
    • Add call dein#add('bluk/swifty-vim') to ~/.vimrc
    • :call dein#install()
  • Vundle:
    • Add Plugin 'bluk/swifty-vim' to ~/.vimrc
    • :PluginInstall or $ vim +PluginInstall +qall

Features

There are configuration options to customize the behavior of the key mappings and commands.

Swift Package Manager Support

Key mappings and commands such as:

  • :SwiftPMBuild to build the current package source or tests.
  • :SwiftPMTest to run the package tests.
  • :SwiftPMTestFunctionOnly to run the current test under the cursor.
  • :SwiftPMTestGenerateLinuxMain to generate the code to run existing tests on Linux.
  • :SwiftPMGenerateXcodeProject to generate an Xcode project.

SwiftFormat Support

Key mapping and command:

  • :SwiftFormat to format the current file.

SwiftLint Support

Key mapping and command:

  • :SwiftLint to lint the current file.

Sample vimrc Configuration

Add the following to your vimrc:

" Build the current Swift package. If in a 'Tests' directory, also build the tests.
autocmd FileType swift nmap <leader>b <Plug>(swift-spm-build)
" Run the current Swift package tests.
autocmd FileType swift nmap <leader>t <Plug>(swift-spm-test)
" Run the test under the current cursor.
autocmd FileType swift nmap <leader>ft <Plug>(swift-spm-test-function-only)
" Run swift package generate-xcodeproj
autocmd FileType swift nmap <leader>sgx <Plug>(swift-spm-generate-xcodeproj)
" Run swift test --generate-linuxmain
autocmd FileType swift nmap <leader>sgl <Plug>(swift-spm-test-generate-linuxmain)

" Run SwiftFormat on save.
let g:swift_swiftformat_autosave = 1
" Run SwiftLint on save.
let g:swift_swiftlint_autosave = 1
" If there are errors during autosave, add all errors in the quickfix window.
let g:swift_list_type_commands = { 'Autosave': 'quickfix' }

Documentation / Help

Help can be found in the included documentation.

Run :help swifty-vim in Vim. Helptags (:Helptags) may need to be generated for navigation. See your plugin manager or the helptags documentation (:help helptags) for more information.

Related Links

You may be interested in other similar projects:

License

Apache-2.0 License

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].