join したときカーソル位置を動かさないハック
J するとカーソルが移動するのは逆操作を行いやすくするため?
Emacs の M-^ も同じ位置にカーソルが移動するな。
@@ -4059,6 +4145,7 @@ int nextsize; /* size of the next line */ int spaces; /* number of spaces to insert */ linenr_T t; + colnr_T col_save; if (curwin->w_cursor.lnum == curbuf->b_ml.ml_line_count) return FAIL; /* can't join on last line */ @@ -4153,19 +4240,11 @@ t = curwin->w_cursor.lnum; mark_col_adjust(t + 1, (colnr_T)0, (linenr_T)-1, (long)(currsize + spaces - (next - next_start))); + col_save = curwin->w_cursor.col; ++curwin->w_cursor.lnum; del_lines(1L, FALSE); curwin->w_cursor.lnum = t; - - /* - * go to first character of the joined line - */ - curwin->w_cursor.col = currsize; - check_cursor_col(); -#ifdef FEAT_VIRTUALEDIT - curwin->w_cursor.coladd = 0; -#endif - curwin->w_set_curswant = TRUE; + curwin->w_cursor.col = col_save; return OK; }