Все вопросы: [vi]

103 вопросов

похожие теги:
12
голосов
3ответов
20923 просмотров

Make gvim 7.2 background black

I am sick and tired of the white background when I edit C/C++ etc. I want the black backround. That is what I currently have in my .vimrc file in regard to coloring. Please help me change it: if !has('gui_running') set t_Co=8 t_md= highlight NORMAL ctermbg=black ctermfg=white

3
голосов
4ответов
1925 просмотров

How can I execute a command when a buffer is closed in vim?

Is there something like a close-window-hook in vim/vimscript, so that I can call a function every time a window is closed? I want to use it for the following scenario: I use an extra scratch window to display information about the file, and when I close the file I want the scratch window to be c...

15
голосов
5ответов
6464 просмотров

how to move to the next enclosing brackets in VI

Are there any shortcuts to move to the next enclosing brackets. For ex: int func() { if(true) {//this point for(int i=0;i<10;i++) {//need to jump from here to //blah blah blah } } } I can move to the beginning of a function using [[ but not sure how to move to the next ...

945
голосов
16ответов
271719 просмотров

How do I use vim registers?

I only know of one instance using registers is via CtrlR* whereby I paste text from a clipboard. What are other uses of registers? How to use them? Everything you know about VI registers (let's focus on vi 7.2) -- share with us.

7
голосов
7ответов
4091 просмотров

What are most useful/used vim commands in C/C++ dev environment

Here is the list of mine Unlike me -- as I did it for illustrative purposes -- don't paste too many. And most importantly, provide an explanation Commands shouldn't be generic but relevant to C++/C environment. ctags & scope are welcome too gi .....................init insert mode i...

14
голосов
3ответов
23437 просмотров

Yank lines from one file in vi ( not vim ) to another?

I'm used to VIM and usually I split screen with and open another file, yank the text into the second one. However I'm dealing with a legacy server which only has vi, how could I either open multiple files with it if it doesn't support split views or copy text from one file to another ( 2 separat...

10
голосов
3ответов
5646 просмотров

vim / vi / linux: properly indent html file

how can I easily indent html files with linux or vi or vim.

2
голосов
5ответов
3473 просмотров

Remove colon using VI

I am trying do a find and replace in VI to remove a timestamp. I usually do this in VI using the S command but how do I tell VI I need to remove colons when its part of the structure of the VI command itself EX: " xxxxx xxxxx 24:00:00 CDT" tried s:24:00:00 CDT::g s:"24:00:00 CDT"...

22
голосов
3ответов
7441 просмотров

Changing the Leader in MacVim?

I'm trying to change <Leader> in MacVim to be something less carpal-tunnel inducing. I have added this line let mapleader="," to my .gvimrc, but "\" is still the only key that works. Am I missing something?

3
голосов
2ответов
861 просмотров

How can I code in C++ with the same indentation style both in Vi and Emacs?

How can two developers work on a same C++ code base such that they can work transparently ? Is there any common indentation style for C++ code such that once it is established, the two developers can produce code with the same indentation level. I have found Emacs very aggressive for Indentati...

48
голосов
9ответов
20786 просмотров

Vi/Vim restore opened files

I was wondering if this common IDE feature is available. Suppose I open many files using Vim, using vsplit and split. Then, I close everything. The next day, I want to recover those files. That is, recover the way they were opened, not having to open each one (using split and vsplit) again. Is...

1
голосов
2ответов
217 просмотров

the weirdest VI problem EVER

Ok, so I am trying to type the following in .cshrc file: alias ls 'ls --color=auto'. I type one character at a tiem. However, when I reach --color= i type a and cursor goes to the next line. I checked the .vimrc file and didn't fine anything out of whack. I am using vim7.2 EDIT I noticed it...

14
голосов
1ответов
3228 просмотров

How do touch typists navigate in vi?

I'm learning vi, as I appreciate the vast possibilities of the editor, and have to use a plain-text editor for my current project. In many tutorials I have read that it is recommended to use the keys "h", "j", "k" and "l" instead of the arrow keys, for the sake of speed. However, as a touch typi...

15
голосов
2ответов
14801 просмотров

How to compute the number of times word appeared in a file or in some range

Sometimes I want to see how many times a certain function is called in a file or a code block. How do you do that? I am using Vim 7.2. I presume you have to use !wc or some such.

19
голосов
5ответов
35756 просмотров

How can I escape the slash character in vi?

When I try to search a string starting with the slash / character in vi, the cursor jumps to the next search result from the previous search. However, I'd like to find the literal slash character. How can this be done?

11
голосов
4ответов
5465 просмотров

Swap text around equal sign

Is there an easy way to flip code around an equal sign in vi/vim? Eg: I want to turn this: value._1 = return_val.delta_clear_flags; value._2._1 = return_val.delta_inactive_time_ts.tv_sec; value._2._2 = return_val.delta_inactive_time_ts.tv_nsec; value._3 = return_val.delta_inactive_distance_...

1
голосов
4ответов
257 просмотров

Identifying Identical Blocks of Code

Say I have multiple blocks of the following code in a file (spaces is irrelavent): sdgfsdg dfg dfgdfgf ddfg dfgdfgdfg dfgfdg How do you find/highlight all the occurrences? What I ideally want to do is to visually select the code block and then press search to find all occurrences.

3
голосов
1ответов
965 просмотров

vi: paste at top of file

One thing that's bothered me with vi is that paste (p) inserts lines after the line I'm on, which makes it impossible for me to insert things at the top of a file. For instance, say I'm going through and adding a UTF-8 declaration to the top of a few files: # -*- coding: utf-8 -*- yy and it's...

5
голосов
12ответов
1356 просмотров

What are the typical use cases for vi?

I recently started picking up vi, going through some tutorials and trying to get used to it. But I still have some questions about it. It seems to be nice for small one file changes, but as soon as I start to try doing bigger things it seems to be lacking. For example I'm used to have code forma...

15
голосов
9ответов
23796 просмотров

Python IDE on Linux Console

This may sound strange, but I need a better way to build python scripts than opening a file with nano/vi, change something, quit the editor, and type in python script.py, over and over again. I need to build the script on a webserver without any gui. Any ideas how can I improve my workflow?

1126
голосов
50ответов
798617 просмотров

What is your most productive shortcut with Vim?

I've heard a lot about Vim, both pros and cons. It really seems you should be (as a developer) faster with Vim than with any other editor. I'm using Vim to do some basic stuff and I'm at best 10 times less productive with Vim. The only two things you should care about when you talk about speed (...

399
голосов
21ответов
201783 просмотров

Renaming the current file in Vim

How should I rename my current file in Vim? For example: I am editing person.html_erb_spec.rb I would like it renamed to person.haml_spec.rb I would like to continue editing person.haml_spec.rb How would I go about doing this, elegantly?

3
голосов
3ответов
1270 просмотров

Configure native vi to emit spaces instead of tabs and not convert autoindent spaces to tabs?

I would like to use spaces instead of tabs when editing Perl scripts with the native vi found on Solaris systems. I know this can be done with the vim clone, but I don't have access to install vim on these systems as they are vendor locked. Firstly, is there a way to configure vi to emit spaces...

91
голосов
7ответов
56504 просмотров

How can I insert text in the middle of the line to multiple lines in Vim?

Say I have ten lines and I want to prepend text to some word that occurs in those lines? It does not have to be at the beginning of the line. From: sdfsd foo sdfsd sfsd foo fsdf sdfsdf foo sdfsdf to: sdfsd bar(foo sdfsd sfsd bar(foo fsdf sdfsdf bar(foo sdfsdf Is it also possi...

14
голосов
3ответов
7404 просмотров

How can I open another vertical window (:vsp) on the left in vim?

vim's :vsp command opens a window on right. Is there a way to open it on the left side of the screen?

3
голосов
2ответов
2149 просмотров

Using VI to create text headers

Is there a way to easily create a text header in VI? I would like to create a header such as the one below without having to count characters for the purpose of centering. # ********** a centered title ********** Any vi voodoo to be had? A better method?

31
голосов
5ответов
19240 просмотров

regex with negative matching (ie, find string that _doesn't_ match regex)

I have a log file with the string "ERROR" on some lines. I want to delete every line that doesn't have ERROR so that I can see just what needs fixing. I was going to do something like the following in vim: %s/!(ERROR)// to replace non-error lines with an empty string. I do not believe that sta...

115
голосов
4ответов
278615 просмотров

Установка цветов фона Vim

Когда я пытаюсь изменить цвета фона в .vimrc или непосредственно в Vim с помощью команды: set background=dark ... это совершенно не влияет на мой фон. Вариант light тоже. Однако все выглядит нормально, когда я запускаю gvim. Есть ли способ изменить фон в Vim без изменения настроек Kons...

44
голосов
4ответов
12921 просмотров

Пропустить сообщение об ошибке "Шаблон не найден" в скрипте Vim

Я добавил в свой .vimrc функцию, которая содержит всего несколько команд поиска и замены. Однако, если один из шаблонов не найден, я получаю сообщение об ошибке, которое мне нужно ввести. Как я могу это подавить?

2
голосов
4ответов
1521 просмотров

vi поиск копировать вставить поиск копировать

Мне просто интересно, может ли кто-нибудь помочь с тем, как сделать следующее, используя vi. У меня есть текстовый файл, и он может содержать что-то вроде start of text file: --something1.something2-- --anotherThing1.something2-- end of text file: Если я хочу взять эту строку и преобра...