diff --git a/.github/workflows/format.yml b/.github/workflows/format.yml new file mode 100644 index 0000000..a5f3ce3 --- /dev/null +++ b/.github/workflows/format.yml @@ -0,0 +1,26 @@ +name: Format + +on: [push, pull_request] + +jobs: + format: + name: Stylua + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - run: date +%W > weekly + + - name: Restore cache + id: cache + uses: actions/cache@v2 + with: + path: | + ~/.cargo/bin + key: ${{ runner.os }}-cargo-${{ hashFiles('weekly') }} + + - name: Install + if: steps.cache.outputs.cache-hit != 'true' + run: cargo install stylua + + - name: Format + run: stylua --check lua/ --config-path=.stylua.toml diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml new file mode 100644 index 0000000..e2c25fd --- /dev/null +++ b/.github/workflows/lint.yml @@ -0,0 +1,18 @@ +name: Lint + +on: [push, pull_request] + +jobs: + lint: + name: Luacheck + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Setup + run: | + sudo apt-get update + sudo apt-get install luarocks + sudo luarocks install luacheck + + - name: Lint + run: luacheck lua/harpoon diff --git a/.luacheckrc b/.luacheckrc new file mode 100644 index 0000000..4de34b6 --- /dev/null +++ b/.luacheckrc @@ -0,0 +1,10 @@ +std = luajit +cache = true +codes = true + +globals = { + "HarpoonConfig", + "Harpoon_bufh", + "Harpoon_win_id", +} +read_globals = { "vim" } diff --git a/lua/harpoon/term.lua b/lua/harpoon/term.lua index 90c4268..405d90a 100644 --- a/lua/harpoon/term.lua +++ b/lua/harpoon/term.lua @@ -27,6 +27,25 @@ local function create_terminal() return buf_id, term_id end +<<<<<<< HEAD +======= +M.getCmd = function(idx) + log.trace("getCmd()") + local cmd + if type(idx) == "number" then + cmd = harpoon.get_term_config().cmds[idx] + else + log.error("getCmd(): Index is expected to be a number.") + end + + if cmd then + return cmd + else + error("Command does not exist for that id.") + end +end + +>>>>>>> 2d37262466380a38ba9d54bdf6754d005d801030 local function find_terminal(idx) log.trace("_find_terminal(): Terminal:", idx) local term_handle = terminals[idx] diff --git a/lua/harpoon/test/manage-a-mark.lua b/lua/harpoon/test/manage-a-mark.lua index e5d6e98..df1969d 100644 --- a/lua/harpoon/test/manage-a-mark.lua +++ b/lua/harpoon/test/manage-a-mark.lua @@ -1,5 +1,3 @@ -- TODO: Harpooned -local Marker = require('harpoon.mark') -local eq = assert.are.same - - +-- local Marker = require('harpoon.mark') +-- local eq = assert.are.same