Vim ignores window splitting settings in netrw - vim

I would prefer if vim opens new windows on the right old window (when using vsplit) and under old window (when using split).
I read that I should set splitright and set splitbelow to my .vimrc. I added also g:netrw_altv=1 and g:netrw_alto=1. This settings doesn't work in netrw browser when I hit v button or type :vsplit file.txt.
My .vimrc:
syntax enable
set splitright
set splitbelow
let g:netrw_altv=1
let g:netrw_alto=1
set background=dar
colorscheme solarized
let g:solarized_termtrans=1
set t_Co=256
set expandtab
set tabstop=4
set shiftwidth=4
set smartindent
set smarttab
set gfn=Inconsolata\ Medium\ 11
set hls
set showmatch
set smartcase
set wildmenu
map <F2> :retab <CR> :wq! <CR>

In my case it was a bug in netrw. Updating it solved it.
http://www.vim.org/scripts/script.php?script_id=1075

Strange, as :vsp opens a new split on the right, and :sp on the bottom even without the options in my machine. You might want to take a look at this thread: http://tech.groups.yahoo.com/group/vim/message/51334

Related

What is set mouse = a for in nvim?

I'm not sure I can ask this question, but I can't find information about what mouse = a is for, I just find that it can no longer be copied or pasted with "ctrl + c" and "ctrl + v", however I manage to do as I normally would, I want to know what is the use of set "mouse=a", If it works for me or not, or in which cases it would work for me, because all I find is that error, I could not even find it on the vim page, it would be very good if you could show me a page where I can know what each part of my init.vim shown below thank you very much for your understanding.
I clarify that I just installed neovim on Windows 10, I am completely a noob at this
set mouse=a
set numberwidth=1
set clipboard=unnamed
syntax enable
set showcmd
set ruler
set cursorline
set encoding=utf-8
set showmatch
set signcolumn=yes
set noexpandtab
set tabstop=4 shiftwidth=4
filetype plugin indent on
set list
set relativenumber
so ~/.vim/plugins.vim
so ~/.vim/plugin-config.vim
so ~/.vim/maps.vim
colorscheme gruvbox
let g:gruvbox_contrast_dark = "hard"
"highlight Normal ctermbg=NONE
set laststatus=2
set noshowmode
" Javascript
autocmd BufRead *.js set filetype=javascript.jsx
autocmd BufRead *.jsx set filetype=javascript.jsx
augroup filetype javascript syntax=javascript
"" Searching
set hlsearch " highlight matches
set incsearch " incremental searching
set ignorecase " searches are case insensitive...
set smartcase " ... unless they contain at least one capital letter
:set mouse=a the 'a' means all vim modes: visual, normal, insert, command line.
This is the help of vim:
'mouse' string (default "", "a" for GUI, MS-DOS and Win32,
set to "a" or "nvi" in defaults.vim)
global
Enable the use of the mouse. Works for most terminals (xterm, MS-DOS,
Win32 win32-mouse, QNX pterm, *BSD console with sysmouse and Linux
console with gpm). For using the mouse in the GUI, see gui-mouse.
The mouse can be enabled for different modes:
n Normal mode and Terminal modes
v Visual mode
i Insert mode
c Command-line mode
h all previous modes when editing a help file
a all previous modes
r for hit-enter and more-prompt prompt
Normally you would enable the mouse in all five modes with:
:set mouse=a
If your terminal can't overrule the mouse events going to the
application, use:
:set mouse=nvi
The you can press ":", select text for the system, and press Esc to go
back to Vim using the mouse events.
In defaults.vim "nvi" is used if the 'term' option is not matching
"xterm".
When the mouse is not enabled, the GUI will still use the mouse for
modeless selection. This doesn't move the text cursor.

gVim 7.4 for Windows, Windows 7: Windowing issues and mouse weirdness

Out of nowhere, I started having weird issues with gVim. Here's a short list:
When I try to move the window with my mouse, clicking the title bar puts vim into Insert mode, and the window won't move.
Sometimes, if I click again, vim goes back into Command mode. Sometimes it doesn't.
Sometimes, the window moves. Sometimes, it doesn't.
Sometimes, clicking the title bar and dragging highlights text.
Sometimes, when I try to switch back to Insert mode and insert text wherever my cursor is, the cursor jumps to the beginning of the line.
What's killing me is that I haven't made any changes to my vimrc or gvimrc. This happened out of nowhere.
I reinstalled gVim, and nothing changed.
Here's my gvimrc, which lives on disk at C:\Users\jpavlick\_gvimrc:
colors desert
set guifont=Consolas
set guioptions=m
set guioptions=t
set listchars=tab:>-,nbsp:-
set list
Here's my vimrc, which lives on disk at C:\Users\jpavlick\_vimrc:
set nu
set tabstop=4
set shiftwidth=4
set backspace=indent,eol,start
syntax on
set autoindent
au BufReadPost *.cshtml set syntax=html
au BufReadPost *.edi set syntax=edifile
au BufReadPost *.sql set syntax=tsql
autocmd Filetype ruby setlocal ts=2 sts=2 sw=2 expandtab

When I press enter and create a new line in vim while editing CSS, it gives me two tabs instead of just one

I debated with myself whether to post it on SuperUser but I did it here.
When I have this in CSS, editing it in VIM:
#container {
then I press Return at the bracket to give me a new line, it sends the cursor two tabs to the left on the next line:
#container {
|
Instead of like this, how I want it.
#container {
|
how could I edit the .vimrc file to give me only one new tab on the next line instead of two?
My .vimrc file.
set ts=4
imap <C-Return> <CR><CR><C-o>k<Tab>
set cindent
set nocompatible
filetype indent plugin on
syntax on
set hidden
set wildmenu
set showcmd
set hlsearch
set ignorecase
set smartcase
set backspace=indent,eol,start
set autoindent
set nostartofline
set ruler
set laststatus=2
set confirm
set visualbell
set t_vb=
set mouse=a
set cmdheight=2
set number
set notimeout ttimeout ttimeoutlen=200
set pastetoggle=<F11>
set shiftwidth=2
set tabstop=1
map Y y$
nnoremap <C-L> :nohl<CR><C-L>
Thanks.
I believe your issue is that your shiftwidth is twice your tabstop. You are also setting tabstop twice, once at the top to 4 and again at the bottom to 1.
Try setting shiftwidth to the same at tabstop, there really aren't many cases that you'd want these two to be different.

How to set up vim allowing to use tabs and 4spaces

I want normally always use four spaces to indent code.
Unfortunately for example Makefiles enforce the use of tabs as separator.
My idea now was to set the tab key to four spaces and some extra key (e.g. tab + shift) for the real tabs.
How do I set something like this up?
Currently my ~/.vimrc looks like:
syntax on
:set tabstop=4
:set cindent
:set autoindent
You may prefer something like this as well:
set expandtab
autocmd FileType make setlocal noexpandtab
This will always convert tabs to spaces, except when you are editing Makefiles.
Ctrl+V Tab will insert a literal tab, even if expandtab is set. If you prefer, you can map this to Shift+Tab with :inoremap <s-tab> <c-v><tab>.
You need to use shiftwidth, e.g.,
:set shiftwidth=4
:set expandtab
You may also need to use this command to convert existing tabs to spaces:
:retab
:filetype plugin on should be enough to have the tab key always insert real tabs in makefiles, using file type detection.
See :help vimrc-filetype.
While I generally prefer to convert everything to spaces, I have a specific command in my .vimrc to prevent doing so in makefiles. First I activate expandtab and set shiftwidth, but then I turn off expandtab for makefiles. Order is important here.
set shiftwidth=4
set expandtab
if has('autocmd')
autocmd FileType make set noexpandtab
endif
I also recommend the following, as they are somewhat related and possibly helpful:
set softtabstop=4
set shiftwidth=4
set smarttab
set autoindent

Can someone help fix my vimrc config?

set nohlsearch
set ai
set bg=dark
set showmatch
highlight SpecialKey ctermfg=DarkGray
set listchars=tab:>-,trail:~
set list
autocmd BufRead *.py set smartindent cinwords=if,elif,else,for,while,try,except,finally,def,class
set tabstop=4
set shiftwidth=4
set expandtab
set autoindent
set smartindent
syntax on
set listchars=tab:>-
set listchars+=trail:.
set ignorecase
set smartcase
map <C-t><up> :tabr<cr>
map <C-t><down> :tabl<cr>
map <C-t><left> :tabp<cr>
map <C-t><right> :tabn<cr>
map <F1> <Esc>
imap <F1> <Esc>
set pastetoggle=<F5>
This is my vimrc. I want to fix it so that it doesn't show >---- >---- when other people tab. Thank.
Remove these lines:
set listchars=tab:>-,trail:~
set listchars=tab:>-
set list
is doing this. You can
:set nolist
if it is bothering you but I recommend keeping it for python files (you might be coding in python looking at that autocommand). ie. ... Learn to love it. create a mapping if it is a regular issue.
Also there is
:retab
to remove tabs if you have an expandtab setting.

Resources