Subscribe RSS

Tag-Archive for "vim"

File management Jun 24
vifm

vifm

If your like me use linux without a desktop enviroment you’ll probably agree that occasionally when moving about large numbers of files it can get really friggin tedious typing lots of paths. So what about a console file manager great i hear you cry? how about it was based around vim key commands even better.

I Have found such software while doing some searches the other nite it is called vifm and tries to have shortcuts that are as vim like as possible

http://vifm.sourceforge.net

Here’s a mirror of the cheatsheet from the website.

Basic Movement

j – moves down.
k – moves up.
l – moves into a directory or launches a file.
h – moves up one directory.

gg – move to the top of the file list.
G – move to the bottom of the file list.
14G – move to the 14th file in the list.

Ctrl-F or Page Down – move forward one page.
Ctrl-B or Page Up – move back one page.

25% – move to the file that is 25 percent from the top of the list.

:34[Enter] – move to the 34th file.
:0[Enter] – move to the top of the list.
:$[Enter] – move to the bottom of the list.

The Space Bar or Tab Key toggles between the two file lists.

Ctrl+G creates a window showing detailed information about the current file.

Marks

Marks are set the same way as they are in vi.
m[a-z][A-Z][0-9] to set a mark for the current file.
‘[a-z][A-Z][0-9] moves to the file set for the mark.

Searching

/regular expression pattern[Return] – will highlight all files matching the pattern.
N – find the previous match.
n – find the next match.

Additional Normal Mode Keys

[count]dd – moves the selected files to the trash directory.
[count]yy – yanks the selected files.
p – puts the last yanked or deleted files.
t – tag the current file.
v – start visual mode.

Commands

:com – gives a menu of user commands.
:com name action – sets a new user command.
:delc command_name – will remove the command_name user command
:fil regular_expression pattern – will filter all the files out of the directory listing that match the regular expression.
:fil \.o$ – would filter all files ending in .o from the filelist. :empty will permanently remove ‘rm -fr’ files from the Trash directory.
:sh – will start a shell.
:q or :x will exit vifm.
:! program will execute the program in a shell
:!! program is the same as :! but will pause the screen before returning to vifm.
:!! will execute the last command.
:e load file into vi
:pwd show the present working directory.
:cd change directory.
:cd ~/bin
:s[ort] creates a popup menu of different sorting methods.
:his[tory] creates a popup menu of directories visited.
:h[elp] show the help file.
:marks create a popup menu of bookmarks.
:screen toggles whether or not to use the screen program.
:split splits the window to show both file directories
:only changes the window to show only the current file directory

File Filters

The basic vim folding key bindings are used for filtering files.
zO Show the filtered files.
zM Filter the files matching the filename filter.
zo Show all of the dot files.
zm Filter all of the dot files.
zf Filter all of the selected files.

Category: Linux  | Tags: , ,  | Leave a Comment
Useful VI commands Dec 30
Shes not using vi

:set hold-board-look-pretty

I use vi/vim quite a lot, heres a useful list of commands. Thanks to these people for the original: here

:set paste
turn off all auto-formatting. Use before pasting  text

:set nu
show line numbers.

:set ic
ignore case differences when searching.

:set ai
set automatic indent.

:set sm
show matching ( or { with ) or } in insert mode.

---------------

down-arrow up-arrow
move down/up 1 line.

right-arrow left-arrow
move right/left 1 character column.

0  $
go to 1st/last column of current line.

return
go down to 1st printable character of next line.

nw  nb
move right/left n words (1 word if n omitted).

ng
go to line n (end of file if n omitted).

ctrl-f  ctrl-b
page forward/backward 1 screen.

ctrl-d  ctrl-u
page forward/backward half a screen.

[[  ]]
go to beginning of current/next c function.

/expressionreturn
search forwards for expression.

?expressionreturn
search backwards for expression.

n  n
repeat last / or ? command in same/reverse direction.

ytarget
copy (yank) text up to target to buffer.

y
copy current line to buffer.

itextesc
insert text before cursor.

otextesc
open new line below cursor and insert text.

r
replace character under cursor with next typed.

rtextesc
replace text.

backspace
in insert mode, delete character before cursor.

x  x
delete character under/before cursor.

nx
delete n characters under and to right of cursor.

nx
delete n characters before cursor.

dd
delete current line.

ndd
delete n lines.

d
delete from cursor to end of line.

p  p
put back yanked or deleted text below/above current line.

j
join current and next lines.

:m,n s/old/new/gc
global replace (g=every occurrence on line, c=prompt);

m=.
means from current position, n=$ means to eof.

u
undo last change.

--------------

:q
quit, provided no changes were made.

:q!
quit without saving.

:w
save (write) changes.

:m,n w file
save lines m through n (default=all) to file.

:x
save changes and quit.
Category: Linux  | Tags: , ,  | Leave a Comment