Tag Info

Hot answers tagged

19

You can just use % for current file. This command should serve your purpose: :! python %


11

Visual Block Mode First, move the cursor to the first char of the first line in block code you want to comment, then type: CTRL + V then vim will go in to VISUAL BLOCK mode. Use j to move the cursor down until you reach the last line of your code block. Then type: Shift + I now vim go to INSERT mode and the cursor is at the first char of the firts ...


7

Ranges: You can do it with the following command: :66,70s/^/# for comment, and for uncomment: :66,70s/^#/ obviously, here we're commenting lines from 66 to 70 (inclusive). Hope this helps. Regards.


4

One simple approach is xdotool, like xdotool type 'text'


4

Give xdotool a look. It's extremely powerful and should be able to do whatever you need. http://www.semicomplete.com/projects/xdotool/xdotool.xhtml


3

Take a look at the glob function (:help glob()) For example, this command :nmap <leader>* ciW<C-r>=substitute(glob(@"),'\n',' ','g')<cr> defines a normal-mode mapping that replaces the current word with space separated output of glob. Note that it will clobber your " register, which should not be a big deal as long as you keep that ...


3

Substitute For the sake of completeness here's another way: Enter visual mode by pressing v select the lines you like to comment (up/down arrow or j/k) enter :s/^/# / which translates to: in selection (:) replace beginning of line (^) with `# '


3

Markers: Step1 -> go to first line and set the marker with mt step2 -> go to the line till which you want range and issue the command :'t,.s/^/#/In Step1, in mt t is just a name for marker, you can put any character in place of it ,but put the same character in place of t in Step2 also All the steps are done in command mode


3

If the vi process is executing in a tmux window: tmux send-keys -t "${window_name}:${pane_number}" Escape :wq Enter If you want to kill a vi process, send it a HUP signal. This doesn't save the file, but leaves file recovery data if not disabled in the vim configuration. kill -HUP $pid


3

The flag you want is -invisible. See this example, adapted from http://ubuntuforums.org/showthread.php?t=786697 ooffice -invisible macro:///Standard.Module1.SaveAsXHTML("/tmp/somefile.rtf")


2

xmacro is a basic macro-recorder/macro-player.. it is good for some things, but is not suited to monitoring your keystrokes dynamically (other than for recording)... xmacro: Record / Play keystrokes and mouse movements in X displays You are probably better off using a tool like autokey.. You can find some tutorials at How-To Geek Autokey Sample ...


2

Add at the end of your .screenrc the following lines: split focus other To run multiple command, each in a separated split window: screen -t title1 app1 split focus screen -t title2 app2 split focus screen -t title3 app3 and so on.


2

You might try this: :.,'c normal @a This uses the “ranged” :normal command to run the normal-mode command @a with the cursor successively positioned on the first column of each line starting with current line and going down to to the line with mark c. If the mark happens to be above the cursor, then Vim will ask if you want to reverse the range. This is ...


2

A change is any command that modifies the text in the current buffer. You'll find all commands listed under :help change.txt. In insert mode, a change is further limited to a sequence of continually entered characters, i.e. if you use the cursor keys to navigate (which you shouldn't), only the last typed part is repeated. Commands like j are motions; i.e. ...


1

Plugin There is a plugin, which offers an efficient way of commenting out based on the file system being used. Also, this answer discusses how to use the NERD commenter for vim. Few more basic instructions on how to use the plugin are discussed here.


1

sudo apt-add-repository ppa:versable/elementary-update sudo apt-get update sudo apt-get install elementary-tweaks In System settings -> Tweaks -> Shortcuts '+' to add new shortkey use a command like sh /path/to/script In order to run the script, xclip is needed. sudo apt-get install xclip


1

xte, part of xautomation is another tool that you can use to generates fake X11 input using the XTest extension. From the homepage: Control X from the command line for scripts, and do "visual scraping" to find things on the screen. The control interface allows mouse movement, clicking, button up/down, key up/down, etc, and uses the XTest extension so ...


1

Abbrevs can only contain characters that are considered word syntax as specified by the current buffer's syntax table. If you make "." and "-" word characters, then you can use them in abbrevs. (require 'sgml-mode) (modify-syntax-entry ?- "w" html-mode-syntax-table) (modify-syntax-entry ?. "w" html-mode-syntax-table)


1

Some pointers :h 'makeprg :h :make


1

I'm not sure what you're trying to do. If you want to make a key combination perform an action, you can use XBindKeys. The companion program xbindkeys_config can help define bindings. If you want to act on existing windows, invoke a program such as xdotool or wmctrl. If you want to make a key combination simulate a sequence of key presses, try xmacro.


1

This might not be quite what you're looking for, but if you install dmenu and associate it to a key (so that's only one shortcut you'd need to define in any desktop manager), then you can use it to launch other programs. dmenu presents itself as a small horizontal bar appearing on top of the screen, that will suggest completions of executables as you start ...


1

Create an event-driven macro assigned to the Open Document event for a particular document or a common document. Then you would load the document by itself to act on itself or load it along with other documents to act on one or more of them. This is along the lines of the idea of an auto-run macro.



Only top voted, non community-wiki answers of a minimum length are eligible