My nice .vimrc file.

Posted: February 1, 2012. At: 9:44 PM. This was 6 years ago. Post ID: 2603

This is a very good .vimrc file for any VIM user. Line numbering and indenting is enabled and it makes the VIM editor much more usable for any level of Linux user.

" ~/.vimrc (configuration file for vim only)
" skeletons
function! SKEL_spec()
        0r /usr/share/vim/current/skeletons/skeleton.spec
        language time en_US
        if $USER != ''
            let login = $USER
        elseif $LOGNAME != ''
            let login = $LOGNAME
        else
            let login = 'unknown'
        endif
        let newline = stridx(login, "\n")
        if newline != -1
            let login = strpart(login, 0, newline)
        endif
        if $HOSTNAME != ''
            let hostname = $HOSTNAME
        else
            let hostname = system('hostname -f')
            if v:shell_error
                let hostname = 'localhost'
            endif
        endif
        let newline = stridx(hostname, "\n")
        if newline != -1
            let hostname = strpart(hostname, 0, newline)
        endif
        exe "%s/specRPM_CREATION_DATE/" . strftime("%a\ %b\ %d\ %Y") . "/ge"
        exe "%s/specRPM_CREATION_AUTHOR_MAIL/" . login . "@" . hostname . "/ge"
        exe "%s/specRPM_CREATION_NAME/" . expand("%:t:r") . "/ge"
        setf spec
endfunction
autocmd BufNewFile      *.spec  call SKEL_spec()
" filetypes
filetype plugin on
filetype indent on
" ~/.vimrc ends here                                                                                                                                                     
set nu
set wrap

This ~/.vimrc is the best way to make the most of your VIM editor.

No comments have been made. Use this form to start the conversation :)

Leave a Reply