I would like to open nvim with defx by default instead of Nerdtree. Have no idea how to change that behaviour
I am using defx and can open it through mapping with sf custom mapping command, but for that i should be already in nvim so it takes me two steps.
vim
sf
Sf lives in maps.vim
" Description: Keymaps
" defx
nnoremap <silent>sf :<C-u>Defx -listed -resume
\ -columns=indent:mark:icon:icons:filename:git:size
\ -buffer-name=tab`tabpagenr()`
\ `expand('%:p:h')` -search=`expand('%:p')`<CR>
Can i open defx with
nvim .
I can disable nerdtree from opening in nvim/init.vim
" Disable netrw
let g:loaded_netrwPlugin = 1
but even with it I should do sf to open defx
so the answer from creator #Shougo was
https://gitter.im/Shougo/defx.nvim?at=61abfda5b5ba9e5a11ef079e
autocmd BufEnter,VimEnter,BufNew,BufWinEnter,BufRead,BufCreate
\ * if isdirectory(expand('<amatch>'))
\ | call s:browse_check(expand('<amatch>')) | endif
function! s:browse_check(path) abort
if bufnr('%') != expand('<abuf>')
return
endif
" Disable netrw.
augroup FileExplorer
autocmd!
augroup END
execute 'Defx' a:path
endfunction
Related
I have a ~/.mitmproxy/keys.yaml hotkey config file for mitmproxy and a part of the file is as follows.
-
key: ctrl f
cmd: set view_filter '!(~t "text/html" | ~t "text/css" | ~t "image/" | ~t "/javascript")'
-
key: ctrl i
cmd: set view_filter ''
So I use often a long view_filter command so I added it to the file, as specified on "ctrl f" above.
When I hit ctrl-f I can get the filter onto the mitmproxy viewer instantly, that's great, but usually I want to revert that filter back to the default empty one.
So I added set view_filter '' command with the "ctrl i" hotkey on the file as above. But It didn't work as expected, when I hit ctrl-i, it does nothing, no error on the log.
So how can I make/reset a option (view_filter) default?
I installed the latest branch of coc but have been having trouble using it.
For some reason, whenever I enter Insert mode, this error keeps flashing:
[coc.nvim] error: at NeovimClient.emitNotification (/Users/carlosgrijalva/.vim/plugged/coc.nvim/build/index.js:1
I also attempted to install certain extensions like coc-tsserver and got the following error:
[coc.nvim] Error on install coc-tsserver: Error: coc-tsserver 1.6.3 requires coc.nvim >= >=0.0.79, please update coc
.nvim.
Not sure what's going on since i'm using the latest release. Below is my .vimrc:
" PLUGINS
" ===================================
call plug#begin('~/.vim/plugged')
Plug 'morhetz/gruvbox'
Plug 'neoclide/coc.nvim', {'branch': 'release'}
Plug 'vim-airline/vim-airline'
Plug 'vim-airline/vim-airline-themes'
Plug 'junegunn/fzf', { 'do': { -> fzf#install()} }
Plug 'junegunn/fzf.vim'
call plug#end()
" VIM General
" ===================================
set nocompatible
syntax on
set showmode " Shows mode at bottom of window
set relativenumber " Relative number line
set showmatch " Show matching brackets.
set smartcase " Do smart case matching
set smartindent " Do smart indenting
set incsearch " Incremental search
nnoremap <Leader><space> :noh<Enter>
set number " Show line numbers
set noswapfile " Disables creating swap files
set undodir=~/.vim/undodir
set tabstop=2
set shiftwidth=2
let g:gruvbox_contrast_dark='hard'
set termguicolors
colorscheme gruvbox
set background=dark
imap jj <Esc>
let mapleader=","
You're not using the latest coc.nvim release, try to delete ~/.vim/plugged/coc.nvim and install again.
I am trying to setup Vundle on Windows 10 (Version 20H2 OS Build 19042.630) and, after following these steps exactly (install git and curl from chocolatey, install gVim from here, clone Vundle) I am unable to use PluginInstall and instead get the following error: Not an editor command: PluginInstall. I can run vim and can confirm that a _vimrc exists at C:\Users\myusername\_vimrc and the `_vimrc currently contains (straight from the docs):
filetype off
set shellslash
set rtp+=~/vimfiles/bundle/Vundle.vim
call vundle#begin('~/vimfiles/bundle')
" let Vundle manage Vundle, required
Plugin 'VundleVim/Vundle.vim'
" All of your Plugins must be added before the following line
call vundle#end() " required
filetype plugin indent on " required
" To ignore plugin indent changes, instead use:
"filetype plugin on
"
" Brief help
" :PluginList - lists configured plugins
" :PluginInstall - installs plugins; append `!` to update or just :PluginUpdate
" :PluginSearch foo - searches for foo; append `!` to refresh local cache
" :PluginClean - confirms removal of unused plugins; append `!` to auto-approve removal
"
" see :h vundle for more details or wiki for FAQ
" Put your non-Plugin stuff after this line
I'm using neovim for coding C++. I have some trouble when coding with it.
I often use file to read and write data. When I run C++ file by command g++ -o data data.cpp && ./data, output file don't reload in neovim.
I try use
set autoread
au CursorHold * checktime
but it doesn't work.
I don't want to type :e to reload everytime I run code
Additionally, I want to know how to set auto reload nerbtreee when I create new file or folder on Explorer.
Environment:
nvim: 0.4.3
Ubuntu 18.04 LTS
I solved it.
Thanks for spacetime-continuum on Reddit
This is how I configure for this problem:
" trigger `autoread` when files changes on disk
set autoread
autocmd FocusGained,BufEnter,CursorHold,CursorHoldI * if mode() != 'c' | checktime | endif
" notification after file change
autocmd FileChangedShellPost *
\ echohl WarningMsg | echo "File changed on disk. Buffer reloaded." | echohl None
Here is how I auto-read buffers using lua Config
vim.o.autoread = true
vim.api.nvim_create_autocmd({ "BufEnter", "CursorHold", "CursorHoldI", "FocusGained" }, {
command = "if mode() != 'c' | checktime | endif",
pattern = { "*" },
})
I'm trying to get vim set up as an IDE for Perl. I'm using generic, text-based vim, not gvim.
I installed the "vim-perl" addon at https://github.com/vim-perl/vim-perl using the vim addon manager per the suggestion of someone else. At least I think it's installed but I don't notice any difference in how the file is processed.
First I installed the vim-addon-manager with Debian's package manager. Then I put the following code in my .vimrc file and reloaded it:
" put this line first in ~/.vimrc
set nocompatible | filetype indent plugin on | syn on
fun! SetupVAM()
let c = get(g:, 'vim_addon_manager', {})
let g:vim_addon_manager = c
let c.plugin_root_dir = expand('$HOME', 1) . '/.vim/vim-addons'
" Force your ~/.vim/after directory to be last in &rtp always:
" let g:vim_addon_manager.rtp_list_hook = 'vam#ForceUsersAfterDirectoriesToBeLast'
" most used options you may want to use:
" let c.log_to_buf = 1
" let c.auto_install = 0
let &rtp.=(empty(&rtp)?'':',').c.plugin_root_dir.'/vim-addon-manager'
if !isdirectory(c.plugin_root_dir.'/vim-addon-manager/autoload')
execute '!git clone --depth=1 git://github.com/MarcWeber/vim-addon-manager '
\ shellescape(c.plugin_root_dir.'/vim-addon-manager', 1)
endif
" This provides the VAMActivate command, you could be passing plugin names, too
call vam#ActivateAddons([], {})
endfun
all SetupVAM()
" ACTIVATING PLUGINS
" OPTION 1, use VAMActivate
VAMActivate github:vim-perl/vim-perl
" OPTION 2: use call vam#ActivateAddons
"call vam#ActivateAddons([vim-perl], {})
use <c-x><c-p> to complete plugin names
" OPTION 3: Create a file ~/.vim-srcipts putting a PLUGIN_NAME into each line
" See lazy loading plugins section in README.md for details
" call vam#Scripts('~/.vim-scripts', {'tag_regex': '.*'})
So what exactly is the vim-perl addon supposed to do for me? I can't find any good documenation anywhere.
At least parts of vim-perl are incorporated in the factory-default configuration of Vim; cp. $VIMRUNTIME/ftplugin/perl.vim and $VIMRUNTIME/syntax/perl.vim. By installing (and regularly upgrading) the plugin, you'll get:
a newer version of the scripts, with potential enhancements and bug fixes
some additional functionality (f.e. there's a syntax/mason.vim that's not yet in Vim itself)
If you regularly edit non-trivial Perl scripts, or use latest language features, installing vim-perl is worth contemplating. If you're just a casual programmer, I would wait until a real need arises.