mywiki/linux/vim/vimrc

384 lines
13 KiB
VimL
Executable File
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

" IMPOSTAZIONI ----------------------------------------------------------- {{{
packadd! dracula
colorscheme dracula
set completeopt=longest,menuone
setlocal complete+=k
set dictionary+=/home/dado/.vim/dict/dict_it.txt
set wrap
set linebreak
set expandtab
autocmd vimenter * hi Normal guibg=NONE ctermbg=NONE
set spell spelllang=it,en
syntax on " Enable type file detection. Vim will be able to try to detect the type of file in use.
filetype on " Enable plugins and load plugin for the detected file type.
set nocompatible " be iMproved, required
filetype plugin indent on
set omnifunc=syntaxcomplete " Enable Omnicomplete features
filetype plugin on " Load an indent file for the detected file type.
filetype indent on
set foldenable
set autoindent " Automatically guesses the indentation given the previous one
set hlsearch " Automatically highlights search results, to hide them run :noh
set incsearch " Searches incrementally as you type.
set ruler " Shows the rulers
set showcmd " Shows current cursor info
set ignorecase " Ignores cases when searching
set noswapfile " Disables swap files
set undofile " Enable keeping history across sessions, don't forget to mkdir
set undodir=~/.vim/undo/
set nofixeol " Do not insert a new line at the end of the file automatically
set backspace=indent,eol,start " Enable backspace key to delete stuffs properly
set termguicolors
set relativenumber
set clipboard=unnamedplus
set cursorline " Highlight cursor line underneath the cursor horizontally.
set nobackup " Do not save backup files.
set incsearch " While searching though a file incrementally highlight matching characters as you type.
set ignorecase " Ignore capital letters during search.
set smartcase " This will allow you to search specifically for capital letters.
set showmode " Show the mode you are on the last line.
set showmatch " Show matching words during a search.
set wildmenu " Enable auto completion menu after pressing TAB.
set wildmode=list:longest " Make wildmenu behave like similar to Bash completion.
set foldenable
set foldmethod=indent
set ttyfast " Speed up scrolling in Vim
set encoding=UTF-8
set updatetime=300
set signcolumn=yes
" }}}
" PLUGINS ---------------------------------------------------------------- {{{
" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" let Vundle manage Vundle, required
Plugin 'VundleVim/Vundle.vim'
"
" All of your Plugins must be added before the following line
"
Plugin 'jasonccox/vim-wayland-clipboard'
Plugin 'gabrielelana/vim-markdown'
Plugin 'itchyny/vim-cursorword'
Plugin 'preservim/nerdtree'
Plugin 'iamcco/markdown-preview.nvim'
Plugin 'iamcco/mathjax-support-for-mkdp'
Plugin 'alvan/vim-closetag'
Plugin 'mattn/emmet-vim'
Plugin 'jiangmiao/auto-pairs'
Plugin 'ryanoasis/vim-devicons'
Plugin 'frazrepo/vim-rainbow'
Plugin 'mg979/vim-visual-multi', {'branch': 'master'}
Plugin 'itchyny/lightline.vim'
Plugin 'voldikss/vim-floaterm'
Plugin 'mracos/mermaid.vim'
Plugin 'mzlogin/vim-markdown-toc'
Plugin 'bbrtj/vim-vorg-md'
Plugin 'sheerun/vim-polyglot'
Plugin 'ervandew/supertab'
Plugin 'Valloric/YouCompleteMe'
call vundle#end() " required
" }}}zo
" MAPPINGS --------------------------------------------------------------- {{{
" Mappings code goes here.
" }}}
" VIMSCRIPT -------------------------------------------------------------- {{{
" This will enable code folding.
" zo per aprire una singola piega sotto il cursore.
" zc per chiudere la piega sotto il cursore.
" zR per aprire tutte le pieghe.
" zM per chiudere tutte le pieghe.
augroup filetype_vim
autocmd!
autocmd FileType vim setlocal foldmethod=marker
augroup END
" More Vimscripts code goes here.
" }}}
" PREDICTIVE ------------------------------------------------------------- {{{
"
let g:predictive#dict_path = expand($HOME . '/dict')
let g:predictive#disable_plugin = 0
"
" }}}
" YOUCOMPLETEME ------------------------------------------------------------- {{{
"
let g:ycm_global_ycm_extra_conf='~/.vim/bundle/YouCompleteMe/.ycm_extra_conf.py'
let g:ycm_confirm_extra_conf=0
let g:ycm_python_binary_path='/usr/bin/python3'
"
" }}}
" NERD-TREE ------------------------------------------------------------- {{{
"
" Start NERDTree and put the cursor back in the other window.
autocmd VimEnter * NERDTree | wincmd p"
"
" Exit Vim if NERDTree is the only window remaining in the only tab.
autocmd BufEnter * if tabpagenr('$') == 1 && winnr('$') == 1 && exists('b:NERDTree') && b:NERDTree.isTabTree() | quit | endif"
"
" Close the tab if NERDTree is the only window remaining in it.
autocmd BufEnter * if winnr('$') == 1 && exists('b:NERDTree') && b:NERDTree.isTabTree() | quit | endif
"
" Open the existing NERDTree on each new tab.
autocmd BufWinEnter * if getcmdwintype() == '' | silent NERDTreeMirror | endif
" }}}
" MD-FOLDING ------------------------------------------------------------- {{{
"
let g:markdown_folding = 1
"
"zo open current fold
"zO recursively open current fold
"zc close current fold
"zC recursively close current fold
"za toggle current fold
"zA recursively open/close current fold
"zm reduce foldlevel by one
"zM close all folds
"zr increase foldlevel by one
"zR open all folds
" }}}
" MARK-DOWN-PREVIEW ----------------------------------------------------- {{{
" https://github.com/iamcco/markdown-preview.nvim
"
" set to 1, nvim will open the preview window after entering the markdown buffer
" default: 0
let g:mkdp_auto_start = 0
" set to 1, the nvim will auto close current preview window when change
" from markdown buffer to another buffer
" default: 1
let g:mkdp_auto_close = 1
" set to 1, the vim will refresh markdown when save the buffer or
" leave from insert mode, default 0 is auto refresh markdown as you edit or
" move the cursor
" default: 0
let g:mkdp_refresh_slow = 0
" set to 1, the MarkdownPreview command can be use for all files,
" by default it can be use in markdown file
" default: 0
let g:mkdp_command_for_global = 0
" set to 1, preview server available to others in your network
" by default, the server listens on localhost (127.0.0.1)
" default: 0
let g:mkdp_open_to_the_world = 0
" use custom IP to open preview page
" useful when you work in remote vim and preview on local browser
" more detail see: https://github.com/iamcco/markdown-preview.nvim/pull/9
" default empty
let g:mkdp_open_ip = ''
" specify browser to open preview page
" for path with space
" valid: `/path/with\ space/xxx`
" invalid: `/path/with\\ space/xxx`
" default: ''
let g:mkdp_browser = ''
" set to 1, echo preview page url in command line when open preview page
" default is 0
let g:mkdp_echo_preview_url = 0
" a custom vim function name to open preview page
" this function will receive url as param
" default is empty
let g:mkdp_browserfunc = ''
" options for markdown render
" mkit: markdown-it options for render
" katex: katex options for math
" uml: markdown-it-plantuml options
" maid: mermaid options
" disable_sync_scroll: if disable sync scroll, default 0
" sync_scroll_type: 'middle', 'top' or 'relative', default value is 'middle'
" middle: mean the cursor position alway show at the middle of the preview page
" top: mean the vim top viewport alway show at the top of the preview page
" relative: mean the cursor position alway show at the relative positon of the preview page
" hide_yaml_meta: if hide yaml metadata, default is 1
" sequence_diagrams: js-sequence-diagrams options
" content_editable: if enable content editable for preview page, default: v:false
" disable_filename: if disable filename header for preview page, default: 0
let g:mkdp_preview_options = {
\ 'mkit': {},
\ 'katex': {},
\ 'uml': {},
\ 'maid': {},
\ 'disable_sync_scroll': 0,
\ 'sync_scroll_type': 'middle',
\ 'hide_yaml_meta': 1,
\ 'sequence_diagrams': {},
\ 'flowchart_diagrams': {},
\ 'content_editable': v:false,
\ 'disable_filename': 0,
\ 'toc': {}
\ }
" use a custom markdown style must be absolute path
" like '/Users/username/markdown.css' or expand('~/markdown.css')
let g:mkdp_markdown_css = ''
" use a custom highlight style must absolute path
" like '/Users/username/highlight.css' or expand('~/highlight.css')
let g:mkdp_highlight_css = ''
" use a custom port to start server or empty for random
let g:mkdp_port = ''
" preview page title
" ${name} will be replace with the file name
let g:mkdp_page_title = '「${name}」'
" recognized filetypes
" these filetypes will have MarkdownPreview... commands
let g:mkdp_filetypes = ['markdown']
" set default theme (dark or light)
" By default the theme is define according to the preferences of the system
let g:mkdp_theme = 'dark'
" }}}
" VIM-TAG --------------------------------------------------------------- {{{
"
" filenames like *.xml, *.html, *.xhtml, ...
" These are the file extensions where this plugin is enabled.
"
let g:closetag_filenames = '*.html,*.xhtml,*.phtml'
" filenames like *.xml, *.xhtml, ...
" This will make the list of non-closing tags self-closing in the specified files.
"
let g:closetag_xhtml_filenames = '*.xhtml,*.jsx'
" filetypes like xml, html, xhtml, ...
" These are the file types where this plugin is enabled.
"
let g:closetag_filetypes = 'html,xhtml,phtml'
" filetypes like xml, xhtml, ...
" This will make the list of non-closing tags self-closing in the specified files.
"
let g:closetag_xhtml_filetypes = 'xhtml,jsx'
" integer value [0|1]
" This will make the list of non-closing tags case-sensitive (e.g. `<Link>` will be closed while `<link>` won't.)
"
let g:closetag_emptyTags_caseSensitive = 1
" dict
" Disables auto-close if not in a "valid" region (based on filetype)
"
let g:closetag_regions = {
\ 'typescript.tsx': 'jsxRegion,tsxRegion',
\ 'javascript.jsx': 'jsxRegion',
\ 'typescriptreact': 'jsxRegion,tsxRegion',
\ 'javascriptreact': 'jsxRegion',
\ }
" Shortcut for closing tags, default is '>'
"
let g:closetag_shortcut = '>'
" Add > at current position without closing the current tag, default is ''
"
let g:closetag_close_shortcut = '<leader>>'
" }}}
" EMMET-PLUGIN --------------------------------------------------------- {{{
let g:user_emmet_settings = {
\ 'variables': {'lang': 'ja'},
\ 'html': {
\ 'default_attributes': {
\ 'option': {'value': v:null},
\ 'textarea': {'id': v:null, 'name': v:null, 'cols': 10, 'rows': 10},
\ },
\ 'snippets': {
\ 'html:5': "<!DOCTYPE html>\n"
\ ."<html lang=\"en\">\n"
\ ."<head>\n"
\ ."\t<meta charset=\"${charset}\">\n"
\ ."\t<meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge\">\n"
\ ."\t<meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">\n"
\ ."\t<title></title>\n"
\ ."</head>\n"
\ ."<body>\n\t${child}|\n</body>\n"
\ ."</html>",
\ },
\ },
\}
" }}}
" RAINBOW PARENTHESES -------------------------------------------------- {{{
" https://github.com/frazrepo/vim-rainbow
let g:rainbow_ctermfgs = ['lightblue', 'lightgreen', 'yellow', 'red', 'magenta']
"}}}
" MULTI-CURSOR --------------------------------------------------------- {{{
" https://github.com/mg979/vim-visual-multi
"To make a basic selection, use the Ctrl+N keystroke in normal mode, followed by a motion:
"c change text.
"I insert at start of range.
"A insert at end of range.
let g:multi_cursor_use_default_mapping=0
" Default mapping
let g:multi_cursor_start_word_key = '<C-n>'
let g:multi_cursor_select_all_word_key = '<A-n>'
let g:multi_cursor_start_key = 'g<C-n>'
let g:multi_cursor_select_all_key = 'g<A-n>'
let g:multi_cursor_next_key = '<C-n>'
let g:multi_cursor_prev_key = '<C-p>'
let g:multi_cursor_skip_key = '<C-x>'
let g:multi_cursor_quit_key = '<Esc>'
"}}}
" VIM-LIGHTLINE --------------------------------------------------------- {{{
" https://github.com/itchyny/lightline.vim
let g:lightline = {
\ 'colorscheme': 'wombat',
\ }
" }}}
"