" ------------------------------------------------------------------------------
" .vimrc / init.vim
" =================
"
" Scope Native
" Copyright (C) 2024 by RaySoft, Zurich, Switzerland
" License GNU General Public License (GPL) 2.0
" https://www.gnu.org/licenses/gpl2.txt
"
" ------------------------------------------------------------------------------
"
" Descriptions are copied from https://vimhelp.org/options.txt.html
"
" ------------------------------------------------------------------------------
" Plugins
" vim-plug (https://github.com/junegunn/vim-plug)
call plug#begin('~/.vim/plugged')
" vim-colors-solarized
Plug 'https://github.com/altercation/vim-colors-solarized.git'
" vim-airline
Plug 'https://github.com/vim-airline/vim-airline.git'
" vim-airline-themes
Plug 'https://github.com/vim-airline/vim-airline-themes.git'
call plug#end()
" ------------------------------------------------------------------------------
" This option has the effect of making Vim either more Vi-compatible, or make
" Vim behave in a more useful way.
set nocompatible
" ------------------------------------------------------------------------------
" Theme
" -----
" Number of colors
set t_Co=256
let g:solarized_termcolors=256
" Enable syntax highlighting
syntax enable
" When set to 'dark', Vim will try to use colors that look good on a dark
" background. When set to 'light', Vim will try to use colors that look good on
" a light background.
set background=dark
" Load color scheme
colorscheme solarized
" By default, airline will use unicode symbols if your encoding matches utf-8.
" If you want the powerline symbols set this variable:
let g:airline_powerline_fonts = 1
" Enable/Disable enhanced tabline.
let g:airline#extensions#tabline#enabled = 1
" Switch position of buffers and tabs on splited tabline.
let g:airline#extensions#tabline#show_buffers = 0
" ------------------------------------------------------------------------------
" Display
" -------
" If in Insert, Replace or Visual mode put a message on the last line. Use the
" 'M' flag in 'highlight' to set the type of highlighting for this message.
set noshowmode
" Show (partial) command in status line. Set this option off if your terminal is
" slow.
set noshowcmd
" Threshold for reporting number of lines changed. When the number of changed
" lines is more than 'report' a message will be given for most ':' commands.
" If you want it always, set 'report' to 0.
set report=0
" Show the line and column number of the cursor position, separated by a comma.
set noruler
" When on, the title of the window will be set to the value of " 'titlestring'
" (if it is not empty), or to: filename [+=-] (path) - VIM
set title
" Print the line number in front of each line.
set number
" Show the line number relative to the line with the cursor in front of each
" line. Relative line numbers help you use the count you can precede some
" vertical motion commands (e.g. j k + -) with, without having to calculate it
" yourself.
set relativenumber
" Minimal number of columns to use for the line number. Since one space is
" always between the number and the text, there is one less character for the
" number itself.
set numberwidth=5
" List mode: Show tabs as CTRL-I, show end of line with $. Useful to see the
" difference between tabs and spaces and for trailing blanks.
set list
" Ring the bell for error messages.
set noerrorbells
" Use visual bell instead of beeping.
set novisualbell
" ------------------------------------------------------------------------------
" Line break
" ----------
" If on Vim will wrap long lines at a character in 'breakat' rather than at the
" last character that fits on the screen.
set linebreak
" Maximum width of text that is being inserted. A longer line will be broken
" after white space to get this width.
set textwidth=80
" This option changes how text is displayed. It doesn't change the text in the
" buffer, see 'textwidth' for that.
" When on, lines longer than the width of the window will wrap and displaying
" continues on the next line. When off lines will not wrap and only part of long
" lines will be displayed. When the cursor is moved to a part that is not shown,
" the screen will scroll horizontally.
set wrap
" Number of characters from the right window border where wrapping starts. When
" typing text beyond this limit, an <EOL> will be inserted and inserting
" continues on the next line.
set wrapmargin=0
" String to put at the start of lines that have been wrapped.
set showbreak=>
" ------------------------------------------------------------------------------
" File operations
" ---------------
" This gives the end-of-line (<EOL>) formats that will be tried when starting to
" edit a new buffer and when reading a file into an existing buffer.
set fileformats=unix,dos,mac
" Make a backup before overwriting a file.
set nobackup
" ------------------------------------------------------------------------------
" Search and replace options
" --------------------------
" Searches wrap around the end of the file.
set wrapscan
" Ignore case in search patterns. Also used when searching in the tags file.
set ignorecase
" Override the 'ignorecase' option if the search pattern contains upper case
" characters. Only used when the search pattern is typed and 'ignorecase' option
" is on.
set smartcase
" While typing a search command, show immediately where the so far typed pattern
" matches. The matched string is highlighted. If the pattern is invalid or not
" found, nothing is shown.
set incsearch
" When there is a previous search pattern, highlight all its matches. The type
" of highlighting used can be set with the 'l' occasion in the 'highlight'
" option.
set hlsearch
" When on, the ':substitute' flag 'g' is default on. This means that all matches
" in a line are substituted instead of one.
set gdefault
" ------------------------------------------------------------------------------
" Programming help
" ----------------
" Number of spaces that a <Tab> in the file counts for.
set tabstop=2
" Number of spaces to use for each step of (auto)indent.
set shiftwidth=2
" In Insert mode: Use the appropriate number of spaces to insert a <Tab>.
set expandtab
" When a bracket is inserted, briefly jump to the matching one. The jump is only
" done if the match can be seen on the screen. The time to show the match can be
" set with 'matchtime'.
set showmatch
" Tenths of a second to show the matching paren, when 'showmatch' is set.
set matchtime=2
" Characters that form pairs. The % command jumps from one to the other.
" Currently only single character pairs are allowed, and they must be different.
set matchpairs=(:),[:],{:},<:>
" Copy indent from current line when starting a new line.
set autoindent
" Copy the structure of the existing lines indent when autoindenting a new line.
set nocopyindent
" When changing the indent of the current line, preserve as much of the indent
" structure as possible.
set preserveindent
" ------------------------------------------------------------------------------
" Folds
" -----
" When off, all folds are open. This option can be used to quickly switch
" between showing all text unfolded and viewing the text with folds.
set nofoldenable
" ------------------------------------------------------------------------------
" Other options
" -------------
" When non-empty, the viminfo file is read upon startup and written when exiting
" Vim. The string should be a comma separated list of parameters, each
" consisting of a single character identifying the particular parameter,
" followed by a number or string which specifies the value of that parameter:
" ' Maximum number of previously edited files for which the marks are
" remembered.
" " Maximum number of lines saved for each register.
" : Maximum number of items in the command-line history to be saved.
" % Saves and restores the buffer list
set viminfo=\'100,\"100,:100,%
" Insert two spaces after a '.', '?' and '!' with a join command.
set nojoinspaces
" Maximum number of changes that can be undone. Since undo information is kept
" in memory, higher numbers will cause more memory to be used.
set undolevels=100
" Influences the working of <BS>, <Del>, CTRL-W and CTRL-U in Insert mode. This
" is a list of items, separated by commas. Each item allows a way to backspace
" over something:
" indent allow backspacing over autoindent.
" eol allow backspacing over line breaks (join lines).
" start allow backspacing over the start of insert; CTRL-W and CTRL-U
" stop once at the start of insert.
set backspace=indent,eol,start
" Jump to the last position when reopening a file
if has("autocmd")
autocmd BufReadPost *
\ if line("'\"") > 0 && line("'\"") <= line("$") |
\ exe "normal g`\"" |
\ endif
endif
" ------------------------------------------------------------------------------