gpakosz / .tmux

🇫🇷 Oh my tmux! My self-contained, pretty & versatile tmux configuration made with ❤️
MIT License
21.96k stars 3.37k forks source link

Strange paste behavior #343

Closed nguxx closed 4 years ago

nguxx commented 4 years ago

Hello, When I'm pasting I get this indent alignement in vim it dues to the config set smartindent but hard not to use smartindent in vim... Would you know a trick to get a nice pasting in tmux AND smartindent set in vim ? This is how it comes


<?php
$CONFIG = array (
  'instanceid' => 'ocxoimhmt7dd',
    'passwordsalt' => 'e+HVWBcGxcjZKRIuhlICROKPgVRCcX',
      'secret' => 'T4QGrEYITx04+uXn7uPd/xLeEmNv3VfDBr521dUrg+btFSOS',
        'trusted_domains' =>
          array (
              0 => '35.180.73.94',
                ),
                  'datadirectory' => '/var/www/nextcloud/data',
                    'dbtype' => 'mysql',
                      'version' => '18.0.3.0',
                        'overwrite.cli.url' => 'http://35.180.73.94/nextcloud',
                          'dbname' => 'nextcloud',
                            'dbhost' => 'localhost',
                              'dbport' => '',
                                'dbtableprefix' => 'oc_',
                                  'dbuser' => 'nextclouduser',
                                    'dbpassword' => 'tom3ssap',
                                      'installed' => true,
                                        'memcache.locking' => '\OC\Memcache\Redis',
                                          //'memcache.distributed' => '\OC\Memcache\Redis',
                                            //'memcache.local' => '\OC\Memcache\Redis',
                                              'redis' => [
                                                  'host' => 'localhost',
                                                      'port' => 6379,
                                                          'timeout' => 3,
                                                            ],
                                                              );                                                         
gpakosz commented 4 years ago

Hello @nguxx 👋

⚠️ Do you realize your question has nothing to do with tmux?

That being said, you may want to try this in your ~/.vimrc:

" inverts paste mode
nnoremap <silent> <leader>pp :set paste! paste?<CR>
" same in insert mode
set pastetoggle=<leader>pp

If you want to paste with CTRL + V (or COMMAND + V on macOS) while in insert mode, you need to enable paste mode before doing so.

Another option is to use e.g. <leader> + p to paste from the OS clipboard while being in command mode:

" yank/paste to/from the OS clipboard
map <silent> <leader>y "+y
map <silent> <leader>Y "+Y
map <silent> <leader>p "+p
map <silent> <leader>P "+P

If these suggestions don't help, please look for Vim support, e.g. in the #vim IRC channel on Freenode.

nguxx commented 4 years ago

warning Do you realize your question has nothing to do with tmux?

Stricly speaking you right. But this behavior only appends when the cut comes from tmux so I asked myself if there were a way to treat it in .tmux.config. it seems not, you would know. Thanks for the tips even if I cannot make them work. I'm keeping on sneaking around...

nguxx commented 4 years ago

I've found a simple way to avoid this behavior here before pasting : :set paste and after :set nopaste or to get it with keybind in .vimrc set pastetoggle=<F3> hope it would help someone ;-) sorry for the disturbance