diff --git a/.github/workflows/changelog.yaml b/.github/workflows/changelog.yaml new file mode 100644 index 0000000..74b20dc --- /dev/null +++ b/.github/workflows/changelog.yaml @@ -0,0 +1,22 @@ +name: changelog +on: release + +jobs: + changelog-gen: + name: Generate changelog + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + with: + fetch-depth: 0 + + - uses: orhun/git-cliff-action@v1 + with: + config: cliff.toml + args: -vv --latest --strip header -c .github/workflows/cliff.toml + env: + OUTPUT: CHANGELOG.md + + - name: Print the changelog + run: cat "${{ steps.git-cliff.outputs.changelog }}" diff --git a/.github/workflows/cliff.toml b/.github/workflows/cliff.toml new file mode 100644 index 0000000..43aa505 --- /dev/null +++ b/.github/workflows/cliff.toml @@ -0,0 +1,80 @@ +# configuration file for git-cliff (0.1.0) + +[changelog] +# changelog header +header = """ +# Changelog\n +All notable changes to this project will be documented in this file.\n +""" +# template for the changelog body +# https://tera.netlify.app/docs/#introduction +body = """ +{% if version %}\ + ## [{{ version | trim_start_matches(pat="v") }}] +{% else %}\ + ## [unreleased] +{% endif %}\ +{% for group, commits in commits | group_by(attribute="group") %} + ### {{ group | upper_first }} + {% for commit in commits + | filter(attribute="scope") + | sort(attribute="scope") %} + - {% if commit.breaking %}[**breaking**] {% endif %}_({{commit.scope}})_ {{ commit.message }} + {%- endfor %} + {% for commit in commits %} + {%- if commit.scope -%} + {% else -%} + - {% if commit.breaking %}[**breaking**] {% endif %}{{ commit.message }} + {% endif -%} + {% endfor -%} + {% raw %}{% endraw %}\ +{% endfor %}\n +""" +# remove the leading and trailing whitespaces from the template +trim = true +# changelog footer +footer = """ + +""" + +[git] +# allow only conventional commits +# https://www.conventionalcommits.org +conventional_commits = true +# filter out the commits that are not conventional +filter_unconventional = true +# regex for parsing and grouping commits +commit_preprocessors = [ + { pattern = '\((\w+\s)?#([0-9]+)\)', replace = "([#${2}](https://github.com/lunarvim/lunarvim/pull/${2}))" }, +] +commit_parsers = [ + { message = "(.*[bB]ump)", group = " Miscellaneous Tasks", skip = true }, + { message = "^[bB]uild", group = " Packaging" }, + { message = "(^[fF]eat|^\\[Feat)", group = " Features" }, + { message = "(^[bB]ug|^[Ff]ix|^\\[Bug)", group = " Bugfix" }, + { message = "(^[rR]efactor|^ref)", group = " Refactor" }, + { message = "^[dD]oc", group = " Documentation" }, + { message = "^[rR]evert", group = " Revert" }, + { message = "^[pP]erf", group = " Performance" }, + { message = "^[cC]hore", group = " Miscellaneous Tasks", skip = true }, + { message = "^ci", group = " Miscellaneous Tasks", skip = true }, + { message = "^test", group = " Miscellaneous Tasks", skip = true }, + { message = "[wW]orkflow", group = " Miscellaneous Tasks", skip = true }, +] +# filter out the commits that are not matched by commit parsers +filter_commits = false +# glob pattern for matching git tags +tag_pattern = "v[0-9]*" +# regex for skipping tags +skip_tags = "v0.1.0-beta.1" +# regex for ignoring tags +ignore_tags = "" +# sort the tags topologically +topo_order = false +# sort the commits inside sections by oldest/newest order +sort_commits = "oldest" +# protect breaking changes from being skipped due to matching a skipping commit_parser +protect_breaking_commits = false + +[features] +preserve_order = ["serde_json/preserve_order"] diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml new file mode 100644 index 0000000..da9c310 --- /dev/null +++ b/.github/workflows/lint.yaml @@ -0,0 +1,29 @@ +name: lint + +on: + push: + branches: + - "master" + tags: + - "v*" + pull_request: + branches: + - "master" + paths: + - "lua/**" + +jobs: + lua-linter: + name: "Linting with luacheck" + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - uses: leafo/gh-actions-lua@v8 + - uses: leafo/gh-actions-luarocks@v4 + + - name: Use luacheck + run: luarocks install luacheck + + - name: Run luacheck + run: luacheck *.lua lua/**/*.lua diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml new file mode 100644 index 0000000..d74a162 --- /dev/null +++ b/.github/workflows/release.yaml @@ -0,0 +1,25 @@ +on: + push: + # Sequence of patterns matched against refs/tags + tags: + - "v*" # Push events to matching v*, i.e. v1.0, v20.15.10 + +name: Create Release + +jobs: + build: + name: Create Release + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@master + - name: Create Release + id: create_release + uses: actions/create-release@latest + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token + with: + tag_name: ${{ github.ref }} + release_name: Release ${{ github.ref }} + draft: false + prerelease: false diff --git a/.luacheckrc b/.luacheckrc new file mode 100644 index 0000000..715ab83 --- /dev/null +++ b/.luacheckrc @@ -0,0 +1,45 @@ +---@diagnostic disable +-- vim: ft=lua tw=80 + +stds.nvim = { + globals = { + "vim", + "reload", + vim = { fields = { "g" } }, + "TERMINAL", + "USER", + "C", + "Config", + "WORKSPACE_PATH", + "JAVA_LS_EXECUTABLE", + "MUtils", + "USER_CONFIG_PATH", + os = { fields = { "capture" } }, + }, + read_globals = { + "jit", + "os", + "vim", + "join_paths", + "get_runtime_dir", + "get_config_dir", + "get_cache_dir", + "get_lvim_base_dir", + "require_clean", + }, +} +std = "lua51+nvim" + +files["tests/*_spec.lua"].std = "lua51+nvim+busted" +files["lua/lvim/impatient*"].ignore = { "121" } + +-- Don't report unused self arguments of methods. +self = false + +-- Rerun tests only if their modification time changed. +cache = true + +ignore = { + "631", -- max_line_length + "212/_.*", -- unused argument, for vars with "_" prefix +} diff --git a/.luarc.json b/.luarc.json new file mode 100644 index 0000000..a95ef0a --- /dev/null +++ b/.luarc.json @@ -0,0 +1,9 @@ +{ + "$schema": "https://raw.githubusercontent.com/sumneko/vscode-lua/master/setting/schema.json", + "Lua.diagnostics.disable": [ + "redundant-parameter", + "param-type-mismatch", + "missing-parameter" + ], + "diagnostics.libraryFiles": "Disable" +} diff --git a/.stylua.toml b/.stylua.toml deleted file mode 100644 index bfcffff..0000000 --- a/.stylua.toml +++ /dev/null @@ -1,7 +0,0 @@ -column_width = 120 -line_endings = "Unix" -indent_type = "Spaces" -indent_width = 2 -quote_style = "AutoPreferDouble" -call_parentheses = "None" -collapse_simple_statement = "Always" diff --git a/lua/autocmds.lua b/lua/autocmds.lua index 2c15a4e..658c4d6 100644 --- a/lua/autocmds.lua +++ b/lua/autocmds.lua @@ -11,7 +11,6 @@ -- Author: Kien Nguyen-Tuan -- Define autocommands with Lua APIs -- See: h:api-autocmd, h:augroup -local augroup = vim.api.nvim_create_augroup -- Create/get autocommand group local autocmd = vim.api.nvim_create_autocmd -- Create autocommand -- General settings diff --git a/lua/mappings.lua b/lua/mappings.lua index ff1e439..0c5d2e4 100644 --- a/lua/mappings.lua +++ b/lua/mappings.lua @@ -41,7 +41,7 @@ function _G.reload_config() vim.notify("Nvim configuration reloaded!", vim.log.levels.INFO) end -map("n", "rr", reload_config, { desc = "Reload configuration without restart nvim" }) +map("n", "rr", _G.reload_config, { desc = "Reload configuration without restart nvim" }) -- Telescope local builtin = require("telescope.builtin") diff --git a/lua/plugins/configs/null-ls.lua b/lua/plugins/configs/null-ls.lua index eef1e68..b40c1c3 100644 --- a/lua/plugins/configs/null-ls.lua +++ b/lua/plugins/configs/null-ls.lua @@ -10,10 +10,6 @@ -- Description: null-ls configuration -- Author: Kien Nguyen-Tuan local null_ls = require("null-ls") --- https://github.com/nvimtools/none-ls.nvim/tree/main/lua/null-ls/builtins/formatting -local formatting = null_ls.builtins.formatting --- https://github.com/nvimtools/none-ls.nvim/tree/main/lua/null-ls/builtins/diagnostics -local diagnostics = null_ls.builtins.diagnostics -- Load custom configurations local exist, custom = pcall(require, "custom")