Tag Info

New answers tagged

0

From the README: Once you have the shell open, you can then send visual selections to it using the command :ScreenSend. And from :help screen: :ScreenSend Send the visual selection or the entire buffer contents to the running gnu screen shell window. So… V:ScreenSend<CR> or :.ScreenSend<CR>


0

PATH is not a global shell variable that you should expect to be the same for all users. You could make it so but that would be pointless: if you want some program to be usable by every user, install it as root. And… root is used for administrative tasks, not actual work (unless you are a sysadmin but you are not), so don't work as root.


0

The following does what I was hoping for let NERDTreeIgnore=['\.\.$', '\.$', '\~$'] Note: the '\~$' is a seperate regex to ignore the 'tilda-d' backup files generated by Vim, e.g. somefile.text~. This answer copied from Goluptious's answer that was incorrectly written in the question.


4

While :e is the correct answer to the question you asked, if the goal is to tail a log with good scrollback, you can use less. F while viewing a file will scroll Forward, with continuous reloading. From the man page: F Scroll forward, and keep trying to read when the end of file is reached. Normally this command would be used when ...


1

Version 141216 fixes your issue. BTW, your workaround is not needed anymore, but using several keys GuiMacro function is not optimal, better use sort of keys("^[","[","Z") or just print("\e[Z").


0

You should start by defining "scratch buffer" as there's no such thing in Vim. One could create a "scratch buffer" with something like: :vnew | setlocal nobuflisted buftype=nofile bufhidden=wipe noswapfile so you could check for the value of &buftype or &buflisted or any/all of the other options. If that "scratch buffer" was created by some ...


0

I have found a workaround. Unfortunately, it breaks the ability to reverse-tab through file names on the console, inserting ^[[Z instead, so I am still looking for a better answer than this. However, it does make SHIFT-TAB work in Vim without further modification of Vim's configuration. I used ConEmu's macro feature to map SHIFT-TAB in ConEmu to the Vim ...


1

Try install Input Mono Font (v.1.1 or higher) and you don't need patched font. You can grab in http://input.fontbureau.com. Version 1.1 (2014‑09‑03) Added glyphs for Powerline characters        (U+E0A0–E0A2, U+E0B0–E0B3). Added glyph for high voltage sign character ⚡ (U+26A1). Added alternate curly bracket glyphs  for users who prefer ...


1

Instead of pressing ^ you can press _(underscore) to jump to the first non-whitespace character on the same line the cursor is on. + and - jump to the first non-whitespace character on the next / previous line. (These commands only work in command mode, not in insert mode.)


2

Those letters are only there to show you additional information about the item on the left; they can't be used for selection. See :help neocomplete for an explanation. You navigate the default completion menu with <Down> and <Up> and select the highlighted item with <C-y>. See :help popupmenu-keys. Again, read your plugin's documentation ...


0

You need to set mapleader in your ~/.vimrc, before any mappings are defined or plugins loaded. From :help mapleader: Note that the value of "mapleader" is used at the moment the mapping is defined. Changing "mapleader" after that has no effect for already defined mappings.


3

vim is the sucessor to vi. It stands for vi improved. /usr/bin/vi is just a symlink to vim. You can see this with: ls -l /usr/bin/vi To start "classic vi": vim -u NONE myText.txt How it works: vim looks for a config file at ~/.vimrc, if this is found it will run as vim unless the line set compatibility appears in .vimrc. To save editing the .vimrc ...


4

Because Vim is a well-maintained, vi-compatible, Open Source editor, so it is a perfect match for Linux. I've last seen implementations of pure "vi" on proprietary Unixes like SunOS, HP-UX, AIX; you might get "lucky" on BSD, too. (But of course Vim can be installed on those, too.) On Ubuntu, what gets installed by default is a stripped-down version of Vim ...


1

Vim evaluates your expression from left to right, so it first concatenates "Z" and the match, then subtracts 87 from the string (which yields 0). This can be fixed with parentheses: :%s/Z\(\d\d\)/\="Z".(submatch(1)-87)/ To be more explicit (and handle decimal numbers that start with 0), you can throw in str2nr(), like this: ...


1

Ctrl + arrow keys in vim are not assigned: all vim is doing is processing the raw characters. You skip one word to the left/right with the command (not in insert mode, of course) b/w. You can find a cheat sheet for Linux vim/vi editor here.


2

set clipboard^=unnamedplus See :help 'clipboard'. I don't care about clobbering the system clipboard, because there are tools I use to record past clipboard entries. I just want a way to yank to clipboard which is easy enough to perform that I may actually make use of it. Clobbering the system clipboard is precisely a rather big issue with ...


2

To wipe file you may use: $ vim +%d +w file But that’s not a recreation (removing file and creating new one), a file remains the same (same inode). I guess, there is no difference for you, right? If I’m wrong and you need a new file, I’m afraid, you have to use shell and rm: $ rm file && vim +w file


3

Not really. You could do something like this; a compound command line instruction: > myfile.txt && vim myfile.txt The > myfile.txt would wipe the contents of the file—but leave the actual file in place—and the && then ties that command to vim myfile.txt.


1

You could use terminator. Open terminal, split it in half so that you have 2 terminals open. Then open 2 different files using different applications, and use the "broadcast" feature on terminator.


2

You're right, the downside of :cmap is that it applies to all command-line modes, so it prevents you from searching for those strings, too. One solution is to check the type of command-line mode, via an expression mapping: cnoremap <expr> w1 getcmdtype() == ':' ? 'w!' : 'w1' If you're clever, you can do meta-programming and define all your mappings ...


0

v: start visual selection t<space>: go to next occurrence of the input character (in this case )


1

Indirectly, you might get close to what you want by writing to a file and have both vim and your other application setup to autoreload on changes to the file. vim Can be configured to autoreload but it depends on your other application if it offers that functionality.


0

The "sources" to the regular autocomplete (the one you get from Ctrl-N) are taken from the complete option (see :h 'complete') The default is complete=.,w,b,u,t which means . scan the current buffer w scan buffers from other windows b scan other loaded buffers that are in the buffer list u scan the unloaded buffers that are in the buffer list t tag ...


1

You correctly first specified the proper (UTF-8) encoding. This turned the three-byte sequences into a single Unicode character. The ga command can show you codepoint information about the character under the cursor. For “Host”, these are U+201C (Left double quotation mark) U+201D (Right double quotation mark) The problem is that your chosen font ...


1

It was missing: set encoding=utf8 on my .vimrc.


1

This is a perfect use case for macros: qq JJJj q then: 100@q or: :%norm! @q But you can also use your mapping with :normal too: :%norm <C-v><F5> <-- press Ctrl+V then F5


0

For Vim, there's the MPage plugin by the well-known plugin author DrChip. You can specify the number of columns to the :MPage command.


0

I prefer this simple solution: Append set noundofile to $HOME/.vimrc file (if the file doesn't exist, create it). Alternatively, as suggested by romainl, you can also find the set undofile line in you vim configuration files and remove it. There are at least three configuration files for vim: system vimrc file: "$VIM/vimrc" user vimrc file: ...


0

I had similar symptoms, except that it happened for all programs not just vim. The resolution for me was to install a newer version of screen (I was using GNU screen as the backend for byobu.) I installed screen using Macports "port install screen" but I assume any method would suffice. On my system, /usr/bin/screen --version reported 4.00.03 (FAU) ...


4

One option would be to use exe: exe ":function! SomeFunc() \n return 0 \n endfunction" The \n characters are interpreted as newlines by the double-quoted strings. This does mean you should be careful to escape any special sequences. That said, I want to be able to simply copy and paste the function! command and press Enter... As romainl mentioned, ...


0

In Vim, you might be able to :set scrollbind on two windows on the same buffer after setting them up to an appropriate initial configuration. But I've found they don't always stay in sync very well as you edit and move around.


3

After you type : to enter on command mode, or after your insert your command, type CTRL+f. Your history of commands will appear in a new "command-line window". Once there, you could use D from the point where you want to start to delete. Then just type ↩ to execute your command.


2

In Emacs, there's a package to do just that called follow-mode.


1

What you describe as a convention is an honorable goal, at best, but definitely not a convention. Vimmers usually have one or several long-running project-specific sessions with potentially dozens of buffers and short-lived sessions for quick edits. The idea is to keep related buffers together and avoid mixing unrelated concerns. Adding buffers to the ...


0

Magnars (author of EmacsRocks site) wrote this plugin to do exactly what you are asking for. https://github.com/magnars/change-inner.el Obviously, you could also use Evil mode.


0

Just now faced the same problem. Based on bloy's answer and current content of my ~/.profile (actually, it's the same as winchendonsprings') I've solved my problem as follows: ~/.profile: if [[ -z $TMUX ]]; then if [ -e /usr/share/terminfo/x/xterm+256color ]; then # may be xterm-256 depending on your distro export TERM='xterm-256color' else ...


1

If you want to open VIM with the mintty terminal, you could use the following set-up: First create a bash-script with the following: #!/bin/sh FILEPATH=$(cygpath -u "$1"); vim "$FILEPATH" This will convert the windows filepath into a unix-style filepath for cygwin. Place this script (for example) in /bin/native-vim In regedit (regedit.exe) you should go ...


1

You need the DLLs and any corresponding language runtime files (e.g. modules). What you usually do is: Find out which language version your Vim binary has been compiled against (e.g. by observing the Linking: part of the :version output). Download and install a corresponding package of the language. (On Windows:) Ensure that the DLL is accessible to Vim ...


3

In your ~/.vimrc, you can check whether the GUI version is running via :if has('gui_running'). Alternatively, configuration that you put into ~/.gvimrc is only sourced (but at the end!) in GVIM. What you name "themes" is usually called colorscheme, and the variant is selected with the eponymous Ex command. In the general case, you can :runtime (or :source) ...


0

Nothing in the python looks wrong. The only thing you probably forgot was to set let g:ycm_extra_conf_vim_data = ['&filetype'] in your vimrc. This tells YouCompleteMe to pass the filetype to the function. Otherwise kwargs is just empty and you probably fall through the if statements without adding anything.


2

Assuming your file's extension is *.foo… Create these files and directories if they don't exist: $HOME/.vim/ftdetect/foo.vim $HOME/.vim/syntax/foo.vim Put the following in $HOME/.vim/ftdetect/foo.vim: autocmd BufRead,BufNewFile *.foo set filetype=foo Put the following in $HOME/.vim/syntax/foo.vim: syntax match FooKey /^[^=]\+/ syntax match FooValue ...


2

Syntax script Create a file ~/.vim/syntax/simple.vim with the following contents: " Quit when a syntax file was already loaded. if exists('b:current_syntax') | finish| endif syntax match simpleVar "\k\+" nextgroup=simpleAssignment syntax match simpleAssignment "=" contained nextgroup=simpleValue syntax match simpleValue ".*" contained hi def link ...


1

It's possible to create a simple shell function which works as it is reading from stdin (although in fact it is writing to a temporary file then reading that). Here's the code I'm using: # An emacs 'alias' with the ability to read from stdin function e { # If the argument is - then write stdin to a tempfile and open the # tempfile. if [[ $# -ge ...


1

Turns out I needed bind -v in my ~/.editrc. Now it works!



Top 50 recent answers are included