GithubHelp home page GithubHelp logo

wyuenho / move-dup Goto Github PK

View Code? Open in Web Editor NEW
49.0 49.0 7.0 5.64 MB

Emacs minor mode for Eclipse-like moving and duplications of lines or selections with convenient key bindings.

License: Other

Emacs Lisp 100.00%

move-dup's People

Contributors

ergus avatar jasonm23 avatar kaligule avatar mfilenko avatar purcell avatar wyuenho avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

move-dup's Issues

Add md/duplicate-up-then-comment function.

I think this function is more useful for me.

(defun md/duplicate-up-then-comment ()
  (interactive)
  (md/duplicate-up 1)
  (comment-region (line-beginning-position) (line-end-position))
  (next-line 1))

Before

(global-set-key [(shift return)] 'md/duplicate-up)|

After

;; (global-set-key [(shift return)] 'md/duplicate-up)
(global-set-key [(shift return)] 'md/duplicate-up)|

Issue moving empty lines

Hi:

I have been using move-dup as a replacement for move-text. But there is an issue when I try to move empty lines, because they are not recognized and are not moved. Commands like md-move-lines-down only moves non empty lines.

Comparing the codes the main difference sems to be that move-text uses transpose-lines for lines like:

(defun move-text-line-up ()
  "Move the current line up."
  (interactive)
    (if (move-text--at-last-line-p)
        (let ((target-point))
          (kill-whole-line)
          (forward-line -1)
          (beginning-of-line)
          (setq target-point (point))
          (yank)
          (unless (looking-at "\n")
            (newline))
          (goto-char target-point))
      (let ((col (current-column)))
        (progn (transpose-lines 1)
               (forward-line -2)
               (move-to-column col)))))

(defun move-text-line-down ()
  "Move the current line down."
  (interactive)
  (unless (or
           (move-text--at-last-line-p)
           (and
            (move-text--last-line-is-just-newline)
            (move-text--at-penultimate-line-p)))
    (let ((col (current-column)))
      (forward-line 1)
      (transpose-lines 1)
      (forward-line -1)
      (move-to-column col))))

(move-dup-mode nil) should disable the mode

I use the global mode, but in some modes I want to disable it (like in org-mode, where it messes up the subtree-moving binds). I tried putting both (move-dup-mode) and (move-dup-mode nil) in my org mode-hook, but neither one disables the minor mode.

I don't know a lot about elisp or making modes, but from what I can tell, move-dup-mode doesn't accept nil to disable it. It would be really helpful if it did, like several other minor modes do. :)

Thanks.

Line and region behaviour is inconsistent

I replaced move-test with move-dup in my config and I've generally been quite happy. One thing that bugs me, though, is that md/move-lines-up and md/move-lines-down work differently when the region is active and when it is not.

With a region active, I can repeatedly run md/move-lines-up and the same region will move up each time. However, with no region active, the currently line moves up but the point remains on the same display line, so running md/move-lines-up again just undoes the previous action.

I suggest that it would make more sense for the point to remain at the same position within the moved line when the region is inactive. What do you think?

Unable to load this on startup

installed package, added the following to config, but only works if enabled in the minibuffer. Tried all suggestions in the readme, nothing works:
(require 'move-dup)

(global-set-key (kbd "M-<up>") 'md-move-lines-up)
(global-set-key (kbd "M-<down>") 'md-move-lines-down)
(global-set-key (kbd "C-M-<up>") 'md-duplicate-up)
(global-set-key (kbd "C-M-<down>") 'md-duplicate-down)

Wrong name of commands in repository comment

After doing
(require 'move-dup)
(global-move-dup-mode)

the command
md-move-lines-up
is not recognized as such

while
move-dup-move-lines-up
is recognized (and it works)

ditto for the other three md- commands

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.