Skip to content

Instantly share code, notes, and snippets.

@jonnovaretti
Created November 18, 2023 12:55
Show Gist options
  • Save jonnovaretti/7b4f810fc19ebd2fac4d4c44a86afa6e to your computer and use it in GitHub Desktop.
Save jonnovaretti/7b4f810fc19ebd2fac4d4c44a86afa6e to your computer and use it in GitHub Desktop.
vimrc
" All system-wide defaults are set in $VIMRUNTIME/archlinux.vim (usually just
" /usr/share/vim/vimfiles/archlinux.vim) and sourced by the call to :runtime
" you can find below. If you wish to change any of those settings, you should
" do it in this file (/etc/vimrc), since archlinux.vim will be overwritten
" everytime an upgrade of the vim packages is performed. It is recommended to
" make changes after sourcing archlinux.vim since it alters the value of the
" 'compatible' option.
" This line should not be removed as it ensures that various options are
" properly set to work with the Vim-related packages.
runtime! archlinux.vim
" If you prefer the old-style vim functionalty, add 'runtime! vimrc_example.vim'
" Or better yet, read /usr/share/vim/vim80/vimrc_example.vim or the vim manual
" and configure vim to your own liking!
" do not load defaults if ~/.vimrc is missing
"let skip_defaults_vim=1
"
set number " Add numbers to each line on the left-hand side.
set nu
set hidden
set nowrap " Do not wrap lines
set clipboard=unnamedplus
set omnifunc=syntaxcomplete#Complete
set nocompatible "Disable compatibility with vi which can cause unexpected issues.
set nobackup " Do not save backup files.
set ignorecase " Ignore capital letters during search
set showcmd
set showmode
set history=1000
set wildmenu " Enable auto completion menu after pressing TAB.
set wildmode=list:longest " Make wildmenu behave like similar to Bash completion.
set wildignore=*.docx,*.jpg,*.png,*.gif,*.pdf,*.pyc,*.exe,*.flv,*.img,*.xlsx " Wildmenu will ignore files with these extensions
set signcolumn=number
set cursorline " Highlight cursor line underneath the cursor horizontally.
set scrolloff=10 " Do not let cursor scroll below or above N number of lines when scrolling.
set incsearch " While searching though a file incrementally highlight matching characters as you type.
set smartcase " Override the ignorecase option if searching for capital letters
set hlsearch " Use highlighting when doing a search.
filetype indent on "Load an indent file for the detected file type
filetype on "Enable type file detection. Vim will be able to try to detect the type of file in use.
filetype plugin on "Enable plugins and load plugin for the detected file type.
syntax on "Turn syntax highlighting on.
let g:ackprg = 'ag --vimgrep'
let g:auto_save = 1
let g:ale_sign_highlight_linenrs = 1
let g:ale_virtualtext_cursor = 'disabled'
let g:ale_fixers = {'ruby': ['rubocop','prettier']}
let g:ale_linters = { 'python': ['pylsp'] }
let g:ale_fix_on_save = 1
let g:LanguageClient_autoStop = 0
let g:LanguageClient_autoStart = 1
let g:LanguageClient_serverCommands = {
\ 'python': ['/usr/bin/pylsp'],
\ 'ruby': ['tcp://localhost:7658'],
\ }
let g:jedi#popup_on_dot = 0
let g:jedi#use_tabs_not_buffers = 1
" VIMSCRIPT -------------------------------------------------------------- {{{
"""""""
autocmd FileType ruby setlocal omnifunc=LanguageClient#complete
augroup python_syntax_extra
autocmd!
autocmd! Syntax <buffer> :syn keyword Keyword self
augroup END
augroup filetype_vim
autocmd!
autocmd FileType vim setlocal foldmethod=marker
augroup END
""""""
" }}}
" STATUS LINE ------------------------------------------------------------ {{{
" Clear status line when vimrc is reloaded.
set statusline=
" Status line left side.
set statusline+=\ %F\ %M\ %Y\ %R
" Use a divider to separate the left side from the right side.
set statusline+=%=
" Status line right side.
set statusline+=\ ascii:\ %b\ hex:\ 0x%B\ row:\ %l\ col:\ %c\ percent:\ %p%%
" Show the status on the second to last line.
set laststatus=2
" }}}
"
"""""""
call plug#begin()
Plug 'preservim/nerdtree'
Plug 'Xuyuanp/nerdtree-git-plugin'
Plug 'PhilRunninger/nerdtree-buffer-ops'
Plug 'dense-analysis/ale'
Plug 'autozimu/LanguageClient-neovim', {
\ 'branch': 'next',
\ 'do': 'bash install.sh',
\ }
Plug '907th/vim-auto-save'
Plug 'nordtheme/vim'
Plug 'cocopon/iceberg.vim'
Plug 'ngmy/vim-rubocop'
Plug 'davidhalter/jedi-vim' " autocomplete for python
Plug 'ervandew/supertab' " use tab to trigger autocomplete
call plug#end()
"""""""
colorscheme nord
"""""""
""" LanguageClient
nnoremap <F5> :call LanguageClient_contextMenu()<CR>
nnoremap <silent> K :call LanguageClient#textDocument_hover()<CR>
nnoremap <silent> <F12> :call LanguageClient#textDocument_definition()<CR>
nnoremap <silent> <F2> :call LanguageClient#textDocument_rename()<CR>
""" NERDTree
nnoremap <C-l> :NERDTreeFind<CR>
nnoremap <C-t> :NERDTreeToggle<CR>
""" FZF
nnoremap <C-f> :FZF<CR>
"""""""
""" Change theme sequence
map <F6> <ESC>:colorscheme iceberg <bar> :set bg=light <bar> :highlight Normal ctermfg=black ctermbg=white
map <F7> <ESC>:colorscheme nord
"""
""" Customized
nmap oo o<ESC>
nmap <C-c> <ESC>
nmap ss a<space><esc>
"""
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment