Questions tagged [vimrc]

Vim reads initialization commands from a file called vimrc on startup. This can be used to set settings, define functions, execute autocommands, and more.

Filter by
Sorted by
Tagged with
1
vote
1answer
35 views

Adding new filetypes with vim commentary

I'm trying to add include an unsupported filetype, gf, with vim commentary. The comments are simple, just prepend -- to any line, as in the Haskell tradition. According to the vim-commentary git, ...
0
votes
2answers
61 views

How to disable the quickfix window?

This is the display when I typed :AsyncRun -mode=term -pos=bottom ~/.anaconda/bin/python %. But if I set: filetype plugin on map <F5> :call RunPython()<CR> function! RunPython() exec &...
0
votes
1answer
30 views

prevent changing background color on pressing tab and arrow keys

when I press the tab key or top arrow when I am in the first line, bottom arrow when I am in the last line, right arrow when I am at the end of the line and left arrow when I am at the start of the ...
0
votes
2answers
73 views

vimrc is too large! any way to create a table of contents

my vimrc is too large, search and modification for me is a bit pain. Is it possible to have a table of contents so that I can jump to the section faster?
0
votes
1answer
21 views

Literal character escapes in VimL string

I'm trying to use vimlsp server to help me write VimL, but it is prevented for me due to a parse problem with a literal carriage return (^M) char inside this code: function! ChompCtrlM(string) ...
1
vote
1answer
23 views

Syntax Highlight Problem for Latex/Tikz

I have a tikzpicture inside a latex file. My problem is that when I open the file and jump with GG to the end of the file, the math environment inside the tikz-nodes is not highlighted (e.g. $v_0^1$)....
0
votes
0answers
30 views

How to call a user-defined function at startup

I've defined the following tail command to execute on a log file: " syntax highlighting for log files autocmd bufnewfile,bufread *.log set syntax=logtalk " tail files with command :tail ...
1
vote
1answer
18 views

Activating a -c command

I'm having a tough time passing this command into vim at startup: $ vim sql_actions_avails.log \ -c 'set ut=100 | set autoread | au CursorHold * checktime | call feedkeys("G")' This ...
1
vote
0answers
16 views

system function puts extra characters onto stdout [duplicate]

I just updated to the latest vim (git fetch && git merge origin/master followed by building and installing to /usr/local/...). Everything is great except with a little extra stuff I added to ...
0
votes
0answers
21 views

map custom vim keybindings to NerdTree

I am almost new to the vim and I have this key mappings inside nvim config. that I want to be able to use inside NERDTree but I can't found a way. nmap <c-j> 4j ...
0
votes
0answers
21 views

Improve a repetitive copy-paste like pattern

To create new classes and data-related objects I find myself often doing the following pattern -- where I copy paste a 'base line' and then I need to update one or two values, for example: Here is a ...
0
votes
1answer
52 views

What's the best way to configure vim to unzip files with 7zip

In an answer to this particular question it said that it's enough to have unzip installed and available to make vim to unzip files on the fly. However what wonders me is there any way to configure vim ...
3
votes
1answer
59 views

Folding example from Learn Vimscript the Hard Way not working?

I'm reading Learn Vimscript the Hard Way - Chapter 18, which is also about folds. I'm surprised to see that copying the sample code " Vimscript file settings ---------------------- {{{ augroup ...
-1
votes
2answers
46 views

Get GUI name for different settings in neovim

I am deciding between using either goneovim vs neovide, both on windows, but each uses the font height differently, so I a wanted to make something like: if has(goneovim) "goneovim specific ...
1
vote
2answers
78 views

Compilation keybinds for different filetypes in vimrc

I am trying to create some keybind "scripts" for specified file types in my .vimrc. Example : au BufNewFile,BufRead *.cpp \ nnoremap <C-P> :!g++ % -o %.exe <CR> Ideally I ...
0
votes
0answers
30 views

after compilation in Vim : cursor in gg

I'm french... sorry for my english I try to compile files (.tex, .md ... using vim). I open terminal and make the compilation ; just before the compilation i save the file and put a marker in the ...
0
votes
1answer
26 views

How to format import {} from '' as multiline?

How do I un-join(?) or add trailing whitespace with indentation? With this code,,, import { amethod, methodb, methodc } from '../../utils/mockData'; how do you make this import { amethod, methodb,...
1
vote
3answers
60 views

How to make a shortcut to activate and deactivate multiple maps?

I know there are questions/answers to execute commands with a single shortcut, but in my case I can't think how to do multiple maps with a single shortcut in Insert Mode. In other words, what I want: ...
1
vote
0answers
33 views

Typing colon character in Insert mode undoing changes?

I am really curious as to why this is happening. I have this line in my .vimrc file (I am using WSL2 on windows and this line helps support copying from vim to the system clipboard): set clipboard=...
1
vote
1answer
41 views

how to yank two level up bracket inside vim

I have a paragraph in this structure { // line 4 { //something in here { // line 8 // some inner thing in here } } // line 12 } my cursor is in line 8 and I want to yank ...
0
votes
1answer
29 views

Adapt side panels to different screen resolution (aspect ratio)

How can I adopt side panel plugins (TagBar, TagList, NerdTree, etc) width to current screen aspect ratio? Using Vim with many different computers makes me a bit trouble to write one portable config ...
-1
votes
1answer
118 views

How to compile a program and open the output in a vertical terminal window?

How can I write a command that does the following? With one mapping, compile and/or run a program based on the filetype (*.c, *.cpp, *.js, *.py, etc.), and open a vertical terminal window with the ...
1
vote
0answers
33 views

When re-sourcing vimrc, the highlight commands following the colorscheme choice are lost [duplicate]

Given this ~/.vimrc syntax on colo pablo set cul hi CursorLine cterm=bold ctermbg=NONE ctermfg=NONE gui=bold guibg=NONE guifg=NONE hi String ctermfg=red Do the following: open a file, possibly ...
2
votes
2answers
133 views

Vim syntax partial match

I'm trying to match a new line character on a Vim syntax file, I can make it work when I use the patern within Vim but when I put it in my syntax file it doesn't highlight when I have a new line and ...
1
vote
1answer
26 views

How to invoke Linux shell env variable into vimrc?

How to invoke Linux shell env variable into vimrc ? I split vimrc configurations into multiple files and included these files in vimrc via :runtime [file]. This works well. :runtime vimrc.d/vimrc....
0
votes
0answers
33 views

Why session in Vim did not save buffer from other folder rather than ~?

I use gVim on windows and save my current working files to session. However, when openning old session, it did not load files from other folder except home folder ~ (where I store my _vimrc file). My ...
0
votes
1answer
40 views

Command not working when mapped

I've mapped CTRL+Meta+n to :split | resize 15 | term. This command works when run from Vim, but when I put the command in my .vimrc, on Vim startup, I get the following error: zsh:1: parse error near '...
1
vote
1answer
162 views

How to map a key for a specific file

We can use the FileType autocommand event to create a customized key mapping for a specific type of file. For example, Spaceb could call different build tools for a Java file compared to a C++ file. I ...
2
votes
1answer
40 views

Embark colorscheme not working properly

I have installed embark using vim-plug. I have put it inside my vimrc. But everytime I open vim, it shows this error Error detected while processing /home/pial/.vim/vimrc: line 9: E185: Cannot find ...
0
votes
0answers
25 views

C# neomake linter

I would like to use nvim more for C# however I am having a maker error I can't fix. My Omnisharp didn't work either but I still have 'YCM' as a backup for now. The MSBuild in my path is from the VS ...
0
votes
1answer
45 views

Vim Fugitive not loading

I have recently been trying to separate my neovim config into multiple files. After moving everything involving vim-fugitive and vim-gitgutter into a separate file, git-gutter is not loading and I ...
1
vote
1answer
89 views

How to toggle relative number for all opened windows?

I have this in my .vimrc: nnoremap <C-a> :set relativenumber!<cr> This toggles the relative number feature only in the current window. Is it possible to toggle it in all opened windows ...
1
vote
1answer
30 views

Is there a function which returns the filepath at the cursor?

I'm looking for a function(probably doesn't exist) which can return the filepath under the cursor. I know that there is a command/shortcut gf that helps me jump to that file if the file exists. But I ...
2
votes
1answer
21 views

Vim autocorrection problem

I am having a problem with vim autocorrection. I got this line from a website, which is: inoremap <C-l> <Esc>[s1z=`]a The problem is that whenever I press Ctrl+l to correct something, it ...
0
votes
2answers
40 views

Vim+Tmux unfocus airline when switching away

I'm using Vim with tmux and I wanted to know if there was a signal or something to 'deactivate' the vim window (like when you switch between vim windows) but also when you switch between Vim and Tmux. ...
1
vote
1answer
113 views

Vim-latex not starting automatically for .tex files

I have Vim on Ubuntu 18.04 and I am trying to use the vim-latex package. By typing :set rtp? on Vim I get the following output: runtimepath=~/.vim,~/.vim/pack/bundle/start/vim-latex-1.10.0,/var/lib/...
2
votes
1answer
44 views

Finding where one word is close to another word: parametrized command in vimrc

I asked this question, about how to find where one word is close to another word, and Quasimodo gave the very fine answer: /\vaid(\W+\w+){,3}\W+country Now I want to parametrize this command into ...
3
votes
1answer
66 views

Setting vim spelllang for Italian

I need to enable the spelllang of vim for Italian as well, but I can't understand how to tell vim to check for Italian words as well. This is what I have in my init.vim, if it can help you: I tried ...
0
votes
0answers
36 views

Displaying sloc (source lines of code)

Is there a plugin that can display sloc? I have searched every where and all I get is how to display total lines or how to show line numbers...
3
votes
1answer
50 views

How can I make a new line in my _vimrc after using the normal i command?

I'm very new to Vim and I have some ASCII art in my _vimrc. I've inserted it there using normal i, but it doesn't display properly, because the normal i commands don't have a line break at the end. I'...
2
votes
0answers
34 views

gvim on ubuntu breaks the console when calling system command in vimrc

I use this version VIM - Vi IMproved 8.2 (2019 Dec 12 kompiliert am Aug 29 2020 14:11:37) Inklusive der Patches: 1-1539 Verändert von jonathon.fernyhough@york.ac.uk Übersetzt von jonathon.fernyhough@...
0
votes
1answer
30 views

How do I turn off specific listchars in my current file?

In my .vimrc file I have listchars set to showing tabs and trailing spaces. set listchars=trail:~,tab:>- How do I change my settings for the file I currently have open to stop showing the tabs?
1
vote
1answer
40 views

Vim filter command not using line-wise selection

I may have seen this question before on Vi Exchange but I'm having trouble locating it while searching now. If it's already been answered, please let me know the duplicate and I can find that. I have ...
5
votes
1answer
76 views

How often and when is foldexpr evaluated?

I want to toggle foldmethod between expr and manual because if we always set foldmethod=expr, then the cursor tends to move slowly in vim. I think that foldexpr is evaluated just after switching ...
2
votes
1answer
27 views

Required to write gvimdiff file1 ..\..\..\file2 to diff correctly

I'm trying to diff two files using gvimdiff file1 file2. This works in certain parts of my file system, but if I'm several directories deep, it stops working. Instead, it'll open three files and one ...
3
votes
2answers
39 views

Is there a way to insert documentation comments into a VIM macro definition?

I have found VI / VIM macros extremely obtuse to understand even a week after I've written them. The syntax of a .vimrc file supports comments on lines beginning with a doublequote character (") ...
2
votes
0answers
94 views

YouCompleteMe unavailable: unable to load Python [duplicate]

I have done PlugInstall but it gives: YouCompleteMe unavailable: unable to load Python. The same error happens while loading UltiSnips: E370: Could not load python36.dll My vimrc: set rnu set nu ...
0
votes
1answer
27 views

map jump shortcut for Vim insert mode

I wan't to map jump shortcut for insert mode such as imap <A-w> <Esc>wi imap <A-b> <Esc>bi Even though <A-b> works perfectly. <A-w> appear to not work properly. ...
1
vote
1answer
84 views

get vimrc or init.vim defined by -u switch in vim/neovim

According to :help starting, we can specify a specific vimrc file using the following command $ vim -u /path/to/vimrc How can I access the path of that vimrc/init.vim file in vim/neovim? I have ...
2
votes
2answers
87 views

VIM mouse scrolling on Konsole show ^[OA at the top and ^[OB at the bottom of the page

function! GitBranch() return system("git rev-parse --abbrev-ref HEAD 2>/dev/null | tr -d '\n'") endfunction function! StatuslineGit() let l:branchname = GitBranch() return strlen(l:...

1
2
3 4 5
28