Skip to content

Instantly share code, notes, and snippets.

@pothitos
Last active October 29, 2023 22:08
Show Gist options
  • Save pothitos/2a0b8ce11c6b90a7f49d96f10186c450 to your computer and use it in GitHub Desktop.
Save pothitos/2a0b8ce11c6b90a7f49d96f10186c450 to your computer and use it in GitHub Desktop.
Convenient Vim configuration
" Settings
set autoindent
set expandtab
set hlsearch
set ignorecase
set incsearch
set nojoinspaces
set number
set showcmd
set showmatch
set title
set whichwrap+=<,>,h,l,[,]
set wildignorecase
set wildmenu
set spell spelllang=el,en
set iskeyword=@,48-57,_,162,182,184-186,188,190-209,211-254
" Shortcuts
map <F1> :windo set number!<CR>
map! <F1> <C-O><F1>
map <F2> <C-W>=:windo set wrap!<CR>
map! <F2> <C-O><F2>
map <F3> :q<CR>
map! <F3> <Esc><F3>
map <F4> :if &formatoptions =~ 'a' <Bar>
\ set formatoptions-=a <Bar>
\ else <Bar>
\ set formatoptions+=a <Bar>
\ set textwidth=72 <Bar>
\ set indentkeys= <Bar>
\ endif <CR>
map! <F4> <C-O><F4>
map <F5> <C-W><C-W>
map! <F5> <C-O><F5>
map <F6> :windo set background=light<CR>
map! <F6> <C-O><F6>
map <F7> :if exists('g:syntax_on') <Bar>
\ syntax off <Bar>
\ else <Bar>
\ syntax enable <Bar>
\ endif <CR>
map! <F7> <C-O><F7>
map <F8> :nohlsearch<CR>
map! <F8> <C-O><F8>
map <F9> :windo set spell!<CR>
map! <F9> <C-O><F9>
noremap <F10> <C-Y>
map! <F10> <C-O><F10>
noremap <F11> <C-E>
map! <F11> <C-O><F11>
map <F12> :w<CR>
map! <F12> <Esc><F12>
map <C-T> :tabe<CR>
map <C-kPlus> <C-A>
map <C-kMinus> <C-X>
map <C-BS> i<C-W><Esc>
map! <C-BS> <C-W>
map <C-Del> dw
map! <C-Del> <C-O><C-Del>
map! <C-B> “…”
set formatoptions+=n
let &formatlistpat = '^\s*\(+\|-\|\*\|\d\+\.\|\\item\S*\) '
for s:bakdir in ['C:\Users\npothito\Desktop\Nikos\vim-backup']
if isdirectory(s:bakdir)
let &backupdir = s:bakdir
let &undodir = s:bakdir
endif
endfor
" Taken from defaults.vim:
" When editing a file, always jump to the last known cursor position.
" Don't do it when the position is invalid, when inside an event handler
" (happens when dropping a file on gvim) and for a commit message (it's
" likely a different one than last time).
autocmd BufReadPost *
\ if line("'\"") >= 1 && line("'\"") <= line("$") && &ft !~# 'commit'
\ | exe "normal! g`\""
\ | endif
autocmd FileType text setlocal textwidth=0
" Consider set background=dark in /etc/vim/vimrc if using a dark background
" If beautification of fonts is needed in Windows 10
"set guifont=Consolas:h10:cGREEK:qDRAFT
"set enc=utf8
" For Python container
"syn on
"highlight clear SpellBad
"highlight SpellBad cterm=underline
" Groovy syntax highlighting
"autocmd BufNewFile,BufRead *.gvy,Jenkinsfile set syntax=groovy
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment