Conversation
- Add open_in_split function for bottom horizontal split - Add goto_last_line to move cursor after opening - Mark open_in_window as currently unused - Replace all open_in_window calls with open_in_split
There was a problem hiding this comment.
Pull request overview
This pull request replaces the floating window UI with a horizontal split layout and adds cursor positioning to the last line after opening memos.
Changes:
- Added
goto_last_linehelper function to move cursor to the last line of the current buffer - Implemented
open_in_splitfunction to open memos in a bottom horizontal split instead of floating window - Replaced
open_in_windowcalls withopen_in_splitin bothM.createandM.openfunctions
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| fnl/sm/memo.fnl | Added goto_last_line and open_in_split functions; replaced floating window calls with horizontal split; marked open_in_window as unused |
| lua/sm/memo.lua | Generated Lua output from Fennel source (should not be manually edited per project guidelines) |
| M.open = function(filepath) | ||
| local filename = vim.fn.fnamemodify(filepath, ":t") | ||
| M.open_in_window(filepath) | ||
| M.open_in_split(filepath) |
There was a problem hiding this comment.
The generated Lua file should not be edited directly. According to the project's coding guidelines, only Fennel source files in fnl/**/*.fnl should be edited. The Lua files in lua/ are auto-generated by running 'make'. Please revert any direct changes to this file and ensure all edits are made to fnl/sm/memo.fnl instead, then regenerate the Lua file using 'make'.
| "Open specific memo" | ||
| (let [filename (vim.fn.fnamemodify filepath ":t")] | ||
| (M.open_in_window filepath) | ||
| (M.open_in_split filepath) |
There was a problem hiding this comment.
The cursor is moved to the last line when creating a new memo, but not when opening an existing memo. This creates inconsistent behavior. Consider also calling goto_last_line after M.open_in_split in the M.open function to ensure users can immediately start editing in both cases.
| (M.open_in_split filepath) | |
| (M.open_in_split filepath) | |
| (goto_last_line) |
| local function goto_last_line() | ||
| local last_line = vim.api.nvim_buf_line_count(0) | ||
| return vim.api.nvim_win_set_cursor(0, {last_line, 0}) | ||
| end | ||
| M.open_in_split = function(filepath) | ||
| local buf = vim.fn.bufadd(filepath) | ||
| vim.fn.bufload(buf) | ||
| vim.bo[buf]["filetype"] = "markdown" | ||
| vim.cmd("botright split") | ||
| vim.api.nvim_win_set_buf(0, buf) | ||
| vim.wo["wrap"] = true | ||
| try_attach_copilot(1) | ||
| return buf | ||
| end |
There was a problem hiding this comment.
The generated Lua file should not be edited directly. According to the project's coding guidelines, only Fennel source files in fnl/**/*.fnl should be edited. The Lua files in lua/ are auto-generated by running 'make'. Please revert any direct changes to this file and ensure all edits are made to fnl/sm/memo.fnl instead, then regenerate the Lua file using 'make'.
| M.open_in_split(filepath) | ||
| goto_last_line() |
There was a problem hiding this comment.
The generated Lua file should not be edited directly. According to the project's coding guidelines, only Fennel source files in fnl/**/*.fnl should be edited. The Lua files in lua/ are auto-generated by running 'make'. Please revert any direct changes to this file and ensure all edits are made to fnl/sm/memo.fnl instead, then regenerate the Lua file using 'make'.
Summary
sanitize_titleto preserve Japanese characters in filenamesopen_in_window) with horizontal split (open_in_split)goto_last_lineto move cursor to last line after opening memoChanges
1. Fix Japanese character handling in sanitize_title
[^%w%-%_]+(ASCII only) to blacklist pattern2. Replace floating window with horizontal split
M.open_in_splitfunction usingbotright splitM.open_in_windowas currently unusedM.createandM.open3. Move cursor to last line
goto_last_linehelper functionTest plan
🤖 Generated with Claude Code