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
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 setfileformats
from command mode. – cforbish – 2013-07-24T15:33:13.817It's still toggling back. That is it's writing out dos. – octopusgrabbus – 2013-07-24T16:29:31.210