w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
  Home » VIM » Page 1
How do I remove non-duplicate lines in Vim?
if you were on Linux box, give this line in vim a try: :%!awk 'a[$0]++' If you are looking for pure vim/vimscript solution, you could build a dictionary in vim, key is the line text, value is how many times the line occurred in buffer, finally filter out those value ==1 entries. read doc for :h dict :h filter(

Categories : Vim

Cannot remap in Vim
You can check where this got defined via :verbose map <F5> It seems to be from this line in the ruby-menu plugin. That plugin should offer <Plug>-mapping targets that would allow you to change the mapped keys, or disable the mapping altogether. You could file a defect against it. The plugin overrides your mapping, because by the time the plugin loads, your .vimrc already has finish

Categories : Vim

how to set up brace autocompletion in vim?
Have a look at the Automatically append closing characters page on the Vim Tips Wiki. It describes some simple setups, and has a list of plugins that offer this functionality. I personally use the AutoClose plugin, but only occasionally, as I don't find this functionality very helpful.

Categories : Vim

Wrong Indentation when edit Yaml in VIM
Install this plugin: https://github.com/chase/vim-ansible-yaml It is made with Ansible in mind, but in theory it will work with all kinds of YAML files. You will have to :set filetype=ansible unfortunately, if you are not working with ansible related files.

Categories : Vim

How do I link highlighting groups in a vim colour scheme?
Make sure you're clearing the settings for ErrorMsg before the link, otherwise the link will fail. highlight Error ctermbg=161 highlight ErrorMsg NONE highlight link ErrorMsg Error

Categories : Vim

Vim netrw copy commands
Mark the file you want to copy: mf Mark its target directory: mt Copy the file: mc It looks like copying a directory isn't possible in my version.

Categories : Vim

Vim: can indentation use spaces after non-whitespace?
Use :set expandtab. This will expand all tabs to spaces, during insert, even the ones at the beginning of the line (which probably is the best). Use CTRL-V<Tab> to insert a tab. From vim help (:help expandtab) 'expandtab' 'et' boolean (default off) local to buffer {not in Vi} In Insert mode: Use the appropriate number of spaces

Categories : Vim

I have <`0`> with Vim-Latex, what is it?
I get rid of spf13. It's totally a black box. However, it's a good Bundle list and template for reference. The pattern I mentioned in the question comes from neocomplete. To jump to each numbered block, just press: < C-k >.

Categories : Vim

Vim how can I move text into a set of parentheses?
Assuming you are in insert mode: " first example <Del><S-Right><S-Right><S-Right>) and: " second example <Del><S-Right><Del>) Assuming you are in normal mode, with the cursor on the closing parenthesis: " first example x$p and: " second example xeplx

Categories : Vim

select mode mapping issue
The help for select mode (:help Select-mode) says: Printable characters, <NL> and <CR> cause the selection to be deleted, and Vim enters Insert mode. The typed character is inserted. I don’t see any other case where a command in select mode ends by entering insert mode (although of course I could be missing something). So this could be a peculiarity of the plugin, but it

Categories : Vim

Vim change list behaviour
In the default Vim on Mac OS X (7.3 Normal version without GUI, no patches), g; moves the cursor to the c in chips and the output of :changes is different from yours: change line col text > 0 1 16 I like fish and chops. The fact that only one change is remembered is consistent with this paragraph from :help g; When two undo-able changes are in the same line and at a column position

Categories : Vim

key map to call function in a plugin
If you look at the plugin's source, that's the name of the command; the underlying function is named differently: command! -range ExecuteSelection call ExecuteWithShellProgram("selection") So, I'd recommend to use the (public) command in your mapping. vnoremap 1 :ExecuteSelection<CR> (You should use :noremap; it makes the mapping immune to remapping and recursion.) PS: Are you sure yo

Categories : Vim

Follow link in vim with markdown syntax
Try gx when your cursor is over the link. netrw should open the link with the external handler (see :h netrw-gx) which in Mac OS X will be open.

Categories : Vim

meaning of "command" prefix and suffix of "!"
:!command executes external command command. :command! executes internal command command with a "bang" that usually modifies its behavior. So… :!ls executes your shell's ls command, which lists the files and directories in the working directory. See :help :!. :ls! executes Vim's ls command in a way that forces it to show listed and unlisted buffers. See :help :ls.

Categories : Vim

prevent vim preview window from closing
The default behaviour of neocomplete is to auto-close the preview window but it is configurable. Add this to your .vimrc: let g:neocomplete#enable_auto_close_preview = 0 You will need to manually close the preview window with :pclose or <C-w>z See :h neocomplete.txt

Categories : Vim

Vim specific mkview and loadview in order to avoid issues
You should probably configure :set viewoptions-=options (Same recommendation for 'sessionoptions'.) As long as you don't define mappings on-the-fly, this isn't necessary, and it causes the problems you've described with capturing plugin mappings (that would get redefined by the plugin, anyway).

Categories : Vim

Reference selection in Vim command mode to pass on to terminal
You are probably looking for the marks '< and '>: :'<,'>sort If you just select a few lines and hit : to enter the command line these marks should appear automatically.

Categories : Vim

Vim: bold highlighting only after reload solarized color scheme
I have found an workaround: Put colo solarized in /usr/share/vim/gvimrc solved the problem. Initially, I thought some script loaded between solarized.vim and gvimrc might have conflicted with the bold setting of solarized.vim. But It seems not the case, because I've tried putting colo solarized in every script between them (based on output of :script), which has no effect. Strangely, It only wo

Categories : Vim

Vim: How to turn off splitting
You can: avoid any commands that create window splits configure Vim to minimize creation of splits (e.g. :set switchbuf-=split), additionally define :autocmds that check for created splits and :tabedit them instead but you won't succeed in totally getting rid of them. For example, the preview and quickfix windows were designed to be viewed in a window split, and you won't get much value out of

Categories : Vim

Getting fakeclip plugin to work with Vim and tmux
Solved the problem by loading plugins using vim-pathogen: Installed Pathogen to ~/.vim/autoload/pathogen.vim Installed fakeclip to ~/.vim/bundle/ Added this to .vimrc execute pathogen#infect() syntax on filetype plugin indent on

Categories : Vim

Why does `let` modify the value it assigns?
Copy some text into registers using v, V, and <c-v> visual modes to see how Vim handles each situation. To force a specific mode (I am going to assume v) use setreg(). :call setreg('a', '^M', 'v') For more help see :h setreg(

Categories : Vim

In vim netrw using mf, how to highlight file with name starting by '.' dot symbol?
It was a bug, as mentioned in romainl comment. Fixed by updating vim with $ sudo add-apt-repository ppa:fcwu-tw/ppa $ sudo apt-get update $ sudo apt-get install vim

Categories : Vim

Vim commands containing `r` cause me to replace
It seems that your mapping is not being interpreted by Vim, so it only sees the Ctrl-c, which by default aborts the current action, then the replace command r (see :help r) followed by its "argument". You could check if the mapping is defined with :map <c-c>. If it is correctly defined it may be that your terminal is handling the Ctrl-c directly and not passing it to Vim, as stated in Vim

Categories : Vim

Error when pattern search in netrw
Netrw is not a very good tool for what you seem to be trying to do. If you are trying to recursively find all files in the current directory that contain foo, try :grep or :vimgrep: :grep foo **/* | cw :vim bar **/* | cw

Categories : Vim

Detect background vim after :sh
You should have an environment variable set called VIM, you can see if this is then set $ echo $VIM Note, it's also possible (unlikely) that $VIM is set when you're just in your shell normally.

Categories : Vim

Returning to Normal Mode from Insert Mode after "execute normal"
If you really need this (the use case is dubious), you have to :execute twice: once to get the contents of the register inserted into a double-quoted string, and then once for the :normal to evaluate the string. :execute 'execute "normal" "' . @z . '"' PS: Please give more background; what is your final goal? When a question is only about a small technical step, it's difficult to provide a good

Categories : Vim

Completion before and after word vim
The built-in completions always offer matches that start with the completion base. However, you can write a custom completion that implements different strategies. If your dictionary is a loaded buffer (not the built-in dictionary completion :help i_CTRL-X_CTRL-K), my CompleteHelper plugin makes it easier to implement the extraction of matches. With it, the BidiComplete plugin offers something re

Categories : Vim

tilde-at-tilde character in vim
The reason is I was using the "new" google docs, which has a feature called "smart-quotes" enabled by default. This replaces your normal double-quote character with some special character code for opening quote, and a different one for closing quotes. You can disable it in (Tools -> Preferences -> Smart Quotes) https://support.google.com/docs/answer/57859?hl=en

Categories : Vim

Using variable in vim key mappings
I got bad news. You can not map <c-1>, etc. You can only bind <c-6> which I wouldn't do as it is very handy. It also seems like you are doing a heavily tab centric workflow. I know it might sound weird but maybe use less tab panes and more buffers. Here are some nice posts about it: Why do Vim experts prefer buffers over tabs? Use buffers effectively! ... Ok, but I really want to

Categories : Vim

clang complete add path to includes
To investigate, run your gcc (or clang) with the -v option. This will display the search path used while compiling. On my system (FreeBSD) a simple compile without -I options prints #include "..." search starts here: #include <...> search starts here: /usr/include/clang/3.4.1 /usr/include End of search list. That should give you an idea what directories to add to .clang_complete. Import

Categories : Vim

Make vim see # as a part of a word
What belongs to a word is controlled via the 'iskeyword' option. To do this just for the current file: :setlocal iskeyword+=# If this is for a particular filetype, put this into ~/.vim/after/ftplugin/<filetype>.vim. To change the global default, use :set in your ~/.vimrc, but be warned that this can affect syntax highlighting.

Categories : Vim

Key-specific timeoutlen in vim
There's nothing built-in. With regards to your mapping, you probably mean :inoremap jj <Esc>, and for that to apply quickly, you just need to ensure that there are no other insert mode mappings that start with jj. To avoid that the first j appears only with a delay, you could use :autocmds to toggle the 'timeoutlen' value: :autocmd InsertEnter * set timeoutlen=200 :autocmd InsertLeave * set

Categories : Vim

vim-go deleting unused code when write to disk
This is because you're using goimports as the tool to use when formatting your go code (I think vim-go does this by default - and it formats code on save by default). goimports removes unused imports for you .. thats why its so great. You will learn to love it at some point :) For now, what you want to use is gofmt to format your code, which doesn't touch imports - it only formats the code. You c

Categories : Vim

How to get vim-rails' :Rake to run bin/rspec?
When editing a spec file, vim-rails' :Rrunner invokes bin/rspec directly, thus producing the same output & errors as when run by guard. vim-rails' :Rake invokes bin/rake spec SPEC=..., which ends up invoking the ruby and rspec paths as shown in the question -- thus the different environment, errors, & output than the spring-ified bin/rspec or spring rspec as run by guard.

Categories : Vim

YCM g:ycm_semantic_triggers doesn't work
For future reference: g:ycm_semantic_triggers does not work as one might expect. It does not check if the text up to the cursor matches, however it checks if the code up to where the current identifier (as defined by this regex (or one of the language specific regexes)) starts. So to start the semantic checker on every character, do something like (this actually starts the checker after only 3 cha

Categories : Vim

vim syntax performance with very long lines
vim-pandoc makes extensive use of syntax folding and I'm pretty sure that is the issue. Disabling vim-pandoc-syntax and turning off folding (let g:pandoc#modules#disables = ['folding']) makes vim fast again. For syntax highlightin I've used my fork of tpope's vim-markdown. I've forked it because the original does not syntax highlight code blocks with pandoc style attributes (pull request here).

Categories : Vim

How to use an external command in Vim to modify the selection
:'<,'>!command '<,'> represents the (linewise) visual selection and is automatically inserted when you hit : and have something selected. Example: If you select a line containing: print("Hello!") and run the Vim command: :'<,'>!python the text will be replaced with Hello!. If you want to set this to a key-binding (F5 to evaluate for example) vnoremap <F5> :!python&

Categories : Vim

Is it possible to toggle move by display lines when wrapping is enabled with the Vintageous plug-in for Sublime Text?
You can create a configuration file at packages/user/.vintageousrc, and then add the following mappings: :map j gj :map k gk Save the file, and then I had to restart sublime text.

Categories : Vim

How to change multiple lines with vim?
You can operate on the visual selection by typing ":" e.g. (after visual selection) :s/d/h/ More info at http://vim.wikia.com/wiki/Search_and_replace_in_a_visual_selection

Categories : Vim




© Copyright 2018 w3hello.com Publishing Limited. All rights reserved.