diff --git a/.eslintignore b/.eslintignore
index 57b71d6475..4f3b056b7b 100644
--- a/.eslintignore
+++ b/.eslintignore
@@ -798,8 +798,6 @@ packages/editor/CodeMirror/editorCommands/insertLineAfter.js
 packages/editor/CodeMirror/editorCommands/sortSelectedLines.test.js
 packages/editor/CodeMirror/editorCommands/sortSelectedLines.js
 packages/editor/CodeMirror/editorCommands/supportsCommand.js
-packages/editor/CodeMirror/editorCommands/swapLine.test.js
-packages/editor/CodeMirror/editorCommands/swapLine.js
 packages/editor/CodeMirror/getScrollFraction.js
 packages/editor/CodeMirror/markdown/codeBlockLanguages/allLanguages.js
 packages/editor/CodeMirror/markdown/codeBlockLanguages/defaultLanguage.js
diff --git a/.gitignore b/.gitignore
index 9b429e3496..08273fe026 100644
--- a/.gitignore
+++ b/.gitignore
@@ -775,8 +775,6 @@ packages/editor/CodeMirror/editorCommands/insertLineAfter.js
 packages/editor/CodeMirror/editorCommands/sortSelectedLines.test.js
 packages/editor/CodeMirror/editorCommands/sortSelectedLines.js
 packages/editor/CodeMirror/editorCommands/supportsCommand.js
-packages/editor/CodeMirror/editorCommands/swapLine.test.js
-packages/editor/CodeMirror/editorCommands/swapLine.js
 packages/editor/CodeMirror/getScrollFraction.js
 packages/editor/CodeMirror/markdown/codeBlockLanguages/allLanguages.js
 packages/editor/CodeMirror/markdown/codeBlockLanguages/defaultLanguage.js
diff --git a/packages/editor/CodeMirror/editorCommands/editorCommands.ts b/packages/editor/CodeMirror/editorCommands/editorCommands.ts
index 5e292bd7af..e0037eedd6 100644
--- a/packages/editor/CodeMirror/editorCommands/editorCommands.ts
+++ b/packages/editor/CodeMirror/editorCommands/editorCommands.ts
@@ -1,13 +1,12 @@
 import { EditorView } from '@codemirror/view';
 import { EditorCommandType, ListType } from '../../types';
-import { undo, redo, selectAll, indentSelection, cursorDocStart, cursorDocEnd, cursorLineStart, cursorLineEnd, deleteToLineStart, deleteToLineEnd, undoSelection, redoSelection, cursorPageDown, cursorPageUp, cursorCharRight, cursorCharLeft, insertNewlineAndIndent, cursorLineDown, cursorLineUp, toggleComment, deleteLine } from '@codemirror/commands';
+import { undo, redo, selectAll, indentSelection, cursorDocStart, cursorDocEnd, cursorLineStart, cursorLineEnd, deleteToLineStart, deleteToLineEnd, undoSelection, redoSelection, cursorPageDown, cursorPageUp, cursorCharRight, cursorCharLeft, insertNewlineAndIndent, cursorLineDown, cursorLineUp, toggleComment, deleteLine, moveLineUp, moveLineDown } from '@codemirror/commands';
 import {
 	decreaseIndent, increaseIndent,
 	toggleBolded, toggleCode,
 	toggleHeaderLevel, toggleItalicized,
 	toggleList, toggleMath,
 } from '../markdown/markdownCommands';
-import swapLine, { SwapLineDirection } from './swapLine';
 import duplicateLine from './duplicateLine';
 import sortSelectedLines from './sortSelectedLines';
 import { closeSearchPanel, findNext, findPrevious, openSearchPanel, replaceAll, replaceNext } from '@codemirror/search';
@@ -55,8 +54,8 @@ const editorCommands: Record<EditorCommandType, EditorCommandFunction> = {
 	[EditorCommandType.IndentLess]: decreaseIndent,
 	[EditorCommandType.IndentAuto]: indentSelection,
 	[EditorCommandType.InsertNewlineAndIndent]: insertNewlineAndIndent,
-	[EditorCommandType.SwapLineUp]: swapLine(SwapLineDirection.Up),
-	[EditorCommandType.SwapLineDown]: swapLine(SwapLineDirection.Down),
+	[EditorCommandType.SwapLineUp]: moveLineUp,
+	[EditorCommandType.SwapLineDown]: moveLineDown,
 	[EditorCommandType.GoDocEnd]: cursorDocEnd,
 	[EditorCommandType.GoDocStart]: cursorDocStart,
 	[EditorCommandType.GoLineStart]: cursorLineStart,
diff --git a/packages/editor/CodeMirror/editorCommands/swapLine.test.ts b/packages/editor/CodeMirror/editorCommands/swapLine.test.ts
deleted file mode 100644
index 917bebe9e0..0000000000
--- a/packages/editor/CodeMirror/editorCommands/swapLine.test.ts
+++ /dev/null
@@ -1,32 +0,0 @@
-import { EditorView } from '@codemirror/view';
-import { EditorSelection } from '@codemirror/state';
-import swapLine, { SwapLineDirection } from './swapLine';
-
-
-describe('swapLine', () => {
-	it('should swap line down', () => {
-		const initialText = 'Hello\nWorld\nJoplin\n';
-		const editorView = new EditorView({
-			doc: initialText,
-			selection: EditorSelection.cursor(0),
-		});
-
-		swapLine(SwapLineDirection.Down)(editorView);
-
-		const result = editorView.state.doc.toString();
-		expect(result).toBe('World\nHello\nJoplin\n');
-	});
-
-	it('should swap line up', () => {
-		const initialText = 'Hello\nWorld\nJoplin\n';
-		const editorView = new EditorView({
-			doc: initialText,
-			selection: EditorSelection.cursor(6),
-		});
-
-		swapLine(SwapLineDirection.Up)(editorView);
-
-		const result = editorView.state.doc.toString();
-		expect(result).toBe('World\nHello\nJoplin\n');
-	});
-});
diff --git a/packages/editor/CodeMirror/editorCommands/swapLine.ts b/packages/editor/CodeMirror/editorCommands/swapLine.ts
deleted file mode 100644
index c6fc21baea..0000000000
--- a/packages/editor/CodeMirror/editorCommands/swapLine.ts
+++ /dev/null
@@ -1,49 +0,0 @@
-import { EditorSelection } from '@codemirror/state';
-import { Command, EditorView } from '@codemirror/view';
-
-export enum SwapLineDirection {
-	Up = -1,
-	Down = 1,
-}
-
-const swapLine = (direction: SwapLineDirection): Command => (editor: EditorView) => {
-	const state = editor.state;
-	const doc = state.doc;
-
-	const transaction = state.changeByRange(range => {
-		const currentLine = doc.lineAt(range.anchor);
-		const otherLineNumber = currentLine.number + direction;
-
-		// Out of range? No changes.
-		if (otherLineNumber <= 0 || otherLineNumber > doc.lines) {
-			return { range };
-		}
-
-		const otherLine = doc.line(otherLineNumber);
-
-		let deltaPos;
-		if (direction === SwapLineDirection.Down) {
-			// +1: include newline
-			deltaPos = otherLine.length + 1;
-		} else {
-			deltaPos = otherLine.from - currentLine.from;
-		}
-
-		return {
-			range: EditorSelection.range(range.anchor + deltaPos, range.head + deltaPos),
-			changes: [{
-				from: currentLine.from,
-				to: currentLine.to,
-				insert: otherLine.text,
-			}, {
-				from: otherLine.from,
-				to: otherLine.to,
-				insert: currentLine.text,
-			}],
-		};
-	});
-
-	editor.dispatch(transaction);
-	return true;
-};
-export default swapLine;