Skip to content

Commit e1ab306

Browse files
committed
fix(Leet yank): change window and buffer
1 parent b4aaa84 commit e1ab306

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

lua/leetcode/command/init.lua

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,8 +177,10 @@ function cmd.yank()
177177
local q = utils.curr_question()
178178
if not q then return end
179179

180-
if vim.api.nvim_win_is_valid(q.winid) then
180+
if vim.api.nvim_buf_is_valid(q.bufnr) and vim.api.nvim_win_is_valid(q.winid) then
181181
vim.api.nvim_set_current_win(q.winid)
182+
vim.api.nvim_set_current_buf(q.bufnr)
183+
182184
local start_i, end_i = q:range()
183185
vim.cmd(("%d,%dyank"):format(start_i, end_i))
184186
end

lua/leetcode/config/template.lua

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,8 @@ local M = {
5353

5454
---@type lc.storage
5555
storage = {
56-
home = vim.fn.stdpath("data") .. "/leetcode/",
57-
cache = vim.fn.stdpath("cache") .. "/leetcode/",
56+
home = vim.fn.stdpath("data") .. "/leetcode",
57+
cache = vim.fn.stdpath("cache") .. "/leetcode",
5858
},
5959

6060
---@type boolean

0 commit comments

Comments
 (0)