summaryrefslogtreecommitdiff
path: root/.vim/settings.vim
diff options
context:
space:
mode:
authorSyndamia <kamen@syndamia.com>2023-06-02 08:10:19 +0300
committerSyndamia <kamen@syndamia.com>2023-06-02 08:10:19 +0300
commitd5151c31464962392efa8f01c9101f3ee7252151 (patch)
treeef68036778de57a0627413f9186014a7a8783229 /.vim/settings.vim
parentd8e95aba792af861133531348223840c184cf289 (diff)
downloaddotfiles-d5151c31464962392efa8f01c9101f3ee7252151.tar
dotfiles-d5151c31464962392efa8f01c9101f3ee7252151.tar.gz
dotfiles-d5151c31464962392efa8f01c9101f3ee7252151.zip
[.vim] Moved startup scripts to .vim/ folder
Diffstat (limited to '.vim/settings.vim')
-rw-r--r--.vim/settings.vim86
1 files changed, 86 insertions, 0 deletions
diff --git a/.vim/settings.vim b/.vim/settings.vim
new file mode 100644
index 0000000..dd83663
--- /dev/null
+++ b/.vim/settings.vim
@@ -0,0 +1,86 @@
+" Color scheme {{{
+ colorscheme gruvbox
+ let g:gruvbox_contrast_dark = 'hard'
+ set background=dark " Setting dark mode
+" }}}
+
+" Cursor {{{
+ set scrolloff=5 " Screen lines above and below the cursor
+ set showmatch " Cursor jumps to matching opening bracket automatically
+
+ let &t_SI = "\e[5 q" " thin cursor on insert mode
+ let &t_SR = "\e[4 q" " underline on replace mode
+ let &t_EI = "\e[1 q" " block on normal mode
+
+ set cul " Highlight current cursor line
+ autocmd InsertEnter,InsertLeave * set cul! " Don't highlight current line, when in insert mode
+" }}}
+
+" Indentation {{{
+ set tabstop=4 " Show tabs as 4 wide
+ set shiftwidth=4 " Indent with 4 spaces
+
+ autocmd FileType css,ts setlocal ts=2 sw=2 sts=0 expandtab " Transform tabs in CSS and TS into 2 spaces
+ autocmd FileType lisp,scheme,haskell setlocal ts=2 sw=2 sts=0 expandtab
+" }}}
+
+" Folding {{{
+ autocmd FileType * set foldmethod=syntax " Syntax folding for all
+ autocmd FileType vim,text,sh,zsh,xdefaults setlocal foldmethod=marker " Overrides folding to marker for types
+
+ set foldlevel=99 " Open all folds by default
+ autocmd FileType vim,sh,zsh,xdefaults setlocal foldlevel=0 " Close all folds by defualt on filetypes
+
+ set foldtext=MyFoldText() " Custom text for a fold
+ function MyFoldText()
+ let line = substitute(getline(v:foldstart), "\t", repeat(" ", shiftwidth(0)), "") " Gets the first fold line and replace tabs with spaces (as many as shiftwidth is set to)
+ let linecount = v:foldend - v:foldstart " Calculates amount of folded lines
+ return line . repeat(" ", winwidth('%') - strlen(line) - 10 - strlen(linecount))
+ \ . "  " . linecount . "  " " Shows our line, then a lot of spaces, and at the very end we have line number and arrows
+ endfunction
+" }}}
+
+" Splits {{{
+ autocmd VimEnter,VimResized * let &winwidth=&columns/2 | let &winheight=&lines*2/3
+" }}}
+
+set list " Enabled customization of white space characters, so spaces, tabs, EOL, etc. (:h 'list')
+
+" Show tabs as a | with three spaces
+" When line extends beyond the screen, use > (and <) characters
+set listchars=tab:│\ ,extends:>,precedes:<
+
+autocmd BufReadPre,FileReadPre * call NoWrapIfHasLongLine()
+function! NoWrapIfHasLongLine()
+ let longestline = system("wc -L " . bufname("%") . " | awk '{print $1}'")
+ if longestline > 840
+ set nowrap
+ endif
+endfunction
+
+set backspace=indent,eol,start " Better backspace functionality
+
+filetype plugin indent on
+syntax on " Syntax highlighting
+set number " Show line numbers to the left
+set signcolumn=number " Show signs and numbers on the same column
+set mouse=a " Mouse support
+set showcmd
+set wildmenu
+set wildmode=list:longest,full
+set history=1000
+set incsearch
+set shortmess=acTOI
+set undodir=~/.vim/vimundo
+set undofile
+
+" For TOhtml
+let g:html_line_ids = 1
+let g:html_dynamic_folds = 1
+
+autocmd BufRead,BufNewFile * set tw=0 " Sets textwidth to 0 for all files (set with autocmd since just doing "set tw=0" can be overridden)
+autocmd BufRead,BufNewFile *.component.css set filetype=css
+
+" Language mapping for (bulgarian) cyrillic characters to english
+set langmap=АA,аa,БB,бb,ВW,вw,ГG,гg,ДD,дd,ЕE,еe,ЖV,жv,ЗZ,зz,ИI,иi,ЙJ,йj,КK,кk,ЛL,лl,МM,мm,НN,нn,ОO,оo,ПP,пp,РR,рr,СS,сs,ТT,тt,УU,уu,ФF,фf,ХH,хh,ЦC,цc,Ч~,ч`,Ш{,ш[,Щ},щ],ЪY,ъy,ЬX,ьx,Ю\|,ю\\,ЯQ,яq
+set spelllang=en,bg_BG " Adds Bulgarian to spelling languages