8000 GitHub - mk2/dpu: determine permanent URI
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

mk2/dpu

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

59 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

dpu: determine permanent URI

License X11 Gem Version Build Status

dpu command shows us permanent source-code URI.

$ dpu array.c 4133 4136
https://github.com/ruby/ruby/blob/v3_2_2/array.c#L4133-L4136

Requirements

  • Ruby

Installation

$ gem install dpu

Usage

Get permanent source code URI:

$ dpu path_to_code

Get permanent source code URI with line range:

$ dpu path_to_code start_line_number end_line_number

Emacs integration

Write following code to your .emacs, and evaluate it.

(define-key global-map (kbd "C-x L")
  (lambda ()
    (interactive)
    (message
     (concat
      "Copied: "
      (kill-new
       (s-chomp
        (shell-command-to-string
         (concat
          "dpu "
          buffer-file-name
          " "
          (number-to-string (line-number-at-pos (region-beginning)))
          (if mark-active (concat " " (number-to-string (line-number-at-pos (region-end)))))
          )
         )))))))

Then type C-x L to copy permanent URI. C-y to paste it.

Textbringer integration

define_command(:copy_permanent_uri, doc: "Copy permanent URI") do
  require "dpu"
  b = Buffer.current
  uri = Dpu.determine_permanent_uri(Pathname(b.file_name), b.current_line)
  KILL_RING.push(uri)
  Clipboard.copy(uri) if CLIPBOARD_AVAILABLE
  message("Copied: #{uri}")
end

GLOBAL_MAP.define_key("\C-xL", :copy_permanent_uri)

Other editor integration

Write pull-request or issue, please!

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/nishidayuya/dpu .

About

determine permanent URI

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Ruby 99.1%
  • Shell 0.9%
0