Skip to content

Instantly share code, notes, and snippets.

@mhtocs
Last active October 8, 2023 15:43
Show Gist options
  • Save mhtocs/1f712f8dde270c045ce044be3800d9e0 to your computer and use it in GitHub Desktop.
Save mhtocs/1f712f8dde270c045ce044be3800d9e0 to your computer and use it in GitHub Desktop.
my nvim config

screenshot2

screenshot

config

description: manjaro
release: 20.0.3
codename: lysia
de: xfce 20 minimal
nvim: v0.4.3
font: monospace regular 9
{
"coc.preferences.formatOnSaveFiletypes": ["rust", "py", "yaml", "json"],
"python.linting.flake8Enabled": true,
"python.formatting.provider": "black"
}
"startup time 34ms
"nerdtree is too slow; so disabled by default
"enable blinking cursor
set guicursor=n-v-:block,i-ci-ve:ver25,r-cr:hor20,o:hor50
\,a:blinkwait700-blinkoff400-blinkon250-Cursor/lCursor
\,sm:block-blinkwait175-blinkoff150-blinkon175
set noshowmatch
"set relativenumber
set nohlsearch
set hidden
set noerrorbells
set tabstop=4 softtabstop=4
set shiftwidth=4
set expandtab
set smartindent
set nu
set nowrap
set smartcase
set noswapfile
set nobackup
set undodir=~/.config/nvim/undodir
set undofile
set incsearch
set termguicolors
set ffs=unix
set encoding=utf-8
set fileencoding=utf-8
set listchars=eol:¶
set list
"set scrolloff=8
set colorcolumn=80
highlight ColorColumn ctermbg=0 guibg=lightgrey
call plug#begin()
Plug 'dstein64/vim-startuptime'
Plug 'morhetz/gruvbox'
" Plug 'sjl/badwolf'
" Plug 'nanotech/jellybeans.vim'
" Plug 'jremmen/vim-ripgrep'
Plug 'tpope/vim-fugitive'
" Plug 'vim-utils/vim-man'
"Plug 'lyuts/vim-rtags'
Plug 'vim-scripts/ctrlp.vim'
Plug 'mbbill/undotree'
Plug 'wincent/terminus'
" Plug 'preservim/nerdtree'
Plug 'andymass/vim-matchup'
Plug 'tpope/vim-commentary'
Plug 'dense-analysis/ale'
Plug 'neoclide/coc.nvim', { 'branch': 'release' }
Plug 'airblade/vim-gitgutter'
" ctrl+D , ctrl+f
Plug 'psliwka/vim-smoothie'
call plug#end()
colorscheme gruvbox
set background=dark
set showtabline=2
set laststatus=2
"let g:badwolf_darkgutter = 1
" Make <CR> to accept selected completion item or notify coc.nvim to format
" <C-g>u breaks current undo, please make your own choice.
inoremap <silent><expr> <CR> coc#pum#visible() ? coc#pum#confirm()
\: "\<C-g>u\<CR>\<c-r>=coc#on_enter()\<CR>"
" Change highlighting of cursor line when entering/leaving Insert Mode
" set cursorline
" highlight CursorLine cterm=NONE ctermfg=NONE ctermbg=233 guifg=NONE guibg=#121212
" autocmd InsertEnter * highlight CursorLine cterm=NONE ctermfg=NONE ctermbg=234 guifg=NONE guibg=#1c1c1c
" autocmd InsertLeave * highlight CursorLine cterm=NONE ctermfg=NONE ctermbg=233 guifg=NONE guibg=#121212
" if executable('rg')
" let g:rg_derive_root='true'
" endif
let loaded_matchparen = 1
let g:netrw_browse_split = 2
let g:netrw_banner = 0
let g:netrw_winsize = 30
let g:ctrlp_use_caching = 0
let g:rustfmt_autosave = 1
let g:vrfr_rg = 'true'
let g:undotree_SplitWidth = 50
let g:loaded_matchit = 1
let mapleader = ","
autocmd CursorHold * silent call CocActionAsync('highlight')
" nnoremap <silent> <leader>c :!cargo clippy <CR>
" nnoremap <silent> <leader>r :!cargo run <CR>
" nnoremap <silent> <leader>u :UndotreeToggle <CR>
" nnoremap <silent> <leader>s :CtrlP <CR>
" nnoremap <silent> <leader>i :call CocActionAsync('codeAction', '', 'Implement missing members')<CR>
nmap <silent> gd <Plug>(coc-definition)
nmap <silent> gy <Plug>(coc-type-definition)
nmap <silent> gi <Plug>(coc-implementation)
nmap <silent> gr <Plug>(coc-references)
nmap <silent> rn <Plug>(coc-rename)
"save format reload
"nnoremap <silent> <leader>s :w <CR> :!black % <CR><CR> <bar> :e <CR>
map <C-u> :UndotreeToggle<CR>
map <C-n> :NERDTreeToggle<CR>
"autocmd are executed in order they are defined
":autocmd BufWritePost *.py silent !black <afile> "format when save
":autocmd BufWritePost *.py :e "reload
"
let g:ale_fixers = { 'elixir': ['mix_format'], 'python': ['yapf'] }
" let g:mix_format_on_save = 1
" let g:mix_format_silent_errors = 1
let g:ale_fix_on_save = 1
au BufNewFile,BufRead *.py
\ set expandtab " replace tabs with spaces
\ set autoindent " copy indent when starting a new line
\ set tabstop=4
\ set softtabstop=4
\ set shiftwidth=4
function! LinterStatus() abort
let l:counts = ale#statusline#Count(bufnr(''))
let l:all_errors = l:counts.error + l:counts.style_error
let l:all_non_errors = l:counts.total - l:all_errors
return l:counts.total == 0 ? '✨ all good ✨' : printf(
\ '😞 %dW %dE',
\ all_non_errors,
\ all_errors
\)
endfunction
set statusline=
set statusline+=%m
set statusline+=\ %f
set statusline+=%=
set statusline+=\ %{LinterStatus()}
let g:clang_format#auto_format = 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment