Skip to content

Quickly view file-contents without visiting the file

Notifications You must be signed in to change notification settings

blue0513/second-sight

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 

Repository files navigation

Second Sight

Quickly view file-contents without visiting the file, as if you had second-sight.

What's This

You can view file-contents without visiting the file.

This package will reduce the number of times you open a buffer.
For example, after you call find-file, you can see the file-content without jumping to the file.

thing-at-point
thing-at-point

counsel-find-file
counsel

Setup

Requirements

This package requires posframe.el.
You need to install posframe before.

Settings

git clone and edit your init.el as below.

(add-to-list 'load-path "/pscp/to/second-sight")
(require 'second-sight)

;; optional but recommended
(global-set-key (kbd "YOUR KEY") 'second-sight)

Usage

Basic Usage

After evaluating this expression, posframe will appear with the file-content.

(second-sight-file "filepath")

When your cursor is on the filepath like below, you can execute M-x second-sight.

"/pa|th/to/file"
    ↑ your cursor

Advanced Usage with ivy/counsel

This package partially supports ivy/counsel.
After you execute counsel-find-file, counsel-recentf, counsel-git etc, you can call second-sight.

Notice:
This package use a bit hacks to get one of ivy candidates like (ivy-state-current ivy-last) So if you want to use this package with counsel, you should assign a short-cut key as below to avoid selecting a wrong candidate.

(global-set-key (kbd "YOUR KEY") 'second-sight)

Extension

second-sight provides (second-sight-file filepath) function.
This function can generate posframe with file-contents. If you want to use it with your favorite commands like vanilla find-file, helm etc, you should call second-sight-file with filepath while selecting candidates.

Of course, PR to support other commands is also welcome!

About

Quickly view file-contents without visiting the file

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published