yw -> копирует слово под курсором

master
serr 2025-02-04 22:49:50 +03:00
parent c7226e304f
commit b17ecd7fce
1 changed files with 7 additions and 0 deletions

View File

@ -114,6 +114,13 @@ class VimModel:
del self.displayBuffer[self.currentLine][self.currentCol + 1]
case "yy": # копирует текущую строку
self.exchangeBuffer = self.displayBuffer[self.currentLine].copy()
case "yw": # Копирует слово под курсором
line = ''.join(self.displayBuffer[self.currentLine])
start_index = line.rfind(' ', 0, self.currentCol)
start_index = 0 if start_index == -1 else start_index + 1
end_index = line.find(' ', self.currentCol)
end_index = len(line) if end_index == -1 else end_index
self.exchangeBuffer = self.displayBuffer[self.currentLine][start_index:end_index].copy()
case "dd": # вырезает текущую строку
self.exchangeBuffer = self.displayBuffer[self.currentLine].copy()
del self.displayBuffer[self.currentLine]