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
votes
0answers
23 views

Syntastic Plugin: When opening Python files the syntax isnt highlighted unless i open it with with sudo

When i open vim with sudo vim Example.py Syntastic highlights keywords in my Python code which is what i want but, If i use vim Example.py then it wont highlight anything. I know that opening vim ...
0
votes
0answers
30 views

Reset state of a file

I know that vim retains some meta information about a file (like cursor position before you last closed it, file type if you have manually set it) How can I reset this information? I'm in a very weird ...
1
vote
0answers
10 views

SupperTab support list UltiSnips snippets

I install the SperTab and UltiSnips plugins. I want to integrate SuperTab and UltiSnips but fail. Here is an example snippet numpy "import numpy" bw import numpy as np endsnippet snippet nu ...
0
votes
1answer
25 views

set clipboard=unnamedplus not wok

I am a newbie in vim and I added set clipboard=unnamedplus in .vimrc but doesn't work , in my previous os, I had the same problem and I fixed it by reinstalling vim using source and adding some extra ...
1
vote
1answer
19 views

how to map the Y key (shift + y) to copy from the current cursor position instead of copying the entire line?

I would like to map the shift+y key to move the cursor one position to the right, press the y key and wait for the move command. Similar to the operation of the p key. When used without the shift, the ...
0
votes
2answers
26 views

How can I make a mapping to toggle cursorbind?

I know that adding a ! to the end of an option works for some commands, but it doesn't work for cursorbind. How can I toggle between cursorbind and nocursorbind with a keybinding?
2
votes
1answer
21 views

automate substitute in Visual mode

I would like automating the following in my .vimrc: :'<,'>s/ \+| \+/|/g With something like the following but it does not work: vmap <Leader>rt :s/ \+| \+/|/g<CR> it seems the ...
1
vote
1answer
16 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
49 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
27 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
63 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
18 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
22 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
27 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
17 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
0answers
19 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
53 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
36 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
65 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
23 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
52 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
30 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
27 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
99 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
108 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
32 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
135 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
35 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
18 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
35 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
78 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
25 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
20 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
38 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
95 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
42 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 ...
2
votes
1answer
37 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
26 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
46 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
27 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
23 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
35 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 ...

1
2 3 4 5
27