" The default vimrc file. " " Maintainer: Bram Moolenaar Bram@vim.org " Last change: 2020 Sep 30 " " This is loaded if no vimrc file was found. " Except when Vim is run with “-u NONE” or “-C”. " Individual settings can be reverted with “:set option&”. " Other commands can be reverted as mentioned below.
" When started as “evim”, evim.vim will already have done these settings. if v:progname =~? “evim” finish endif
" Bail out if something that ran earlier, e.g. a system wide vimrc, does not " want Vim to use these default values. if exists(‘skip_defaults_vim’) finish endif
" Use Vim settings, rather than Vi settings (much better!). " This must be first, because it changes other options as a side effect. " Avoid side effects when it was already reset. if &compatible set nocompatible endif
" When the +eval feature is missing, the set command above will be skipped. " Use a trick to reset compatible only when the +eval feature is missing. silent! while 0 set nocompatible silent! endwhile
" Allow backspacing over everything in insert mode. set backspace=indent,eol,start
set history=600 " keep 200 lines of command line history set ruler " show the cursor position all the time set showcmd " display incomplete commands set wildmenu " display completion matches in a status line
set ttimeout " time out for key codes set ttimeoutlen=100 " wait up to 100ms after Esc for special key
" Show @@@ in the last line if it is truncated. set display=truncate
" Show a few lines of context around the cursor. Note that this makes the " text scroll if you mouse-click near the start or end of the window. set scrolloff=5
" Do incremental searching when it’s possible to timeout. if has(‘reltime’) set incsearch endif
" Do not recognize octal numbers for Ctrl-A and Ctrl-X, most users find it " confusing. set nrformats-=octal
" For Win32 GUI: remove ’t’ flag from ‘guioptions’: no tearoff menu entries. if has(‘win32’) set guioptions-=t endif
" Don’t use Ex mode, use Q for formatting. " Revert with “:unmap Q”. map Q gq
" CTRL-U in insert mode deletes a lot. Use CTRL-G u to first break undo,
" so that you can undo CTRL-U after inserting a line break.
" Revert with “:iunmap
" In many terminal emulators the mouse works just fine. By enabling it you " can position the cursor, Visually select and scroll with the mouse. " Only xterm can grab the mouse events when using the shift key, for other " terminals use “:”, select text and press Esc. if has(‘mouse’) if &term =~ ‘xterm’ set mouse=a else set mouse=nvi endif endif
" Only do this part when Vim was compiled with the +eval feature. if 1
" Enable file type detection. " Use the default filetype settings, so that mail gets ’tw’ set to 72, " ‘cindent’ is on in C files, etc. " Also load indent files, to automatically do language-dependent indenting. " Revert with “:filetype off”. filetype plugin indent on
" Put these in an autocmd group, so that you can revert them with: " “:augroup vimStartup | au! | augroup END” augroup vimStartup au!
" 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
augroup END
endif
" Switch syntax highlighting on when the terminal has colors or when using the " GUI (which always has colors). if &t_Co > 2 || has(“gui_running”) " Revert with “:syntax off”. syntax on
" I like highlighting strings inside C comments. " Revert with “:unlet c_comment_strings”. let c_comment_strings=1 endif
" Convenient command to see the difference between the current buffer and the " file it was loaded from, thus the changes you made. " Only define it when not defined already. " Revert with: “:delcommand DiffOrig”. if !exists(":DiffOrig") command DiffOrig vert new | set bt=nofile | r ++edit # | 0d_ | diffthis \ | wincmd p | diffthis endif
if has(’langmap’) && exists(’+langremap’) " Prevent that the langmap option applies to characters that result from a " mapping. If set (default), this may break plugins (but it’s backward " compatible). set nolangremap endif "
" Mapear atalhos -> Linguagem C " Folder em códigos: " Folder References: usr_28.txt " Compila direto do VIM ^^ –(¨U¨)– " " Minhas Modificações " " Define uma quebra automática " de linha após 60 caractere set textwidth=60 set softtabstop=3 set tabstop=3 set shiftwidth=3
imap ( ()
set number
" Para arquivos de linguagem Python
augroup filetypedetect
au BufEnter .py,.PY imap
au BufEnter .py,.PY set softtabstop=4 tabstop=4 shiftwidth=4
au BufEnter .py,.PY imap { {}
" Para arquivos de linguagem C
augroup filetypedetect
au BufEnter .c,.cpp,Makefile,.h let g:syntastic_c_checkers=[‘make’,‘splint’]
au BufEnter .c,.cpp,Makefile,.h map
" Para VHDL
augroup filetypedetect
"
augroup filetypedetect
“- “au BufEnter .sv,.SV set textwidth=60
au BufEnter .sv,.SV imap ::
augroup filetypedetect " ChatGPT " https://stackoverflow.com/questions/17365324/auto-save-in-vim-as-you-type " https://vim.fandom.com/wiki/Auto-save_current_buffer_periodically " au BufEnter .md,.MD” autocmd BufLeave,InsertLeave * silent! write
" https://vi.stackexchange.com/questions/24806/how-to-open-a-terminal-horizontally-on-the-right-side-of-vim
" https://stackoverflow.com/questions/4111696/display-name-of-the-current-file-in-vim
" au BufEnter *.md,*.MD" nnoremap <F6> :wa<CR>:vert botright term lookatme % <CR>
au BufEnter *.md,*.MD" imap ` <C-R>= "```" <CR>
nnoremap <F6> :autocmd BufLeave,InsertLeave * silent! write <CR>:vert botright term lookatme % --live <CR><C-W>h
nnoremap <F5> :autocmd TextChanged,TextChangedI * silent! write <CR>:vert botright term lookatme % --live <CR><C-W>h
augroup END
" " let g:syntastic_c_include_dirs = [’../freertos/include/’]
" Nots: " :mkview -> Salva a visualização atual " :loadview -> restaura a visualização salva
" Mapear atalhos -> Linguagem Python " Executa o codigo " Abre e fecha parenteses
imap ( ()
set number
" " based on https://github.com/prabirshrestha/vim-lsp/wiki/Servers-Clangd “- “if executable(‘clangd’) “- “au User lsp_setup call lsp#register_server({ “- “\ ’name’: ‘clangd’, “- “\ ‘cmd’: {server_info->[‘clangd’, ‘-background-index’]}, “- “\ ‘whitelist’: [‘c’, ‘cpp’, ‘objc’, ‘objcpp’], “- “\ }) “- “else “- “let ex = exists(“g:lsp_clangd_ignore_warning”) “- “if !ex || (ex && !g:lsp_clangd_ignore_warning) “- “echo “Cannot find clangd” “- “echo “Use ’let g:lsp_clangd_ignore_warning = 1’ if you do not want to see this warning” “- “endif “- “endif
" “let g:syntastic_debug=1 set statusline+=%#warningmsg# set statusline+=%{SyntasticStatuslineFlag()} set statusline+=%*
“- let g:syntastic_always_populate_loc_list = 1 “- let g:syntastic_auto_loc_list = 1 “- let g:syntastic_check_on_open = 1 “- let g:syntastic_check_on_wq = 0 “- "
" Habilitar o ALE let g:ale_enabled = 1
“- “syntax enable “- “colorscheme solarized “- " “- “if has(‘gui_running’) “- “set background=light “- “else “- “set background=dark “- “endif
" “let g:solarized_termcolors=256