Questions tagged [vim]

15106 questions
1

votes
1

answer
48

Views

Number of Tabs I do get after striking Tab key in Vim Insert mode

I am learning C programming. I met a problem about vim configuration. The following is my vim setting written in .vimrc: set nu set shiftwidth=4 set tabstop=4 set softtabstop=8 set autoindent set cindent set smartindent syntax on In order to see where the tabs are, I have used :set list: #include $...
1

votes
4

answer
64

Views

How to write vim function to paste a template text into current file?

Recently I'm learning go lang. And I found that for many cases, I'll need to type the following text: package main import 'fmt' func main () { } So I was thinking that maybe I can write some vim functions in my .vimrc which can write template text into current file when using vim. Which can save me...
Zen
1

votes
1

answer
47

Views

Is there a gcc command to link all the .o files in the same directory and generate a .exe file?

For example, I have file1.o,file2.o,file3.o in the same directory. Instead of type in :!gcc -o final file1.o file2.o file3.o in vim, is there a convenient way to key in that 3.o files? Maybe some searching and selecting commands? I don't know. Can someone help me with that? Thank you.
K.JIN
1

votes
3

answer
379

Views

How to modify the last-position-jump vimscript to not do it for git commit messages

Here's the script for convenience: ' Uncomment the following to have Vim jump to the last position when ' reopening a file if has('autocmd') au BufReadPost * if line(''\'') > 0 && line(''\'')
Steven Lu
1

votes
1

answer
395

Views

VIM: Browse for symbol? how?

I've looked in several plugins (FuzzyFinder/YouCompleteMe/Command-T/ctags) and they all give me almost what I want... and I'm sure it's in one of them and I cannot find it.. I want is a drop down menu (like command-t.. fuzzyfinder) so I can grep for a specific symbol (even generated by ctags). For e...
Alon
1

votes
1

answer
78

Views

Vim shift * in reverse to move to function call

When using vim, I frequently shift-* my function calls to go to the function. If I know the function is above my cursor, but there are many functions below, how do I shift-* in reverse?
donlan
1

votes
1

answer
59

Views

override python filetype detection in vim

I'm trying to detect buck's TARGETS file as 'buck' files instead of 'python', which is the filetype vim's currently detecting for them. I tried to add autocmd BufRead,BufNewFile **/TARGETS set filetype=buck to my .vimrc but it didn't seem to work. What's the correct way to change a 'default' detecte...
Vinz
1

votes
2

answer
45

Views

Delete HTML Tag with VIM

I want to delete a single tag, like . I don't want to delete anything else, just that tag. dat deletes content dit deletes content. df> works, but I have to have the cursor on
JoshuaD
1

votes
2

answer
76

Views

Using a file type plugin file (ftplugin) to change the file type in vim / neovim

To automate a step for creating multimarkdown notes. I'd like for neovim to change the filetype of a file based on the contents of first line. All of my multimarkdown notes begin with title E.g. title: Euclidean Distance Ideally i'd like to keep this out of my init.vim (.vimrc) file, however neovim...
tkolleh
1

votes
2

answer
67

Views

Vim: how to delete whitespace in blank lines?

How can I use vim to detect blank lines containing whitespace and delete the whitespace? For example, I use ⎵ to represent whitespace: def⎵function(foo): ⎵⎵⎵⎵print(foo) ⎵⎵ ⎵ function(1) Is there a vim command that converts the code above to the following? def⎵function(foo): ⎵...
Jay Wong
1

votes
2

answer
31

Views

how to autocomplete a piece of text around existing text

I have some code on a server. I need to keep repeating the same edit around pieces of existing code. E.g existing code: int hello = 1; I need to edit this #ifndef X int hello = 1; #else #endif Is there a way to be able to create a wrapper to autocomplete? #ifndef X {existing code} #else #endif Th...
Moses S
1

votes
1

answer
64

Views

Is it possible to have multicolored headings in markdown syntax in at least one of these editors: Sublime Text 3, Vim or Visual Studio Code?

Essentially I would like for my headings to look like this: How could I accomplish this in markdown syntax? I prefer sublime text but would be happy if I can make this happen in Sublime Text 3, Vim or Visual Studio Code. Lastly, if getting the subheadings to produce multicolors is difficult, then, h...
hearsay
1

votes
2

answer
208

Views

Vim white background

I have 1 problem in vim. I installed solarized theme in iterm and vim. But everytime time when I launch vim I have white background. But after I type set background=dark or set background=light I got what I want. What the problem can it be? My .vimrc
Dzhabrail Marhiev
1

votes
1

answer
29

Views

Add langmap and keymap to vim in mac

The following outputs when I run: vim --version VIM -Vi IMproved 8.0 ... Included patches: 1-503, 505-642 Compiled by [email protected] Normal version without GUI. Features included (+) or not (-): ... - langmap - keymap ... As a result I can't use set langmap=.... How do I add this feature to the...
donlan
1

votes
1

answer
123

Views

Raspbian building ncurses and vim from source

I don't have an internet connection and won't for at least a few weeks. I had to download a minimal version of Raspbian which vim isn't included by default. Without internet access on my Pi I'm not able to use the package manager. I downloaded ncurses 6.0 from https://ftp.gnu.org/pub/gnu/ncurses/nc...
Bryan Abrams
1

votes
0

answer
68

Views

vim-fireplace cpp don't evaluate every time

I'm having trouble with vim-fireplace using the cpp command. I'm only using cpp to evaluate the println but at some random point vim enters insert mode and overwrites whatever I type. ESC don't work, only ctrl-c. This problem is only on my Ubuntu machine, on Mac it works fine. Here is my vimrc. file...
ezzato
1

votes
0

answer
263

Views

vim: bad auto-indentation for bash

I'd like to have my bash scripts auto-indented within vim (using '='). If I take the script: #!/bin/bash if :; then { echo 1 echo 2 } fi the command 'gg=G' will indent everything fine. But if I write it as: #!/bin/bash :&&{ echo 1 echo 2 } 'gg=G' will only indent the first line after '{', as shown....
Gerald Schade
1

votes
0

answer
103

Views

vim install from source fails in macOS high sierra

I recently upgraded from 10.9 to 10.13 and had to reinstall vim. I checked out vim from source and did the following: $/source-pkgs/vim>./configure --with-features=huge - -enable-multibyte --enable-rubyinterp=yes --enable-pythoninterp=yes --with- python-config-dir=/usr/lib/python2.7/config --enable-...
A.D
1

votes
0

answer
97

Views

vim-php-cs-fixer does not work by php-cs-fixer ver.2.*

I use vim-php-cs-fixer to fix my php code, and php-cs-fixer is ver.2.9 installed by composer. If I call PhpCsFixerFixFile(), the error occur. You are running PHP CS Fixer with xdebug enabled. This has a major impact on runtime performance. If you need help while solving warnings, ask at https://git...
Ryutaro Matsumoto
1

votes
0

answer
29

Views

Vim: Input method automatically restores when completion menu pops up

I'm using Chinese Pinyin as default input method. Every time when I use English input method to type code, it restores to Chinese input method as the completion menu pops up. It's just like that when I switch from one mode to another mode, the input method automatically restores. Is there any way to...
Wray Zheng
1

votes
1

answer
193

Views

Correct (and stable) vim syntax highligthing with multi-line matches

I'm trying to create a vim syntax file that has a multi-line match but this causes incorrect syntax highlighting if vim redraws the buffer when the current line comes after the multi-line match. For instance, I'd like vim to apply the following colors using this criteria (and in this order): Color...
user9205693
1

votes
0

answer
41

Views

write line with constant or variable values every X number of characters in vim

Is there a way to write a new line in vim which inserts constant or variable values every X number of characters? I would like to include a line in the data block of a nexus file with a separator | every 10 characters. I would also like to insert the character number above this. Here is an example o...
Jeff Groh
1

votes
1

answer
136

Views

Vim UltiSnips plugin remaps <CR> (Enter key) in insert mode even when I'm not in a snippet

Whenever I hit Enter in insert mode, nothing happens, which is quite annoying as you can probably imagine. I've checked the mapping with :imap and it turns out UltiSnips maps : i * =UltiSnips#ExpandSnippetOrJump() If i iunmap , my enter key starts working again but UltiSnips stops working (...
Anni
1

votes
1

answer
70

Views

Vim YouCompleteMe overzealous autocompletion

I'm (trying) switching to vim but YouCompleteMe is giving me a hard time. It is just autocompleting the wrong thing way too fast when there are many options. Generally the second item. My other settings are good and I'm happy with them. I've heard this issue is from conflicts in the .vimrc. Anyone k...
Zachscs
1

votes
1

answer
217

Views

How do I disable the cursorline in vim for the nerdtree plugin?

I can disable the cursorline in the nerdtree plugin by the following command :set nocursorline but how do I do it in my .vimrc file?
msr
1

votes
2

answer
69

Views

Open Specific Drive Using Netrw Vim

I am using Vim80 on Windows 10. Using Netrw command , by default it will open up my %HOME% path. I want to open specific disk drive on my computer like F: using netrw. I have searched through similar questions on Stack Overflow and found answers like using :Ex F: or :cd F:\ but it does not change th...
Akhmad Zaki
1

votes
2

answer
780

Views

How to configure vim for auto complete in Python file and Javascript file too

I work with vim for 2 years in cpp, and untill today, i used to auto complete my code with ctags. It wasnt great, but enough for my needs. Currently, i work with python and Javascript and i am looking for good tool which give me support for both languages. I tried Jedi for python and i was great, b...
Moshe Reubinoff
1

votes
0

answer
48

Views

Vim NerdTree file opening in hsplit when ultisnips & YouCompleteMe

I'm facing this weird issue when I started using YCM and ultisnips. So the issue is if I select any file in NerdTree it is opening in the new buffer as expected but If is write code inside that file by using any YCM + ultisnips. It starts opening in hsplit instead of as normal buffer tab. My .vimrc...
Dimpu Aravind Buddha
1

votes
0

answer
41

Views

errorformat settings for gcc in german environment

Within english environment the error messages are as follows: make[5]: Entering directory '/home/krud/git_my_checkout/first/project_m' make[5]: Leaving directory '/home/krud/git_my_checkout/first/project_m' With german environment, the output from make with gcc looks like: make[5]: Verzeichnis „/h...
Klaus
1

votes
0

answer
535

Views

Powerline fonts not working with vim on archlinux

I get bad symbols in places $ pacman -Qqe | grep powerline powerline powerline-fonts powerline-vim $ pacman -Qqe | grep vim-airline vim-airline vim-airline-themes $ python --version Python 3.6.4 $...
Abhishek Bhatia
1

votes
0

answer
62

Views

vim regex for 'word1 NOT FOLLOWED BY word2 or word3'

Vim regex for volvo not followed by merc is: volvo\(merc\)\@! But I could not figure out regex for volvo not followed by merc and not followed by bmw. This does not seem to work: volvo\(merc|bmw\)\@! (volvomerc should not match, volvobmw should not match, volvoford should match)
vjjj
1

votes
2

answer
47

Views

Vim: Color a line, keep it colored until line no longer visible

In Vim, I want to be able to press a key to color/highlight/mark the current line, and KEEP it colored until either the line is no longer visible on the screen, or I press the key again to toggle highlight. How do I do this?
bndfcom
1

votes
1

answer
67

Views

How to cleanly exit ruby in vimscript

TLDR Given a vim command like: nnoremap x :ruby puts 'foo'; exit 0; puts 'bar' What could I replace exit 0 with to make this command exit cleanly without printing 'bar'? Longer version Say I have a ruby script in my vimconfig. For clarity I'll wrap it in a function, but that's not really necessary:...
Fishtoaster
1

votes
2

answer
211

Views

Get Vim on Mac terminal to copy to the clipboard

I'm using Vim on a Mac, installed via homebrew, version 8.0. Vim --version shows +clipboard, and -xterm_clipboard. I've tried set clipboard=unnamed in .vimrc But I cannot get yanks to go on to the system clipboard. What do I do?
John Small
1

votes
1

answer
40

Views

The ý character in INSERT mode isn't printed

Issue description I use VIM to take notes in Czech at university lectures. All special characters work fine except for the 'ý' character. When I type it in INSERT mode, it isn't printed. Instead, it shifts the cursor to the left, which is very annoying. The character is represented correctly when...
Denis Akopyan
1

votes
0

answer
148

Views

Could not load library msvcrt-ruby240.dll

I have install the last version of the x86 version of vim 8 and I have an issue whith the ruby integration. My plugins like LustyExplorer can’t work and when I enter :ruby –version I got the following error : E370: Could not load library msvcrt-ruby240.dll E266 : Sorry, this command is dis...
frantz
1

votes
0

answer
51

Views

vim pymode - sort lint errors and warnings by significance

I was wondering if there is any way to have errors always appear before PEP-8 warnings in the lint output? Either of re-ordering the output or having PEP-8 and other style warnings only reported if there are no errors would work for my needs.
redcartel
1

votes
0

answer
17

Views

Quickfix increases hight when opening vertical window

I have a quickfix for the ctrlP vim plugin. When I decide to open a window vertically (by pressing v) from one of the searches, the height of the Quickfix increases. This keeps happening as I open more windows. How can I solve that? I don't see anything in the configuration to do that.
Hommer Smith
1

votes
0

answer
634

Views

Use vim shortcuts in TeXstudio

I'm using TeXstudio to edit my *.tex files. Is there any way to add vim shortcuts to TeXstudio?
HosseinBeheshti
1

votes
0

answer
88

Views

Vim Latex Suite can't find latex command using Pathogen

Background I was having dual boot issues with Windows 10 and Ubuntu 17.10, which eventually resulted in a boot loop and since I need Ubuntu 16.04.3 for an Operating Systems class I decided to load up an ISO into one of my USBs with Rufus, reformat my Windows partitions from GPT to NTFS to get around...
jfh

View additional questions