vim

Julia syntax highlighting in julia-vim

若如初见. 提交于 2021-02-07 05:14:52
问题 I use gvim with julia-vim for editing julia code. I am using julia 0.5 on a mac and installed julia-vim with vundle. My problem is that files with the .jl extension do not have appropriate highlighting. For example, if is highlighted but for is not. Any solution for this? 回答1: .jl files are sometimes recognized as lisp files by default, (blame Sawfish) so that's probably the syntax highlighting you're getting. (type defun and progn and etc and see if the pretty colors pop up) You were close

How to map mac command key in vim?

痞子三分冷 提交于 2021-02-06 14:58:46
问题 I want to map my NERDTREE toggle to Cmd + space but I don't know what character represents Mac's command key in .vimrc. I searched and found that we can use 'D' to represent cmd key from this link, but it doesn't work. BTW I am using vim from the terminal not MacVim. 回答1: It is true that <D- maps to command key. You can see it by :help <D- . However, this will not work in your vim + terminal . It only works in MacVim . See here The best shot for your intention is to map the combination as hex

YouCompleteMe, header files

南笙酒味 提交于 2021-02-06 11:46:11
问题 I am working with some C++ header files using YouCompleteMe. The header file does not include all the other header files that it needs in order to find all the classes it is using. Without modifying the header file, can can I modify my .ycm_extra_conf.py file to have clang know about the additional header files it needs? As an example, suppose I have three files "A.h", "B.h", and "C.cc". C.cc #include "A.h" #include "B.h" A.h class A {}; B.h class B : A {}; The B include file cannot compile

how to edit text in multiple columns in vim

家住魔仙堡 提交于 2021-02-05 12:52:41
问题 How can I edit my code in Vim by displaying it in any number of columns? My laptop and desktop monitors are widescreen (I suspect that is true of most monitors made in the last 5 or 10 years!). When I open any editor in full screen, more than half the screen is completely empty. I'd like to be able to effectively use the rest of the screen by splitting it into two or three columns so I can see all much more of my code in a single screen. Frankly, I'm surprised that other than Microsoft Word,

Reading gnu-screen logs with vim

隐身守侯 提交于 2021-02-05 08:14:49
问题 Recently I've discovered a wonderful terminal multiplexing tool called gnu-screen. I'm satisfied with it completely. But I've encountered one inconvenience I'd like to improve. 'C-a H' command makes screen log everything to a log file called named 'screenlog.*'. But encodes control characters in a weird way. For example if you open the log file with 'less' you might see some cryptic characters and the log file is unreadable. You have to run 'less -r' or 'less --raw-control-chars' which helps

Vim: how to restore the cursor's logical and physical positions?

核能气质少年 提交于 2021-02-04 14:46:10
问题 How to restore the cursor's "logical" and "physical" positions when I open a file ? That's: the cursor should be on the last-time logical line in the file. the cursor should be on the last-time physical line according to the vim window I've notice this post. It does put the cursor on the right logical line. But the cursor physical position in the window is the first line or the middle. UPDATE : The solution is mkview and loadview as noted by @sehe. To make it work with other plugins (in my

Expand tabs to spaces in vim only in python files?

只谈情不闲聊 提交于 2021-02-04 09:57:25
问题 How do I have the tab key insert 4 spaces when I'm editing "*.py" files and not any other files? Following a recommendation from Vim and PEP 8 -- Style Guide for Python Code, I installed vim-flake8 (and vim-pathogen). This gives warnings when PEP8 style guidelines are violated. This is great, but I would for tabs to be expanded automatically in the first place when editing python files. I would like to have tab key actually insert tabs when editing other types of files. In other words, I want

Expand tabs to spaces in vim only in python files?

限于喜欢 提交于 2021-02-04 09:57:20
问题 How do I have the tab key insert 4 spaces when I'm editing "*.py" files and not any other files? Following a recommendation from Vim and PEP 8 -- Style Guide for Python Code, I installed vim-flake8 (and vim-pathogen). This gives warnings when PEP8 style guidelines are violated. This is great, but I would for tabs to be expanded automatically in the first place when editing python files. I would like to have tab key actually insert tabs when editing other types of files. In other words, I want

vim highlight current occurence of search pattern differently than `hlsearch` to help find cursor position quickely

送分小仙女□ 提交于 2021-01-29 20:31:22
问题 Lets say I search using /plug now if the hlsearch is on vim will highlight all the occurrence of keyword plug now if my cursor is on the 2nd occurrence I want to highlight that differently so that i can quickly find where my cursor is for example you can see in the following image it hard to quickly find the cursor position 回答1: The vim-searchlight will highlight the current search match. It does this without any mappings and works with popular plugin vim-cool. There others as well: vim

How to sort a dictionary items in vim

雨燕双飞 提交于 2021-01-29 15:39:09
问题 How to use sort function in vim script to sort a dictionary?. The help documentation doesn't seems to provide clear information on how a particular element in the dictionary can be sorted. For eg: I am getting the quickfix items by calling getqflist(). How to sort this quickfix dictionary items with respect to line numbers? 回答1: Define your comparison function, save result of the getqflist() to a variable and call sort(v, f) Example: function! LineLessThan(leftArg, rightArg) if a:leftArg[