1、编辑vim ~/.vimrc

vim ~/.vimrc

" Use Vim settings, rather then Vi settings. This setting must be as early as

" possible, as it has side effects.

set nocompatible

" Highlight current line

set cursorline cursorcolumn

" Leader

let mapleader = ","

set backspace=2 " Backspace deletes like most programs in insert mode

set nobackup

set nowritebackup

set noswapfile " http://robots.thoughtbot.com/post/18739402579/global-gitignore#comment-458413287

set history=50

set ruler " show the cursor position all the time

set showcmd " display incomplete commands

set incsearch " do incremental searching

set laststatus=2 " Always display the status line

set autowrite " Automatically :write before running commands

set confirm " Need confrimation while exit

set fileencodings=utf-8,gb18030,gbk,big5

syntax on

if filereadable(expand("~/.vimrc.bundles"))

source ~/.vimrc.bundles

endif

filetype plugin indent on

augroup vimrcEx

autocmd!

" When editing a file, always jump to the last known cursor position.

" Don't do it for commit messages, when the position is invalid, or when

" inside an event handler (happens when dropping a file on gvim).

autocmd BufReadPost *

\ if &ft != 'gitcommit' && line("'\"") > 0 && line("'\"") <= line("$") |

\ exe "normal g`\"" |

\ endif

" Cucumber navigation commands

autocmd User Rails Rnavcommand step features/step_definitions -glob=**/* -suffix=_steps.rb

autocmd User Rails Rnavcommand config config -glob=**/* -suffix=.rb -default=routes

" Set syntax highlighting for specific file types

autocmd BufRead,BufNewFile Appraisals set filetype=ruby

autocmd BufRead,BufNewFile *.md set filetype=markdown

" Enable spellchecking for Markdown

autocmd FileType markdown setlocal spell

" Automatically wrap at 80 characters for Markdown

autocmd BufRead,BufNewFile *.md setlocal textwidth=80

augroup END

" Softtabs, 4 spaces

set tabstop=4

set shiftwidth=4

set shiftround

set expandtab

" Display extra whitespace

set list listchars=tab:»·,trail:·

" Use The Silver Searcher https://github.com/ggreer/the_silver_searcher

if executable('ag')

" Use Ag over Grep

set grepprg=ag\ --nogroup\ --nocolor

" Use ag in CtrlP for listing files. Lightning fast and respects .gitignore

let g:ctrlp_user_command = 'ag %s -l --nocolor -g ""'

" ag is fast enough that CtrlP doesn't need to cache

let g:ctrlp_use_caching = 0

endif

" Color scheme

colorscheme molokai

"highlight NonText guibg=#060606

"highlight Folded guibg=#0A0A0A guifg=#9090D0

" Make it obvious where 80 characters is

set textwidth=80

set colorcolumn=+1

" Numbers

set number

set numberwidth=5

" Tab completion

" will insert tab at beginning of line,

" will use completion if not at beginning

set wildmode=list:longest,list:full

function! InsertTabWrapper()

let col = col('.') - 1

if !col || getline('.')[col - 1] !~ '\k'

return "\"

else

return "\"

endif

endfunction

inoremap =InsertTabWrapper()

inoremap

" Exclude Javascript files in :Rtags via rails.vim due to warnings when parsing

let g:Tlist_Ctags_Cmd="ctags --exclude='*.js'"

" Index ctags from any project, including those outside Rails

map ct :!ctags -R .

" Switch between the last two files

nnoremap

" vim-rspec mappings

nnoremap t :call RunCurrentSpecFile()

nnoremap s :call RunNearestSpec()

nnoremap l :call RunLastSpec()

" Run commands that require an interactive shell

nnoremap r :RunInInteractiveShell

" Treat

and

tags like the block tags they are

let g:html_indent_tags = 'li\|p'

" Open new split panes to right and bottom, which feels more natural

set splitbelow

set splitright

" Quicker window movement

nnoremap j

nnoremap k

nnoremap h

nnoremap l

" configure syntastic syntax checking to check on open as well as save

let g:syntastic_check_on_open=1

let g:syntastic_html_tidy_ignore_errors=[" proprietary attribute \"ng-"]

autocmd Syntax javascript set syntax=jquery " JQuery syntax support

set matchpairs+=<:>

set statusline+=%{fugitive#statusline()} " Git Hotness

" Nerd Tree

" autocmd VimEnter * NERDTree

let NERDChristmasTree=0

let NERDTreeWinSize=40

let NERDTreeChDirMode=2

let NERDTreeIgnore=['\~$', '\.pyc$', '\.swp$']

let NERDTreeShowBookmarks=1

let NERDTreeWinPos="left"

autocmd vimenter * if !argc() | NERDTree | endif " Automatically open a NERDTree if no files where specified

autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTreeType") && b:NERDTreeType == "primary") | q | endif " Close vim if the only window left open is a NERDTree

nmap :NERDTreeToggle

" Tagbar

let g:tagbar_width=35

let g:tagbar_autofocus=1

nmap :TagbarToggle

" Emmet

let g:user_emmet_mode='i' " enable for insert mode

" Search results high light

set hlsearch

" nohlsearch shortcut

nmap -hl :nohlsearch

nmap +hl :set hlsearch

" Javascript syntax hightlight

syntax enable

" YouCompleteMe

let g:ycm_autoclose_preview_window_after_completion=1

nnoremap g :YcmCompleter GoToDefinitionElseDeclaration

" ctrlp

set wildignore+=*/tmp/*,*.so,*.swp,*.zip " MacOSX/Linux"

let g:ctrlp_custom_ignore = '\v[\/]\.(git|hg|svn)$'

set laststatus=2 " Always display the status line

set statusline+=%{fugitive#statusline()} " Git Hotness

nnoremap w :w

nnoremap q :q

" RSpec.vim mappings

"map t :call RunCurrentSpecFile()

"map s :call RunNearestSpec()

"map l :call RunLastSpec()

"map a :call RunAllSpecs()

" Vim-instant-markdown doesn't work in zsh

set shell=bash\ -i

" Snippets author

let g:snips_author = 'Yuez'

" python mode

let g:pymode_indent = 1

" no folding

let g:pymode_folding = 0

let g:pymode_doc = 1

let g:pymode_run = 1

let g:pymode_run_bind = 'r'

let g:pymode_breakpoint_bind = 'b'

let g:pymode_rope_goto_definition_bind = ""

let g:pymode_virtualenv_path = $VIRTUAL_ENV

简单配置:

作者:地球的外星人君

链接:https://www.zhihu.com/question/19989337/answer/168444287

来源:知乎

著作权归作者所有。商业转载请联系作者获得授权,非商业转载请注明出处。

"显示行号

set nu

"启动时隐去援助提示

set shortmess=atI

"语法高亮

syntax on

"使用vim的键盘模式

"set nocompatible

"不需要备份

set nobackup

"没有保存或文件只读时弹出确认

set confirm

"鼠标可用

set mouse=a

"tab缩进

set tabstop=4

set shiftwidth=4

set expandtab

set smarttab

"文件自动检测外部更改

set autoread

"c文件自动缩进

set cindent

"自动对齐

set autoindent

"智能缩进

set smartindent

"高亮查找匹配

set hlsearch

"背景色

set background=dark

"显示匹配

set showmatch

"显示标尺,就是在右下角显示光标位置

set ruler

"去除vi的一致性

set nocompatible

"允许折叠

set foldenable

"""""""""""""""""设置折叠"""""""""""""""""""""

"

"根据语法折叠

set fdm=syntax

"手动折叠

"set fdm=manual

"设置键盘映射,通过空格设置折叠

nnoremap @=((foldclosed(line('.')<0)?'zc':'zo'))

""""""""""""""""""""""""""""""""""""""""""""""

"不要闪烁

set novisualbell

"启动显示状态行

set laststatus=2

"浅色显示当前行

autocmd InsertLeave * se nocul

"用浅色高亮当前行

autocmd InsertEnter * se cul

"显示输入的命令

set showcmd

"被分割窗口之间显示空白

set fillchars=vert:/

set fillchars=stl:/

set fillchars=stlnc:/

set encoding=utf-8

2、编辑~/.vimrc.bundles

vim ~/.vimrc.bundles

if &compatible

set nocompatible

end

filetype off

set rtp+=~/.vim/bundle/Vundle.vim

call vundle#begin()

" Let Vundle manage Vundle

Bundle 'gmarik/vundle'

" Define bundles via Github repos

Bundle 'christoomey/vim-run-interactive'

Bundle 'Valloric/YouCompleteMe'

Bundle 'croaky/vim-colors-github'

Bundle 'danro/rename.vim'

Bundle 'majutsushi/tagbar'

Bundle 'kchmck/vim-coffee-script'

Bundle 'kien/ctrlp.vim'

Bundle 'pbrisbin/vim-mkdir'

Bundle 'scrooloose/syntastic'

Bundle 'slim-template/vim-slim'

Bundle 'thoughtbot/vim-rspec'

Bundle 'tpope/vim-bundler'

Bundle 'tpope/vim-endwise'

Bundle 'tpope/vim-fugitive'

Bundle 'tpope/vim-rails'

Bundle 'tpope/vim-surround'

Bundle 'vim-ruby/vim-ruby'

Bundle 'vim-scripts/ctags.vim'

Bundle 'vim-scripts/matchit.zip'

Bundle 'vim-scripts/tComment'

Bundle "mattn/emmet-vim"

Bundle "scrooloose/nerdtree"

Bundle "Lokaltog/vim-powerline"

Bundle "godlygeek/tabular"

Bundle "msanders/snipmate.vim"

Bundle "jelera/vim-javascript-syntax"

Bundle "altercation/vim-colors-solarized"

Bundle "othree/html5.vim"

Bundle "xsbeats/vim-blade"

Bundle "Raimondi/delimitMate"

Bundle "groenewege/vim-less"

Bundle "evanmiller/nginx-vim-syntax"

Bundle "Lokaltog/vim-easymotion"

Bundle "tomasr/molokai"

Bundle "klen/python-mode"

if filereadable(expand("~/.vimrc.bundles.local"))

source ~/.vimrc.bundles.local

endif

call vundle#end()

filetype plugin indent on

3、配色方案 molokai

mkdir ~/.vim

git clone https://github.com/tomasr/molokai

mv molokai/colors ~/.vim

rm -rf molokai/

4、插件管理vundle

下载vundle:

git clone https://github.com/gmarik/vundle.git ~/.vim/bundle/vundle

~/.vimrc中要有:(需要添加)

if filereadable(expand("~/.vimrc.bundles"))

source ~/.vimrc.bundles

endif

~/.vimrc.bundles要有:(上面文件中有)

filetype off

set rtp+=~/.vim/bundle/vundle/

call vundle#rc()

vim +BundleInstall +qall

常用的命令:

目录结构 Fn + F1

脚本运行 space + r

python mode的一些常用命令

1).K :查阅对象文档

2).r: 运行python脚本

3). b:自动加入断点

4). /:自动补全

5). : 跳转到函数定义

遇到的问题:

1、插件一直安装失败,命令vim +BundleInstall +qall执行完没有反应

目录权限问题,一开始是 root:Staff (这是mac下的问题,Ubuntu上没有)

改成user:staff

~/.vim » sudo chown -R *user*:staff .

image.png

~/software » git clone

[https://github.com/vim/vim.git](https://github.com/vim/vim.git)

make --version

cd src

./configure --enable-pythoninterp

make

make install

#make uninstall有问题可以用此命令卸载

brew install cmake

cd ~/.vim/bundle/YouCompleteMe

./install.sh --clang-completer

vim 支持html

vim编写html5,Vim 配置相关推荐

  1. my vim IDE 编辑器的配置

    <h4>1.自定义编辑.vimrc的快捷键</h4> <blockquote> "Set mapleader let mapleader = " ...

  2. VIM使用系列之一——配置VIM下编程和代码阅读环境

    作者:gnuhpc from http://blog.csdn.net/gnuhpc  http://gnuhpc.wordpress.com/ 本文环境:ubuntu 10.10/vim7.2 前言 ...

  3. Linux:Vim的安装与配置

    Vim的安装与配置 版权声明:本文为博主原创文章 && 转载请著名出处 @ http://blog.csdn.net/gatieme https://blog.csdn.net/gat ...

  4. VIM使用系列之一——配置VIM下C/C++编程环境

    作者:gnuhpc from http://blog.csdn.net/gnuhpc 本文环境:ubuntu 9.10 1.基本配置 建立三个目录:mkdir -/.vim/{plugin,doc,s ...

  5. 在 Windows 系统上使用 Vim 编写 Shell 脚本并且运行

    1. Windows 下的 PowerShell Shell 既是一种命令语言,也是一种程序设计语言,目前主要用于 Linux 系统. PowerShell 是一种跨平台的任务自动化解决方案,由命令行 ...

  6. linux系统配置Vim命令,vim配置 LINUX操作系统VIM的安装和配置

    vim和emacs是linux环境下的文本编辑利器,关于vim和emacs谁更优秀的话题从来没有断过,我在这里就不再评判了,vim是linux下的默认编辑器,学好了vim将会一生受用,使用vim编辑代 ...

  7. Vim常用命令和配置

    [TOC] Vim常用命令和配置 Mac 终端键入 vimtutor 即可进入Vim入门教程 问题收集 vim代码粘贴,格式混乱到逆天.这是因为vim设置了自动缩进造成的问题, 所以如果你需要在ins ...

  8. VIM插件安装和配置

    1 写在前面   http://blog.csdn.net/namecyf/article/details/7787479 Linux下编程一直被诟病的一点是: 没有一个好用的IDE, 但是听说Lin ...

  9. vim的高级用法配置以及在系统中如何获取帮助

    vim的高级用法配置以及在系统中如何获取帮助 1 vim的三种模式 1.1 使用方法 1.2 vim模式 2 vim工作的基本配置 2.1 临时设定(set设定) 2.2 永久设定方式 3 搜索 4 ...

  10. Vim 的高级用法配置

    1.vim 的三种模式 vim是全球两大流行的文本编辑器之一 vim file #直接编辑文件的内容. vim                wq file                  file ...

最新文章

  1. 【错误记录】-eclipse 导入类 提示The import XXX cannot be resolved
  2. NTRIP/ SUPL
  3. [编程题]表达式合法判断
  4. jersey rest webservice
  5. c# 定位内存快速增长_改善C#程序,提高程序运行效率的50种方法
  6. 如何避免大脑短路?用心理学分析重庆公交车坠江案
  7. matlab 生成信号文件,生成的代码如何存储内部信号、状态和参数数据
  8. css设置元素继承父元素宽度_详解CSS中的百分比的应用
  9. java 7 Reflection详解(二),获取class对象信息
  10. ActiveMQ Destination高级特性
  11. python实现电脑程序自动化_python基于pywinauto实现PC客户端自动化
  12. 如何在VS上用C#玩坏“Hello World”。
  13. 一步一步理解拖拽Drag(一)
  14. hexo之Volantis主题美化
  15. 2021年危险化学品经营单位安全管理人员考试报名及危险化学品经营单位安全管理人员作业考试题库
  16. 如何禁止用户删除计算机服务,怎样才能禁止别人删除我电脑中的文件?
  17. 红米note5解锁教程_红米NOTE5解锁包
  18. 钉钉微应用H5的调试方法
  19. SaaS产品移动化,你想好这3点了吗
  20. android模拟器+文件传输,夜神安卓模拟器怎么和电脑互传文件_夜神模拟器和电脑互传文件的教程-系统城...

热门文章

  1. 怎样高效地自学软件测试
  2. 敏捷测试的方法和实践
  3. 高手过招 放“码”出击 | 2022 Google 全球编程比赛集结倒计时!
  4. godaddy无法修改域名服务器,GoDaddy域名修改DNS设置方法
  5. 教你炒股票28:回复(一)
  6. Speex manul中文版
  7. UWB定位系统的主要误差来源
  8. 从7654浏览器卸载到安装360安全卫士
  9. php微信公众号采集器,WordPress微信公众号采集插件
  10. linux 安装mysql(rpm文件安装)