Skip to content

Commit

Permalink
Merge pull request #2 from joshuadanpeterson/center_cursor_fix
Browse files Browse the repository at this point in the history
Fix `$` Command Issue in Normal Mode
  • Loading branch information
joshuadanpeterson authored Jul 4, 2024
2 parents b916a03 + 19922c9 commit ad0c657
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 37 deletions.
25 changes: 10 additions & 15 deletions .github/workflows/changelog.yml
Original file line number Diff line number Diff line change
@@ -1,43 +1,38 @@
name: Generate Changelog

on:
push:
tags:
- "v*.*.*" # This will trigger on version tags like v0.0.1, v0.1.0, v1.0.0, etc.
workflow_dispatch: # This allows manual triggering of the workflow from the GitHub Actions tab.

- "v*.*.*"
workflow_dispatch:
permissions:
contents: write

jobs:
generate-changelog:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v4 # Updated to use Node.js 20
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: "3.0" # Specify the version of Ruby
ruby-version: "3.0"

- name: Install github_changelog_generator
run: gem install github_changelog_generator

- name: Update remote URL
run: git remote set-url origin https://github.com/joshuadanpeterson/typewriter.nvim.git

- name: Generate Changelog
run: |
github_changelog_generator --user joshuadanpeterson --project typewriter.nvim --token ${{ secrets.GITHUB_TOKEN }}
- name: Commit and push changelog
run: |
git config --global user.name 'Josh Peterson'
git config --global user.email 'joshuadanpeterson@gmail.com'
git config --local user.name 'GitHub Action'
git config --local user.email 'action@github.com'
git add CHANGELOG.md
git commit -m 'Update changelog'
git push origin HEAD:${{ github.event.repository.default_branch }}
git commit -m 'Update changelog' || echo "No changes to commit"
git push
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
8 changes: 5 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,16 @@ name: Create Release
on:
push:
tags:
- "v*.*.*" # This will trigger on version tags like v0.0.1, v0.1.0, v1.0.0, etc.
- "v*.*.*"
permissions:
contents: write
jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Create GitHub Release
id: create_release
uses: actions/create-release@v1
Expand All @@ -21,9 +22,10 @@ jobs:
release_name: Release ${{ github.ref }}
body: |
## New Features
- Introduced `enable_notifications` option to control notifications for actions like enabling/disabling typewriter mode, and aligning code blocks.
- Fixed issue where \`$\` command in normal mode did not reach the end of the line, causing incorrect cursor placement.
## Previous Changes
- Introduced `enable_notifications` option to control notifications for actions like enabling/disabling typewriter mode, and aligning code blocks.
- Added new `:TWTop` and `:TWBottom` commands to align the current code block with the top or bottom of the screen, respectively.
- Introduced `keep_cursor_position` option to maintain cursor's relative position within the text when using `:TWCenter`, `:TWTop`, and `:TWBottom`.
- Added `:TWCenter` command to center the view around the current code block or function using Tree-sitter.
Expand Down
18 changes: 0 additions & 18 deletions .github/workflows/typecheck.yml

This file was deleted.

6 changes: 5 additions & 1 deletion lua/typewriter/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,12 @@ local function center_cursor()
if not typewriter_active then
return
end
-- Center the screen around the cursor without moving the cursor
-- Get the current cursor position
local cursor = api.nvim_win_get_cursor(0)
-- Center the screen around the cursor
api.nvim_command("normal! zz")
-- Restore the cursor position
api.nvim_win_set_cursor(0, cursor)
end

local function enable_typewriter_mode()
Expand Down

0 comments on commit ad0c657

Please sign in to comment.