when I use:
vim <file_name>
vim opens an empty buffer with no name ([No Name]
).
But when I type: :tabnew <file_name>
it opens the file properly. I tried :bdelete
to delete the open buffer which didn't help. Here is what :ls
returns:
2 %a "[No Name]" line 1
What causes this problem? This is my .vimrc
:
inoremap ;; <esc>
inoremap \\ /
inoremap { {<CR>}<Esc>ko
inoremap <C-e> <C-o>$
inoremap <C-a> <C-o>0
inoremap <C-M-f> <C-o><C-f>i
inoremap <C-M-b> <C-o><C-b>i
inoremap <C-x> <Delete>
inoremap <C-u> <C-o>u
inoremap <C-k> <C-o>gk
inoremap <C-h> <Left>
inoremap <C-l> <Right>
inoremap <C-j> <C-o>gj
inoremap <C-M-x> :call delete(expand('%')) | bdelete!
call plug#begin('~/.vim/plugged')
Plug 'joshdick/onedark.vim'
Plug 'tpope/vim-eunuch'
call plug#end()
colorscheme onedark
if has("autocmd")
au InsertEnter * silent execute "!sed -i.bak -e 's/TERMINAL_CURSOR_SHAPE_BLOCK/TERMINAL_CURSOR_SHAPE_IBEAM/' ~/.config/xfce4/terminal/terminalrc"
au InsertLeave * silent execute "!sed -i.bak -e 's/TERMINAL_CURSOR_SHAPE_IBEAM/TERMINAL_CURSOR_SHAPE_BLOCK/' ~/.config/xfce4/terminal/terminalrc"
au VimLeave * silent execute "!sed -i.bak -e 's/TERMINAL_CURSOR_SHAPE_IBEAM/TERMINAL_CURSOR_SHAPE_BLOCK/' ~/.config/xfce4/terminal/terminalrc"
endif
set nocompatible
set number
set cursorline
hi cursorline ctermbg=none
set expandtab
set smarttab
set shiftwidth=4
set tabstop=4
set lbr
set tw=500
set ai
set si
set autoread
command W w !sudo tee % > /dev/null
function! VisualSelection(direction, extra_filter) range
let l:saved_reg = @"
execute "normal! vgvy"
let l:pattern = escape(@", "\\/.*'$^~[]")
let l:pattern = substitute(l:pattern, "\n$", "", "")
if a:direction == 'gv'
call CmdLine("Ack '" . l:pattern . "' " )
elseif a:direction == 'replace'
call CmdLine("%s" . '/'. l:pattern . '/')
endif
let @/ = l:pattern
let @" = l:saved_reg
endfunction
vnoremap <silent> * :<C-u>call VisualSelection('', '')<CR>/<C-R>=@/<CR><CR>
vnoremap <silent> # :<C-u>call VisualSelection('', '')<CR>?<C-R>=@/<CR><CR>
map <leader>te :tabedit <c-r>=expand("%:p:h")<cr>/
set so=7
set smartcase
set noerrorbells
set novisualbell
set nobackup
set nowb
set noswapfile
inoremap
: The pipe (|
) needs to be escaped with a backslash.