微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

config – 如何阻止vim在80后创建新行

我使用 vim作为 Python IDE以及我的Octopress的一些markdown编辑器.它每80个字符创建一个新行.我试图关闭它(启用工作包装)所以典型的文本文件的版本不会这么痛苦.

这是我的.vim配置:

filetype off
call pathogen#runtime_append_all_bundles()
call pathogen#helptags()

set foldmethod=indent
set foldlevel=99

map <c-j> <c-w>j
map <c-k> <c-w>k
map <c-l> <c-w>l
map <c-h> <c-w>h

map <leader>td <Plug>TaskList

map <leader>g :GundoToggle<CR>

Syntax on                           " Syntax highlighing
filetype on                          " try to detect filetypes
filetype plugin indent on    " enable loading indent file for filetype

let g:pyflakes_use_quickfix = 0

let g:pep8_map='<leader>8'

au FileType python set omnifunc=pythoncomplete#Complete
let g:SuperTabDefaultCompletionType = "context"

set number
set completeopt=menuone,longest,preview

set autochdir
let NERDTreeChDirMode=2
map <leader>n :NERDTreetoggle<CR>

map <leader>j :RopeGotoDeFinition<CR>
map <leader>r :RopeRename<CR>

nmap <leader>a <Esc>:Ack!

set statusline=%F%m%r%h%w[%L][%{&ff}]%y[%p%%][%04l,%04v][%{fugitive#statusline()}]

map <leader>dt :set makeprg=python\ manage.py\ test\|:call MakeGreen()<CR>

" Execute the tests
nmap <silent><leader>tf <Esc>:Pytest file<CR>
nmap <silent><leader>tc <Esc>:Pytest class<CR>
nmap <silent><leader>tm <Esc>:Pytest method<CR>
" cycle through test errors
nmap <silent><leader>tn <Esc>:Pytest next<CR>
nmap <silent><leader>tp <Esc>:Pytest prevIoUs<CR>
nmap <silent><leader>te <Esc>:Pytest error<CR>

" Add the virtualenv's site-packages to vim path
py << EOF
import os.path
import sys
import vim
if 'VIRTUAL_ENV' in os.environ:
    project_base_dir = os.environ['VIRTUAL_ENV']
    sys.path.insert(0,project_base_dir)
    activate_this = os.path.join(project_base_dir,'bin/activate_this.py')
   execfile(activate_this,dict(__file__=activate_this))

EOF

set background=dark
colorscheme molokai
set spell
set textwidth=0 wrapmargin=0

" Auto-close brackets
inoremap {      {}<Left>
inoremap {<CR>  {<CR>}<Esc>O
inoremap {{     {
inoremap {}     {}
inoremap (  ()<Left>
inoremap ()     ()
inoremap ((     (
inoremap <  <><Left>
inoremap <<     <
inoremap <>     <>

有任何想法吗?

解决方法

我相信这就是你想要的: Word wrap without line breaks in Vim.

相关部分:将这些设置添加配置文件中:

set wrap
set linebreak
set nolist  " list disables linebreak

在您明确点击“Enter”之前,这将直观地换行但不插入换行符.

编辑:根据评论,添加该行也是一个好主意

set textwidth=0

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。

相关推荐