What vim settings do I need so vim ftp write does not convert to dos format?

0

This question is really about being able to write a file using gVim or command line vim without its file type (Unix) being changed to DOS. This problem is not happening in command line vim directly on a Linux system.

I am editing files that reside on a Linux system, using gVim. The edit command looks like this:

:e ftp://user@server//home/csm/csmdev/recpt_rpt.4gl

When I edit the file, it's type is Unix. When I write the file out, it is automatically converted to dos format. I confirm this by entering the :e! right after writing out the file using :w.

I have included my .vimrc at the end of this post.

I have taken the suggestions provided as answer(s) comments to this OP.

nnoremap <F2> :set nonumber!<CR>:set foldcolumn=0<CR>
filetype plugin indent on
autocmd FileType python set complete+=k~/.vim/syntax/python.vim isk+=.,(
map <buffer> <S-e> :w<CR>:!/usr/bin/env python % <CR>
set encoding=utf8
set paste
set expandtab
set textwidth=0
set tabstop=4
set softtabstop=4
set shiftwidth=4
set autoindent
set backspace=indent,eol
set incsearch
set ignorecase
set ruler
set wildmenu
set commentstring=\ #\ %s
set clipboard+=unnamed
set wm=8
syn on
set nocompatible
set fileformats=unix,dos
" tab navigation adapted from vim tip 1221
nmap th :tabprev<cr>
nmap tl :tabnext<cr>
nmap tn :tabnew<cr>
nmap tc :tabclose<cr>
set statusline=%F%m%r%h%w\ [FORMAT=%{&ff}]\ [TYPE=%Y]\ [ASCII=\%03.3b]\ [HEX=\%02.2B]\ [POS=%04l,%04v][%p%%]\ [LEN=%L] 
set laststatus=2

octopusgrabbus

Posted 2013-07-24T14:27:06.383

Reputation: 223

Answers

0

This problem is now resolved. It was resolved when I built vim from 7.4a Beta. I am posting the .vimrc, which does not have the fileformats option in it.

I ran the config with these parameters:

/configure --enable-gui=auto --disable-gtktest

Here is the .vimrc:

nnoremap <F2> :set nonumber!<CR>:set foldcolumn=0<CR>
filetype plugin indent on
autocmd!
autocmd FileType python set complete+=k~/.vim/syntax/python.vim isk+=.,(
map <buffer> <S-e> :w<CR>:!/usr/bin/env python % <CR>
set encoding=utf8
set paste
set expandtab
set textwidth=0
set tabstop=4
set softtabstop=4
set shiftwidth=4
set autoindent
set backspace=indent,eol
set incsearch
set ignorecase
set smartcase
set ruler
set wildmenu
set commentstring=\ #\ %s
set clipboard+=unnamed
set wm=8
syn on
set nocompatible
" tab navigation adapted from vim tip 1221
nmap th :tabprev<cr>
nmap tl :tabnext<cr>
nmap tn :tabnew<cr>
nmap tc :tabclose<cr>
set statusline=%F%m%r%h%w\ [FORMAT=%{&ff}]\ [TYPE=%Y]\ [ASCII=\%03.3b]\ [HEX=\%02.2B]\ [POS=%04l,%04v][%p%%]\ [LEN=%L] 
set laststatus=2
" Uncomment the following to have Vim jump to the last position when
" reopening a file
if has("autocmd")
  au BufReadPost * if line("'\"") > 0 && line("'\"") <= line("$")
    \| exe "normal g'\"" | endif
endif
autocmd BufNewFile * silent! 0r $VIMHOME/templates/%:e.tpl
augroup filetypedetect
    autocmd BufRead,BufNewFile *.wiki setfiletype Wikipedia
    autocmd BufRead,BufNewFile *.wikipedia.org* setfiletype Wikipedia
augroup END

octopusgrabbus

Posted 2013-07-24T14:27:06.383

Reputation: 223

3

This should do the trick:

set fileformats=unix

It prevents using dos file format.

cforbish

Posted 2013-07-24T14:27:06.383

Reputation: 151

What about autodetect, though, in case I'm editing a windows file? Also, this isn't being picked up by gVim. Do I need to log out and back in? – octopusgrabbus – 2013-07-24T14:57:48.570

1@octopusgrabbus, add that line to your vimrc. – romainl – 2013-07-24T15:18:00.390

@octopusgrabbus, you can use set fileformats=unix,dos. This should create new files as unix files, but be able to leave existing files format alone. Yes after putting this line in .vimrc, you would need to start gvim again, unless you manually set fileformats from command mode. – cforbish – 2013-07-24T15:33:13.817

It's still toggling back. That is it's writing out dos. – octopusgrabbus – 2013-07-24T16:29:31.210