{"id":31923335,"url":"https://github.com/fuellabs/sway.vim","last_synced_at":"2025-10-13T23:49:33.268Z","repository":{"id":103103248,"uuid":"427145249","full_name":"FuelLabs/sway.vim","owner":"FuelLabs","description":"Vim syntax file for Sway.","archived":false,"fork":false,"pushed_at":"2024-02-29T20:59:07.000Z","size":18,"stargazers_count":20,"open_issues_count":4,"forks_count":12,"subscribers_count":22,"default_branch":"master","last_synced_at":"2025-05-21T18:34:22.817Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Vim Script","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/FuelLabs.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-11-11T21:15:22.000Z","updated_at":"2025-01-19T16:23:37.000Z","dependencies_parsed_at":null,"dependency_job_id":"6045ccd4-4aac-4a89-9e3e-6fdd7e072724","html_url":"https://github.com/FuelLabs/sway.vim","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/FuelLabs/sway.vim","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FuelLabs%2Fsway.vim","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FuelLabs%2Fsway.vim/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FuelLabs%2Fsway.vim/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FuelLabs%2Fsway.vim/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/FuelLabs","download_url":"https://codeload.github.com/FuelLabs/sway.vim/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FuelLabs%2Fsway.vim/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279017229,"owners_count":26086016,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-13T02:00:06.723Z","response_time":61,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-10-13T23:49:31.365Z","updated_at":"2025-10-13T23:49:33.260Z","avatar_url":"https://github.com/FuelLabs.png","language":"Vim Script","funding_links":[],"categories":[],"sub_categories":[],"readme":"## About\n\nVim syntax file for Sway\n\n## Installation\n\nPre-requisites:\n1. Clone this repo\n1. Ensure you have the `forc-lsp` binary with `which forc-lsp`. If not, install [the Sway toolchain](https://fuellabs.github.io/sway/v0.25.2/introduction/installation.html).\n\n### Neovim\n\n1. Copy the folders 'ftdetect' and 'syntax' to the config folder: \n```\ncp -R ~/sway.vim/syntax ~/.config/nvim \u0026\u0026 cp -R ~/sway.vim/ftdetect ~/.config/nvim\n```\n2. If you do not have `~/.config/nvim/init.lua`, install [kickstart.nvim](https://github.com/nvim-lua/kickstart.nvim).\n3. If you already have `init.lua`, you may need to require extra dependencies, or simply copy [this block](https://github.com/nvim-lua/kickstart.nvim/blob/38828dcaf7c140902fedeaa75b017bf968400bb0/init.lua#L401-L604).\n4. Add the following to `~/.config/nvim/init.lua`:\n```\n-- Install Sway LSP as a custom\tserver\nlocal lspconfig = require 'lspconfig'\nlocal configs = require 'lspconfig.configs'\n\n-- Check if the config is already defined (useful when reloading this file)\nif not configs.sway_lsp then\n   configs.sway_lsp = {\n     default_config = {\n       cmd = {'forc-lsp'},\n       filetypes = {'sway'},\n       on_attach = on_attach,\n       init_options = { \n         -- Any initialization options\n         logging = { level = 'trace' }\n       },\n       root_dir = function(fname)\n         return lspconfig.util.find_git_ancestor(fname)\n       end;\n       settings = {};\n     };\n   }\n end\n\nlspconfig.sway_lsp.setup{}\n```\n4. Check that the LSP is running by running `:LspInfo` and trying out features like Goto Definition (`gd`) and Hover (`K`). The key mappings are defined in `~/.config/nvim/init.lua`\n\n![Nov-10-2022 20-18-51](https://user-images.githubusercontent.com/47993817/201267485-dcff3e58-1b13-4215-9c77-c262f8bebdc5.gif)\n\n### Vim\n\n1. Clone this repo\n2. Copy the folders 'ftdetect' and 'syntax' to the config folder: \n```\ncp -R ~/sway.vim/syntax ~/.vim \u0026\u0026 cp -R ~/sway.vim/ftdetect ~/.vim\n```\n3. Edit your `~/.vim/filetype.vim` to contain the following block:\n```\nif exists(\"did_load_filetypes\")\n  finish\nendif\n\naugroup filetypedetect\n  au! BufNewFile,BufRead *.[sS][wW] setf sway\naugroup END\n```\n4. Install [plug.vim](https://github.com/junegunn/vim-plug)\n5. Add the following to your `~/.vimrc`\n```\ncall plug#begin()\n\nPlug 'prabirshrestha/vim-lsp'\n\ncall plug#end()\n```\n6. Create a file called `~/.vim/lsp.vim` with the following contents, or add this to an existing vim script:\n```\n\" vim-lsp for Sway (sway-lsp)\nif executable('sway-lsp')\n    au User lsp_setup call lsp#register_server({\n        \\ 'name': 'sway-lsp',\n        \\ 'cmd': {server_info-\u003e['sway-lsp']},\n        \\ 'whitelist': ['sway'],\n        \\ })\nendif\n```\n7. Open vim and `:source ~/.vim/lsp.vim`\n8. Check that the LSP is running with `:LspStatus` and try out feature like `:LspDefinition` and `:LspHover`. The full list of commands are defined [here](https://github.com/prabirshrestha/vim-lsp).\n\n![Nov-10-2022 21-05-18](https://user-images.githubusercontent.com/47993817/201267452-4b51a037-6b49-464c-92c4-c0df50c15fd4.gif)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffuellabs%2Fsway.vim","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffuellabs%2Fsway.vim","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffuellabs%2Fsway.vim/lists"}