CodingConventions

From ago control wiki
Jump to: navigation, search

Coding Conventions

For Python Agocontrol uses PEP coding conventions.

Spaces are the default indentation method for Agocontrol files, in all languages. C, C++, Python, HTML and Javascript.

All files should

  • 4 spaces per indentation level, never tabs
  • UNIX line endings (\n, not \r\n)


Editors configuration

VIM

For the bare necessity with regards to VIM configuration, please refer to the .lvimrc file in the repository.

Here is an example of ~/.vimrc file.

This ensures autoindent uses spaces, never tabs.

Syntax coloring is enabled and footer page shows infos about file.

Line numbers are displayed

filetype plugin on
set ruler                       " display cursor position
set sm                          " show brackets
set formatoptions=tcroqn        " indentation
set autoindent
set cin
set textwidth=0                 " line not cut
set backspace=2
set expandtab
set tabstop=4
set shiftwidth=4
set softtabstop=4
map <F2> :retab <CR> :wq! <CR>
syntax on                       " syntax coloring
set background=dark             " black background color
set number
set ignorecase                  " ignore case when searching
set hlsearch                    " highlight search results
set incsearch                   " search results step by step
" Returns true if paste mode is enabled
function! HasPaste()
    if &paste
        return 'PASTE MODE  '
    en
        return 
endfunction
" remember last editing position
autocmd BufReadPost *
     \ if line("'\"") > 0 && line("'\"") <= line("$") |
     \   exe "normal! g`\"" |
     \ endif
set laststatus=2                " always show status bar
set statusline=\ %{HasPaste()}%F%m%r%h\ %w\ \ CWD:\ %r%{getcwd()}%h\ \ \ Line:\ %l  " format status line
execute pathogen#infect()
Personal tools