vim

How to get different colorschemes in Vim split window?

不打扰是莪最后的温柔 提交于 2019-12-19 10:04:32
问题 I prefer having different colorscheme for python and different for rest of the files. So, what I did is added the below two lines in my vimrc : "for python file autocmd! BufEnter,BufNewFile *.py colo badwolf autocmd! BufLeave *.py colo badwolf "for rest of the files colo molokai Everything works fine when I open a new/pre-exixting file in vim using vim test.py but problem occur when I split my vim window into two using :split .scripts/test.sh . What happens is after splitting the window when

Alternatives for reopening buffers from last session in VIM?

感情迁移 提交于 2019-12-19 09:57:16
问题 I know :mksession , and I use it, but sometimes, it's too much, it saves too much state, which is a problem, for example, when you update some plugins, and want to close/open VIM to start it in a fresh state, except you want to preserve the state for the current opened files, solely. Sometimes what :mksession saves conflicts with the new updated configuration, prevents from loading parts of it, etc. So, what are good alternatives (maybe including plugins) for reopening VIM and loading last

Alternatives for reopening buffers from last session in VIM?

会有一股神秘感。 提交于 2019-12-19 09:57:01
问题 I know :mksession , and I use it, but sometimes, it's too much, it saves too much state, which is a problem, for example, when you update some plugins, and want to close/open VIM to start it in a fresh state, except you want to preserve the state for the current opened files, solely. Sometimes what :mksession saves conflicts with the new updated configuration, prevents from loading parts of it, etc. So, what are good alternatives (maybe including plugins) for reopening VIM and loading last

Call bash function using vim external command

走远了吗. 提交于 2019-12-19 09:44:46
问题 I use vim's :! external command function all the time, usually providing % as an argument to the shell command. For example : :!psql -f % I also have a lot of bash shell functions in my .bashrc that I use. For example: psql-h1 () { /usr/bin/psql -hh1 -d mydb "$@" } These bash functions aren't available from :! inside of vim. Is there a way to make them available? 回答1: Export your functions. That is: psql-h1() { /usr/bin/psql -hh1 -d mydb "$@"; } export -f psql-h1 ### <-- THIS RIGHT HERE This

configure gvim setting color and font

梦想与她 提交于 2019-12-19 09:19:52
问题 I want to try out vim, but have a little trouble with the config file. I have installed gvim here C:\Program Files (x86)\Vim\vim73 and added a file called C:\Program Files (x86)\Vim\vim73\.vimrc , but when I try different configurations it does not seem to change anything. I tried this one for example """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" " Maintainer: amix the lucky stiff " http://amix.dk - amix@amix.dk " " Version: 3.6 - 25/08/10 14:40:30 " " Blog_post: " http:/

How to display all results of a search in vim

∥☆過路亽.° 提交于 2019-12-19 09:09:45
问题 When searching string with notepad++, new window opens and shows find results. I want to use this feature in vim. After googling I found out some suggestions: vimgrep /<pattern>/ % copen It is possible to create mapping which do those two commands. Pattern should be the current word: may be cword keyword in vim? 回答1: The requirement is actually easy. but to get user inputted pattern, you need a function. function! FindAll() call inputsave() let p = input('Enter pattern:') call inputrestore()

How to display all results of a search in vim

别说谁变了你拦得住时间么 提交于 2019-12-19 09:09:07
问题 When searching string with notepad++, new window opens and shows find results. I want to use this feature in vim. After googling I found out some suggestions: vimgrep /<pattern>/ % copen It is possible to create mapping which do those two commands. Pattern should be the current word: may be cword keyword in vim? 回答1: The requirement is actually easy. but to get user inputted pattern, you need a function. function! FindAll() call inputsave() let p = input('Enter pattern:') call inputrestore()

gvim pathogen issues

空扰寡人 提交于 2019-12-19 09:03:24
问题 I downloaded pathogen.vim from github and put it in "autoload" directory under ~/.vim. However now when I fire up gvim, and do :helptags, it says "Argument required". The contents of my ~/.vimrc file are: call pathogen#runtime_append_all_bundles() call pathogen#helptags() What am I missing? Thanks. Andy PS: I am doing this so that I can install Nerdtree --- EDIT 1 --- Based on what I have seen so far, the pathogen.vim plugin from github did not work for me, so I had to download it from vim

vim: delete display lines instead of physical lines

两盒软妹~` 提交于 2019-12-19 08:53:37
问题 When vim wraps long lines between words regular movements like j and k will jump from one physical line to the next. Mappings like "nnoremap j gj" as suggested here will do the trick of moving the cursor by display lines instead of physical lines. There's at least one problem with this approach though. For example, dj will delete two physical lines instead of two display lines. Is there a way to fix this? 回答1: dd and yy: :nnoremap dd g0dg$ :nnoremap yy g0yg$ 回答2: Yes. Just use :noremap j gj

vim quickfix avoid buffer change

*爱你&永不变心* 提交于 2019-12-19 08:10:52
问题 I'm using vimgrep with cw to open the search results in the quickfix buffer. Every time I select a line in the quickFix list the cursor shifts to the new file buffer. How do I avoid this and keep my cursor in the quickFix list always? 回答1: Assuming you are using <CR> to "select a line in the quickFix list", you can simply remap <CR> in the quickfix window so that you come back to the previous window after jumping to the matching line. Make sure you have filetype plugin indent on and add the