diff --git a/.envrc b/.envrc new file mode 100644 index 0000000..3550a30 --- /dev/null +++ b/.envrc @@ -0,0 +1 @@ +use flake diff --git a/.github/DISCUSSION_TEMPLATE/q-a.yaml b/.github/DISCUSSION_TEMPLATE/q-a.yaml new file mode 100644 index 0000000..fe312fc --- /dev/null +++ b/.github/DISCUSSION_TEMPLATE/q-a.yaml @@ -0,0 +1,17 @@ +title: 'Q&A' +labels: [] +body: + - type: markdown + attributes: + value: | + Use this space for questions, ideas, and general discussion about nonicons.nvim. + For bug reports, please [open an issue](https://github.com/barrettruth/nonicons.nvim/issues/new/choose) instead. + - type: textarea + attributes: + label: Question or topic + validations: + required: true + - type: textarea + attributes: + label: Context + description: Any relevant details (Neovim version, config, screenshots) diff --git a/.github/ISSUE_TEMPLATE/bug_report.yaml b/.github/ISSUE_TEMPLATE/bug_report.yaml new file mode 100644 index 0000000..b1e0d58 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.yaml @@ -0,0 +1,78 @@ +name: Bug Report +description: Report a bug +title: 'bug: ' +labels: [bug] +body: + - type: checkboxes + attributes: + label: Prerequisites + options: + - label: + I have searched [existing + issues](https://github.com/barrettruth/nonicons.nvim/issues) + required: true + - label: I have updated to the latest version + required: true + + - type: textarea + attributes: + label: 'Neovim version' + description: 'Output of `nvim --version`' + render: text + validations: + required: true + + - type: input + attributes: + label: 'Operating system' + placeholder: 'e.g. Arch Linux, macOS 15, Ubuntu 24.04' + validations: + required: true + + - type: textarea + attributes: + label: Description + description: What happened? What did you expect? + validations: + required: true + + - type: textarea + attributes: + label: Steps to reproduce + description: Minimal steps to trigger the bug + value: | + 1. + 2. + 3. + validations: + required: true + + - type: textarea + attributes: + label: 'Health check' + description: 'Output of `:checkhealth nonicons`' + render: text + + - type: textarea + attributes: + label: Minimal reproduction + description: | + Save the script below as `repro.lua`, edit if needed, and run: + ``` + nvim -u repro.lua + ``` + Confirm the bug reproduces with this config before submitting. + render: lua + value: | + vim.env.LAZY_STDPATH = '.repro' + load(vim.fn.system('curl -s https://raw.githubusercontent.com/folke/lazy.nvim/main/bootstrap.lua'))() + require('lazy.nvim').setup({ + spec = { + { + 'barrettruth/nonicons.nvim', + dependencies = { 'nvim-tree/nvim-web-devicons' }, + }, + }, + }) + validations: + required: true diff --git a/.github/ISSUE_TEMPLATE/config.yaml b/.github/ISSUE_TEMPLATE/config.yaml new file mode 100644 index 0000000..2df17c7 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/config.yaml @@ -0,0 +1,5 @@ +blank_issues_enabled: false +contact_links: + - name: Questions + url: https://github.com/barrettruth/nonicons.nvim/discussions + about: Ask questions and discuss ideas diff --git a/.github/ISSUE_TEMPLATE/feature_request.yaml b/.github/ISSUE_TEMPLATE/feature_request.yaml new file mode 100644 index 0000000..5ffeb9f --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature_request.yaml @@ -0,0 +1,30 @@ +name: Feature Request +description: Suggest a feature +title: 'feat: ' +labels: [enhancement] +body: + - type: checkboxes + attributes: + label: Prerequisites + options: + - label: + I have searched [existing + issues](https://github.com/barrettruth/nonicons.nvim/issues) + required: true + + - type: textarea + attributes: + label: Problem + description: What problem does this solve? + validations: + required: true + + - type: textarea + attributes: + label: Proposed solution + validations: + required: true + + - type: textarea + attributes: + label: Alternatives considered diff --git a/.github/workflows/luarocks.yaml b/.github/workflows/luarocks.yaml new file mode 100644 index 0000000..9b6664e --- /dev/null +++ b/.github/workflows/luarocks.yaml @@ -0,0 +1,21 @@ +name: luarocks + +on: + push: + tags: + - 'v*' + +jobs: + quality: + uses: ./.github/workflows/quality.yaml + + publish: + needs: quality + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - uses: nvim-neorocks/luarocks-tag-release@v7 + env: + LUAROCKS_API_KEY: ${{ secrets.LUAROCKS_API_KEY }} diff --git a/.github/workflows/quality.yaml b/.github/workflows/quality.yaml new file mode 100644 index 0000000..77049fd --- /dev/null +++ b/.github/workflows/quality.yaml @@ -0,0 +1,89 @@ +name: quality + +on: + workflow_call: + pull_request: + branches: [main] + push: + branches: [main] + +jobs: + changes: + runs-on: ubuntu-latest + outputs: + lua: ${{ steps.changes.outputs.lua }} + markdown: ${{ steps.changes.outputs.markdown }} + steps: + - uses: actions/checkout@v4 + - uses: dorny/paths-filter@v3 + id: changes + with: + filters: | + lua: + - 'lua/**' + - 'plugin/**' + - '*.lua' + - '.luarc.json' + - '*.toml' + markdown: + - '*.md' + + lua-format: + name: Lua Format Check + runs-on: ubuntu-latest + needs: changes + if: ${{ needs.changes.outputs.lua == 'true' }} + steps: + - uses: actions/checkout@v4 + - uses: JohnnyMorganz/stylua-action@v4 + with: + token: ${{ secrets.GITHUB_TOKEN }} + version: 2.1.0 + args: --check . + + lua-lint: + name: Lua Lint Check + runs-on: ubuntu-latest + needs: changes + if: ${{ needs.changes.outputs.lua == 'true' }} + steps: + - uses: actions/checkout@v4 + - name: Lint with Selene + uses: NTBBloodbath/selene-action@v1.0.0 + with: + token: ${{ secrets.GITHUB_TOKEN }} + args: --display-style quiet . + + lua-typecheck: + name: Lua Type Check + runs-on: ubuntu-latest + needs: changes + if: ${{ needs.changes.outputs.lua == 'true' }} + steps: + - uses: actions/checkout@v4 + - name: Run Lua LS Type Check + uses: mrcjkb/lua-typecheck-action@v0 + with: + checklevel: Warning + directories: lua + configpath: .luarc.json + + markdown-format: + name: Markdown Format Check + runs-on: ubuntu-latest + needs: changes + if: ${{ needs.changes.outputs.markdown == 'true' }} + steps: + - uses: actions/checkout@v4 + - name: Setup pnpm + uses: pnpm/action-setup@v4 + with: + version: 8 + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: '20' + - name: Install prettier + run: pnpm add -g prettier@3.1.0 + - name: Check markdown formatting with prettier + run: prettier --check . diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..5d1f13f --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,17 @@ +minimum_pre_commit_version: '3.5.0' + +repos: + - repo: https://github.com/JohnnyMorganz/StyLua + rev: v2.3.1 + hooks: + - id: stylua-github + name: stylua (Lua formatter) + files: \.lua$ + pass_filenames: true + + - repo: https://github.com/pre-commit/mirrors-prettier + rev: v4.0.0-alpha.8 + hooks: + - id: prettier + name: prettier + files: \.(md|toml|yaml|yml|sh)$ diff --git a/.prettierignore b/.prettierignore new file mode 100644 index 0000000..c2658d7 --- /dev/null +++ b/.prettierignore @@ -0,0 +1 @@ +node_modules/ diff --git a/.prettierrc b/.prettierrc new file mode 100644 index 0000000..0663621 --- /dev/null +++ b/.prettierrc @@ -0,0 +1,9 @@ +{ + "proseWrap": "always", + "printWidth": 80, + "tabWidth": 2, + "useTabs": false, + "trailingComma": "none", + "semi": false, + "singleQuote": true +} diff --git a/README.md b/README.md index 2620c63..fbe3e27 100644 --- a/README.md +++ b/README.md @@ -1,44 +1,22 @@ # nonicons.nvim -**Nonicons for Neovim** +**[Nonicons](https://github.com/ya2s/nonicons) for Neovim** -Replace [nvim-web-devicons](https://github.com/nvim-tree/nvim-web-devicons) -glyphs with icons from the [nonicons](https://github.com/yamatsum/nonicons) -font. Any plugin that uses nvim-web-devicons automatically displays nonicons -glyphs. + + +## Features + +- Replaces nvim-web-devicons glyphs with nonicons font icons +- Any plugin using nvim-web-devicons works automatically +- No `setup()` call needed ## Requirements - [nvim-web-devicons](https://github.com/nvim-tree/nvim-web-devicons) -- [nonicons font](https://github.com/yamatsum/nonicons/releases) installed in - your terminal +- [nonicons font](https://github.com/ya2s/nonicons/releases) installed ## Installation -Install the nonicons font and configure your terminal to use it as a fallback: - -**ghostty** - -``` -font-family = Nonicons -font-family = YourMainFont -``` - -**kitty** - -``` -symbol_map U+F101-U+F219 Nonicons -``` - -**wezterm** - -```lua -config.font = wezterm.font_with_fallback({ - 'YourMainFont', - 'Nonicons', -}) -``` - Install with your package manager of choice or via [luarocks](https://luarocks.org/modules/barrettruth/nonicons.nvim): @@ -46,7 +24,15 @@ Install with your package manager of choice or via luarocks install nonicons.nvim ``` -**lazy.nvim** +## Documentation + +```vim +:help nonicons.nvim +``` + +## FAQ + +**How do I install with lazy.nvim?** ```lua { @@ -55,126 +41,7 @@ luarocks install nonicons.nvim } ``` -The plugin applies overrides automatically. No `setup()` call is needed. - -## Configuration - -Configure via `vim.g.nonicons` before the plugin loads: - -```lua -vim.g.nonicons = { - override = true, -- default; set false to disable devicons wrapping -} -``` - -## Usage - -```lua -local get = require('nonicons').get - -get('lua') -- returns the nonicons lua character -get('python') -- returns the nonicons python character -get('git-branch') -- returns the nonicons git-branch character -``` - -The raw mapping table is available for advanced use: - -```lua -local code = require('nonicons').mapping['lua'] -local icon = vim.fn.nr2char(code) -``` - -## Recipes - -**lualine** — mode icons: - -```lua -local get = require('nonicons').get - -require('lualine').setup({ - sections = { - lualine_a = { - { - 'mode', - fmt = function(mode) - local map = { - NORMAL = get('vim-normal-mode'), - INSERT = get('vim-insert-mode'), - VISUAL = get('vim-visual-mode'), - REPLACE = get('vim-replace-mode'), - COMMAND = get('vim-command-mode'), - } - return map[mode] or mode - end, - }, - }, - }, -}) -``` - -**nvim-notify**: - -```lua -require('notify').setup({ - icons = { - ERROR = require('nonicons').get('x-circle'), - WARN = require('nonicons').get('alert'), - INFO = require('nonicons').get('info'), - DEBUG = require('nonicons').get('bug'), - TRACE = require('nonicons').get('play'), - }, -}) -``` - -**mason.nvim**: - -```lua -require('mason').setup({ - ui = { - icons = { - package_installed = require('nonicons').get('check'), - package_pending = require('nonicons').get('sync'), - package_uninstalled = require('nonicons').get('x'), - }, - }, -}) -``` - -**oil.nvim**, **fzf-lua**, **telescope.nvim** — no configuration needed. These -plugins read from nvim-web-devicons which nonicons.nvim wraps automatically. - -**nvim-tree**: - -```lua -local get = require('nonicons').get - -require('nvim-tree').setup({ - renderer = { - icons = { - glyphs = { - default = get('file'), - symlink = get('file-symlink-file'), - folder = { - default = get('file-directory-fill'), - open = get('file-directory-open-fill'), - symlink = get('file-submodule'), - empty = get('file-directory-outline'), - arrow_open = get('chevron-down'), - arrow_closed = get('chevron-right'), - }, - }, - }, - }, -}) -``` - -## Documentation - -```vim -:help nonicons.nvim -``` - ## Acknowledgements -- [yamatsum/nonicons](https://github.com/yamatsum/nonicons) — icon font +- [ya2s/nonicons](https://github.com/ya2s/nonicons) — icon font - [ya2s/nvim-nonicons](https://github.com/ya2s/nvim-nonicons) — original plugin diff --git a/doc/nonicons.nvim.txt b/doc/nonicons.nvim.txt index 3fc6b14..b10b13d 100644 --- a/doc/nonicons.nvim.txt +++ b/doc/nonicons.nvim.txt @@ -7,7 +7,7 @@ License: MIT INTRODUCTION *nonicons.nvim* nonicons.nvim replaces nvim-web-devicons glyphs with icons from the nonicons -font (https://github.com/yamatsum/nonicons). It wraps devicons functions so +font (https://github.com/ya2s/nonicons). It wraps devicons functions so that any plugin using nvim-web-devicons automatically displays nonicons glyphs. ============================================================================== @@ -164,7 +164,7 @@ FONT SETUP *nonicons-font* The nonicons font must be installed and configured in your terminal emulator. -Download the font from: https://github.com/yamatsum/nonicons/releases +Download the font from: https://github.com/ya2s/nonicons/releases ghostty ~ > @@ -200,7 +200,7 @@ Run `:checkhealth nonicons` to verify: ============================================================================== ACKNOWLEDGEMENTS *nonicons-acknowledgements* -- yamatsum/nonicons (https://github.com/yamatsum/nonicons) — icon font +- ya2s/nonicons (https://github.com/ya2s/nonicons) — icon font - ya2s/nvim-nonicons (https://github.com/ya2s/nvim-nonicons) — original plugin ============================================================================== diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..5d6a2f4 --- /dev/null +++ b/flake.nix @@ -0,0 +1,29 @@ +{ + description = "nonicons.nvim — nonicons for Neovim"; + + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; + systems.url = "github:nix-systems/default"; + }; + + outputs = + { + nixpkgs, + systems, + ... + }: + let + forEachSystem = f: nixpkgs.lib.genAttrs (import systems) (system: f nixpkgs.legacyPackages.${system}); + in + { + devShells = forEachSystem (pkgs: { + default = pkgs.mkShell { + packages = [ + pkgs.prettier + pkgs.stylua + pkgs.selene + ]; + }; + }); + }; +}