1

I'm going nuts trying to get this mapping to work. It's so simple yet doesn't work.

with the mapping removed moves me off of nerd tree to the main window to it's right. Great.

When I added the following mapping, nothing happens with z;

nnoremap ; l 
nnoremap l k 
nnoremap k j 
nnoremap j h 

nnoremap <C-W><Up> zl
nnoremap <C-W><Down> zk
nnoremap <C-W><Left> zj
nnoremap <C-W><Right> z; 

EDIT: I've pasted my entire vimrc below:

set tabstop=2
set softtabstop=2
set shiftwidth=2
set expandtab
set textwidth=0
set backspace=indent,eol,start
set laststatus=1
set winwidth=9
set backupcopy=yes
syntax on
filetype plugin on
colorscheme molokai
set wildignore+=*/node_modules/*,*/migrations/*,*.swp,
set t_Co=256

nnoremap ; l
nnoremap l k
nnoremap k j
nnoremap j h

nmap <C-W><Down> zk
nnoremap <C-W><Right> zl

set number
set nowrap
set cursorline
set autoindent
set splitright
set splitbelow
set copyindent
set preserveindent

call plug#begin('~/.vim/plugged')

Plug 'scrooloose/nerdtree'
Plug 'vim-syntastic/syntastic'
Plug 'nvie/vim-flake8'
Plug 'vim-airline/vim-airline'
Plug 'vim-airline/vim-airline-themes'
Plug 'scrooloose/nerdcommenter'
Plug 'ntpeters/vim-better-whitespace'
Plug 'ap/vim-css-color'
Plug 'pangloss/vim-javascript'
Plug 'mxw/vim-jsx'
Plug 'ctrlpvim/ctrlp.vim'
Plug 't9md/vim-choosewin'
Plug 'tikhomirov/vim-glsl'

call plug#end()

set statusline+=%#warningmsg#
set statusline+=%{SyntasticStatuslineFlag()}
set statusline+=%*

let g:syntastic_always_populate_loc_list = 1
let g:syntastic_loc_list_height = 5
let g:syntastic_auto_loc_list = 0
let g:syntastic_check_on_open = 1
let g:syntastic_check_on_wq = 1
let g:syntastic_check_on_w = 1
let g:syntastic_javascript_checkers = ['eslint']

let g:syntastic_error_symbol = 'x'
let g:syntastic_warning_symbol = '~'
let g:syntastic_style_error_symbol = '⚠️'
let g:syntastic_style_warning_symbol = '💩'

let NERDTreeShowHidden=1
autocmd vimenter * NERDTree
let g:NERDTreeDirArrowExpandable = '>'
let g:NERDTreeDirArrowCollapsible = 'v'

highlight link SyntasticErrorSign SignColumn
highlight link SyntasticWarningSign SignColumn
highlight link SyntasticStyleErrorSign SignColumn
highlight link SyntasticStyleWarningSign SignColumn

" ---- PEP8 ----
"" Ignore module level import, and line too long.
let g:pymode_lint_ignore="E402,E501"

" choosewin
nmap - <Plug>(choosewin)
let g:choosewin_overlay_enable = 1
  • 2
    Your question is very unclear; I’ve added an answer guessing at your intentions, but the best thing to do would be to edit your question to ask a direct question, and provided details about what you want to accomplish. – D. Ben Knoble Dec 26 '18 at 22:01
  • You're right, it is unclear... the problem is I got this to work on a different machine which is currently out of reach and on this machine it isn't working. It's so simple, it should just work. I have a feeling something else is breaking. I'm going to copy paste my whole vimrc in the OP – Jason McCarrell Dec 26 '18 at 22:39
1

If you expect <C-w><Right> to do the equivalent of zl when all is said and done (that is, if you want the ; map recursively expanded), you need nmap in place of nnoremap.

That said, I would prefer to just

nnoremap <C-W><Right> zl

So that everything is clear; I don’t have to hunt down the semicolon mapping this way.

  • I tried that and still NEITHER zl or z; work. I know ctrl+w, right is being absorbed, because it no longer works. Something else must be getting in the way eh? – Jason McCarrell Dec 26 '18 at 22:40
  • 1
    @JasonMcCarrell indeed. I’m going to go find statox’s canonical “how to debug a mapping” and link you to t – D. Ben Knoble Dec 27 '18 at 0:39
  • 1
    @JasonMcCarrell vi.stackexchange.com/q/7722/10604 – D. Ben Knoble Dec 27 '18 at 0:40
  • wasted a few hours just yesterday, trying to figure out why a mapping doesn't work in vim, turned out it was because I started with an empty vimrc (clean environment heh) that lacked set nocompatible – AnonymousLurker Dec 27 '18 at 6:53
1

I had the mapping reversed. I was taking the command <c-w><Right> and turning it into z;, but what i wanted to do was take z; and turn it into <c-w><Right> so z; switched screens to the right.

Thanks D. Ben Knoble for pointing out the canonical "how to debug a mapping".

I ran :map z; and found nothing... confused i ran :map <c-w><Right> and got back z; and that's when i realized my mistake.

Gotta remember:

map <what you want to press> <what you want to do>

Not the opposite.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.