{"action":"created","issue":{"url":"https://api.github.com/repos/syl20bnr/spacemacs/issues/7961","repository_url":"https://api.github.com/repos/syl20bnr/spacemacs","labels_url":"https://api.github.com/repos/syl20bnr/spacemacs/issues/7961/labels{/name}","comments_url":"https://api.github.com/repos/syl20bnr/spacemacs/issues/7961/comments","events_url":"https://api.github.com/repos/syl20bnr/spacemacs/issues/7961/events","html_url":"https://github.com/syl20bnr/spacemacs/issues/7961","id":195416140,"node_id":"MDU6SXNzdWUxOTU0MTYxNDA=","number":7961,"title":"Newline and move cursor, suggested functions, key bindings, questions and observations","user":{"login":"duianto","id":13420573,"node_id":"MDQ6VXNlcjEzNDIwNTcz","avatar_url":"https://avatars1.githubusercontent.com/u/13420573?v=4","gravatar_id":"","url":"https://api.github.com/users/duianto","html_url":"https://github.com/duianto","followers_url":"https://api.github.com/users/duianto/followers","following_url":"https://api.github.com/users/duianto/following{/other_user}","gists_url":"https://api.github.com/users/duianto/gists{/gist_id}","starred_url":"https://api.github.com/users/duianto/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/duianto/subscriptions","organizations_url":"https://api.github.com/users/duianto/orgs","repos_url":"https://api.github.com/users/duianto/repos","events_url":"https://api.github.com/users/duianto/events{/privacy}","received_events_url":"https://api.github.com/users/duianto/received_events","type":"User","site_admin":false},"labels":[{"id":329960719,"node_id":"MDU6TGFiZWwzMjk5NjA3MTk=","url":"https://api.github.com/repos/syl20bnr/spacemacs/labels/-%20Mailling%20list%20-","name":"- Mailling list -","color":"fef2c0","default":false},{"id":187371217,"node_id":"MDU6TGFiZWwxODczNzEyMTc=","url":"https://api.github.com/repos/syl20bnr/spacemacs/labels/Evil","name":"Evil","color":"207de5","default":false},{"id":244927216,"node_id":"MDU6TGFiZWwyNDQ5MjcyMTY=","url":"https://api.github.com/repos/syl20bnr/spacemacs/labels/Feature%20request","name":"Feature request","color":"d4c5f9","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2016-12-14T01:24:08Z","updated_at":"2018-06-15T17:32:14Z","closed_at":null,"author_association":"CONTRIBUTOR","body":"### Description\r\nThere are a couple of functions that insert one or more empty lines with or without indentation, above or below the current line:\r\n<kbd>[ SPC</kbd> (evil-unimpaired/insert-space-above COUNT)\r\n<kbd>] SPC</kbd> (evil-unimpaired/insert-space-below COUNT)\r\n\r\n<kbd>SPC i</kbd> (insertion)\r\n\r\n- <kbd>j</kbd> (spacemacs/evil-insert-line-below COUNT)\r\n- <kbd>k</kbd> (spacemacs/evil-insert-line-above COUNT)\r\n- <kbd>J</kbd> (spacemacs/insert-line-below-no-indent COUNT)\r\n- <kbd>K</kbd> (spacemacs/insert-line-above-no-indent COUNT)\r\n\r\nbut none of them move the cursor to the new line.\r\n\r\n### A possible solution\r\nI copied this function:\r\n```\r\n(defun spacemacs/evil-insert-line-above (count)\r\n  \"Insert one or several lines above the current point's line without changing\r\nthe current state and point position.\"\r\n  (interactive \"p\")\r\n  (dotimes (_ count) (save-excursion (evil-insert-newline-above))))\r\n```\r\nwithout the \"save-excursion\" command, resulting in these functions:\r\n```\r\n(defun spacemacs/newline-above-move-cursor (&optional count)\r\n  \"Insert one or more newlines above and move the cursor to the last added newline.\"\r\n  (interactive \"p\")\r\n  (dotimes (_ count) (evil-insert-newline-above)))\r\n\r\n(defun spacemacs/newline-below-move-cursor (&optional count)\r\n...\r\n```\r\n\r\nI'm guessing that the new functions should be added after the `spacemacs/evil-insert-line-above` and `..-below` functions in the file: `.emacs.d/layers/+distributions/spacemacs-base/funcs.el` on Line 49\r\n\r\n### Key bindings\r\n\r\nThe key bindings should probably be added after the other insert line key bindings in the <kbd>SPC i</kbd> insertion panel, which is defined in the file: `.emacs.d/layers/+distributions/spacemacs-base/keybindings.el` on line L215:\r\n```\r\n;; insert stuff ---------------------------------------------------------------\r\n(spacemacs/set-leader-keys\r\n  \"iJ\" 'spacemacs/insert-line-below-no-indent\r\n  \"iK\" 'spacemacs/insert-line-above-no-indent\r\n  \"ik\" 'spacemacs/evil-insert-line-above\r\n  \"ij\" 'spacemacs/evil-insert-line-below\r\n  \"i C-k\" 'spacemacs/newline-above-move-cursor\r\n  \"i C-j\" 'spacemacs/newline-below-move-cursor)\r\n```\r\n\r\n### Questions\r\n\r\n1. What should the function name be?\r\n\r\nThe first attempt was: `insert-newline-and-move-above`, but \"move\" might be interpreted as the line moving.\r\n\r\nAdding \"cursor\": `insert-newline-and-move-cursor-above` is probably less confusing, but it's to long for the <kbd>SPC i</kbd> insertion panel, the last 4 characters disappear. `insert-newline-and-move-cursor-a..`.\r\n\r\nIf \"and\" is removed: `insert-newline-move-cursor-above`, then it fits but it's still quite long and the direction is the last word.\r\n\r\nThe shortest name i could come up with was: `newline-above-move-cursor`, then the direction is the second word, and there's less risk of it being pushed past the right edge of a small emacs window if/when more key bindings are added.\r\n\r\n`newline-above-and-move-cursor`, sounds better, or maybe: `newline-above-n-move-cursor`, is  enough.\r\n\r\n2. Is there a preferred maximum length for function comments?\r\n>  \"Insert one or more newlines above and move the cursor to the last added newline.\"\r\n>  \"Insert one or more newlines below and move the cursor to the last added newline.\"\r\n\r\nthese comments are 79 characters.\r\n\r\n3. Should the key bindings be: \r\n\r\n<kbd>SPC i</kbd>\r\n- <kbd>C-j</kbd>\r\n- <kbd>C-k</kbd>\r\nor\r\n- <kbd>M-j</kbd>\r\n- <kbd>M-k</kbd>\r\n\r\n4. Documentation\r\n\r\nIs there any key binding documentation for the insert line keys that also need to be added? I did a quick search but couldn't find any.\r\n\r\n### Observations\r\na. Group similar functions\r\n\r\nThese functions:\r\n`(defun spacemacs/evil-insert-line-above (count)`\r\n`(defun spacemacs/evil-insert-line-below (count)`\r\nare located on lines: 37 and 43\r\n\r\nbut these similar functions:\r\n`(defun spacemacs/insert-line-above-no-indent (count)`\r\n`(defun spacemacs/insert-line-below-no-indent (count)`\r\nare located on lines: 530 and 545, wouldn't it be better if similar functions were located next to each other?\r\n\r\nb. Identical functions:\r\n\r\nBoth of these functions and their `..-below` counterpart are identical:\r\n```\r\n(defun evil-unimpaired/insert-space-above (count)\r\n  (interactive \"p\")\r\n  (dotimes (_ count) (save-excursion (evil-insert-newline-above))))\r\n\r\n(defun spacemacs/evil-insert-line-above (count)\r\n  \"Insert one or several lines above the current point's line without changing\r\nthe current state and point position.\"\r\n  (interactive \"p\")\r\n  (dotimes (_ count) (save-excursion (evil-insert-newline-above))))\r\n```\r\nI don't know if anything can/should be done about it, but i just noticed it and if someone thinks that the knowledge is of any use, then here it is.\r\n\r\n#### System Info :computer:\r\n- OS: windows-nt\r\n- Emacs: 25.1.1\r\n- Spacemacs: 0.200.5\r\n- Spacemacs branch: develop (rev. 6288b28)\r\n- Graphic display: t\r\n- Distribution: spacemacs\r\n- Editing style: vim\r\n- Completion: helm\r\n- Layers:\r\n‘‘‘elisp\r\n(auto-completion autohotkey emacs-lisp git helm html org)\r\n‘‘‘\r\n- System configuration features: XPM JPEG TIFF GIF PNG RSVG SOUND DBUS NOTIFY ACL GNUTLS LIBXML2 ZLIB TOOLKIT_SCROLL_BARS\r\n"},"comment":{"url":"https://api.github.com/repos/syl20bnr/spacemacs/issues/comments/397690992","html_url":"https://github.com/syl20bnr/spacemacs/issues/7961#issuecomment-397690992","issue_url":"https://api.github.com/repos/syl20bnr/spacemacs/issues/7961","id":397690992,"node_id":"MDEyOklzc3VlQ29tbWVudDM5NzY5MDk5Mg==","user":{"login":"stackerzzq","id":18651103,"node_id":"MDQ6VXNlcjE4NjUxMTAz","avatar_url":"https://avatars0.githubusercontent.com/u/18651103?v=4","gravatar_id":"","url":"https://api.github.com/users/stackerzzq","html_url":"https://github.com/stackerzzq","followers_url":"https://api.github.com/users/stackerzzq/followers","following_url":"https://api.github.com/users/stackerzzq/following{/other_user}","gists_url":"https://api.github.com/users/stackerzzq/gists{/gist_id}","starred_url":"https://api.github.com/users/stackerzzq/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stackerzzq/subscriptions","organizations_url":"https://api.github.com/users/stackerzzq/orgs","repos_url":"https://api.github.com/users/stackerzzq/repos","events_url":"https://api.github.com/users/stackerzzq/events{/privacy}","received_events_url":"https://api.github.com/users/stackerzzq/received_events","type":"User","site_admin":false},"created_at":"2018-06-15T17:32:13Z","updated_at":"2018-06-15T17:32:13Z","author_association":"NONE","body":"@duianto I think there are so many persons who need this feature and you should turn your code to a PR."}}
{"actor":{"display_login":"stackerzzq"}}