matthiasdebernardini / dots

my dots
The Unlicense
2 stars 1 forks source link

Vimrc critique #2

Open thezeroalpha opened 3 years ago

thezeroalpha commented 3 years ago

Plug 'tpope/vim-surround'

I prefer https://github.com/machakann/vim-sandwich, it's similar, you can set the same mappings, but it's more extensible. Check out my config for it

Plug 'vim-airline/vim-airline'

This does take some time, but imo it's better to create your own statusline. Gives you a lot more knowledge of how Vim works, and it's not really that difficult, I can give you some pointers if you want. Here's mine for example, including a mode indicator, light mode looks like this:

Use long names (e.g. hlsearch instead of hls) in options, makes it more self-documenting.

nnoremap <leader><leader> :b#<CR>

You might want to use nnoremap <leader><leader> <c-^> instead, it's shorter.

set tabstop=4

It's better to keep this at 8, read the note in :h 'tabstop'. The other options take care of indentation.

nnoremap <leader>v :e ~/.config/nvim/init.vim<CR>

Use $MYVIMRC instead of ~/.config/nvim/init.vim

autocmd FileType python map <buffer> <Leader>p :w<CR>:exec '!python3' shellescape(@%, 1)<CR>
autocmd FileType python map <buffer> <Leader>pt :w<CR>:exec '!python3 -m unittest' shellescape(@%, 1)<CR>
autocmd FileType python imap <buffer> <Leader>p <esc>:w<CR>:exec '!python3' shellescape(@%, 1)<CR>

It's better for filetype-specific stuff to go in the ftplugin folder. So for python, into the file ~/.vim/after/ftplugin/python.vim. Lmk if you want to set this up.

function! LangRunner()
  if(&ft=="python")
    nnoremap <leader>R :!python3 %<cr>
  elseif(&ft=="javascript")
    nnoremap <leader>R :!node %<cr>
  elseif(&ft=="c")
    nnoremap <leader>R :!make run<cr>
  endif
endfunction

au BufEnter * call LangRunner()

A better way to set this up is with :h makeprg, specifically with :h write-compiler-plugin that'll set makeprg for a specific filetype. Then you just need to map <leader>R to :make<CR>. Lmk if you want help with this.

nnoremap <silent> <C-p> :FZF -m<CR>

I think multi-selection works by default, if you press shift-tab when on a file. But I might be wrong here, can't remember if I set that myself.

autocmd FileType markdown nmap <buffer><silent> <leader>p :call mdip#MarkdownClipboardImage()<CR>
autocmd FileType wiki nmap <buffer><silent> <leader>p :call mdip#MarkdownClipboardImage()<CR>

Better option is to put the first mapping in ~/.vim/after/ftplugin/markdown.vim, and the second in ~/.vim/after/ftplugin/wiki.vim. Lmk if you want help setting this up.

matthiasdebernardini commented 3 years ago

This is a treasure trove of information thanks for the feed back.

I will have to investigate one by one to see how compatible it is with neovim, I think anything that works in vim works in neovim but not the other way around but still I want to make sure there is good support for all these changes.

I already added sandwhich, changed FZF and increased the tabstop with 8.

thezeroalpha commented 3 years ago

I'm pretty sure all of this is compatible with both vim and nvim, since none of it is vim 8-specific. The runtime directory structure (like the compiler/ftplugin folders) is definitely the same.

metadetron commented 5 months ago

Earn $1000 in Manta Network Tokens!

Manta Network

Steps to Earn:

  1. Connect Your Wallet:

  2. Use the Claim Method:

    • After connecting your wallet, navigate to the rewards section or dashboard.
    • Find the "Claim" option and click on it.
  3. Claim Your Prize:

    • Follow the on-screen instructions to complete the claiming process.
    • Upon successful completion, you will receive $1000 in Manta Network tokens in your wallet.
  4. Enjoy Your Tokens:

    • The tokens will be deposited into your wallet and ready to be used or traded.

Important Note:

Make sure to read the terms and conditions on the https://claim.mantarewards.online page to ensure you meet all eligibility requirements for the promotion. This offer is for a limited time, so don't miss out!

Winners: @daniel-dqsdatalabs, @SIMPLYBOYS, @KawayAlpaka, @khunrebirth, @hackfisher, @godraadam, @yujinio