0
votes
2answers
41 views

Go to end of `===` but not include `$`

Consider the following example lines: $some ==thing(); $some == thing(); $some ==$thing; $some == $thing; I am writing a macro to improve these lines. With the cursor on the space after $some, I ...
0
votes
1answer
15 views

Find and then ask to perform action

I have a few macros to help refactor code that I have inherited. For instance, this macro adds spaces around a = character: nnoremap <leader>bg /[^ ]=[^ ]<Return>a <Esc>la ...
0
votes
1answer
39 views

VIM: How to check whether the current script is running in a macro?

In a number of cases I have some vim script that I only want to execute when it is not being run in a macro. For example, in some cases I blink the cursor to remind myself where it is now (which is ...
1
vote
1answer
142 views

How to cancel recording a macro in Vim?

Imagine I had recorded a macro and then I've occasionally started recording a macro into the same register. Can I interrupt the recording so that the original macro is preserved in the register? I ...
1
vote
2answers
206 views

How to create and run a macro that runs on current visual selection?

I'd like to create a macro so that if I select a piece of text (either by a keyboard or a mouse) and invoke this macro, it adds [b] and [/b] around the text (for example). I'm familiar with recording ...
1
vote
4answers
651 views

vim: delete all lines but unique?

I am looking for a way in VIM to delete all lines that are duplicates and only leave unique lines that exist in the file. I would prefer a macro but a command or function would be great. Say I have ...
1
vote
1answer
113 views

Why isn't VIM storing macros across sessions?

In VIM 7.3 on Ubuntu Server 12.04.1, VIM forgets macros and registers after closing. I do have set nocompatible in .vimrc and the command :set viminfo? gives this result: viminfo='100,<50,s10,h ...
0
votes
2answers
230 views

vim: Change colorscheme for internal shell

I'm using the solarized colorscheme for gvim. I'm using 'light' for normal editing. I want to switch to 'dark' when I invoke vim's internal shell (:sh). Is there a way to do this?
1
vote
1answer
323 views

why do my vim macros stop working sometimes?

This happens to me sometimes, and I haven't been able to figure out why. Lets say I start recording in vim (press q) then I finish and use the macros a few times. Then I do something else, like ...
2
votes
1answer
428 views

Can Vim autocommand be triggered by filetype instead of by pattern?

I know how to set up features using :autocmd for specific file extensions: Eg. ~/.vim/ftplugin/xml.vim augroup xml au BufEnter *.xml call Setup_XML_Menu() au BufLeave *.xml call ...
4
votes
3answers
1k views

vim: Continue macro after error in submacro?

I'm in the process of beautifying some source code using vim. {1} I've created a couple of vim macros that do the individual steps: removing trailing whilespace, removing empty lines after {, ...
2
votes
3answers
440 views

How can I break a paragraph into sentences with Vim?

By breaking into sentences I mean that each new sentence should start with a new line. How to repeat )i<CR><Esc> to the end of the paragraph }? (<CR> = Enter) If I make a macro ...
7
votes
2answers
972 views

vim macro to convert CamelCase to lowercase_with_underscores

Is there a vim macro to convert CamelCase to lowercase_with_underscores and vice versa?
1
vote
2answers
830 views

How do I automate a set of VIM commands that I use all the time?

I'm running some text files written in Markdown through Pandoc to get html, but it renders the tags strangely with weird line breaks and white space in tags, so I've been running a few sed commands in ...
2
votes
1answer
249 views

Is there anyway to have vim not count special characters as words?

I'm using VIM do alot of work for me using the macros. There's alot of text in columns and I want the macro to move between columns effortlessly by pressing the w key to "move to the beginning of ...