better nvim tree
This commit is contained in:
parent
f27f7c4ed6
commit
15eb3aadab
|
@ -18,13 +18,16 @@ set completeopt=menuone,noinsert,noselect
|
||||||
|
|
||||||
" Set completeopt to have a better completion experience"
|
" Set completeopt to have a better completion experience"
|
||||||
set completeopt=menuone,noinsert,noselect
|
set completeopt=menuone,noinsert,noselect
|
||||||
|
|
||||||
|
" load nvim-tree stuff
|
||||||
|
runtime nvim-tree.vim
|
||||||
|
|
||||||
call plug#begin()
|
call plug#begin()
|
||||||
|
|
||||||
Plug 'glacambre/firenvim', { 'do': { _ -> firenvim#install(0) } }
|
Plug 'glacambre/firenvim', { 'do': { _ -> firenvim#install(0) } }
|
||||||
Plug 'jiangmiao/auto-pairs'
|
Plug 'jiangmiao/auto-pairs'
|
||||||
Plug 'mhinz/vim-startify'
|
Plug 'mhinz/vim-startify'
|
||||||
Plug 'neoclide/coc.nvim', {'branch': 'release'}
|
Plug 'neoclide/coc.nvim', {'branch': 'release'}
|
||||||
Plug 'nvim-tree/nvim-tree.lua'
|
|
||||||
Plug 'psliwka/vim-smoothie' " scorll with STRG + d or STRG + u
|
Plug 'psliwka/vim-smoothie' " scorll with STRG + d or STRG + u
|
||||||
Plug 'romgrk/barbar.nvim' " tabs for buffers
|
Plug 'romgrk/barbar.nvim' " tabs for buffers
|
||||||
Plug 'EdenEast/nightfox.nvim' " Vim-Plug
|
Plug 'EdenEast/nightfox.nvim' " Vim-Plug
|
||||||
|
@ -32,7 +35,6 @@ Plug 'numToStr/FTerm.nvim' " floating terminal, toggle with <F11>
|
||||||
Plug 'kdheepak/lazygit.nvim'
|
Plug 'kdheepak/lazygit.nvim'
|
||||||
Plug 'nvim-lualine/lualine.nvim' " nicer status line
|
Plug 'nvim-lualine/lualine.nvim' " nicer status line
|
||||||
Plug 'goolord/alpha-nvim'
|
Plug 'goolord/alpha-nvim'
|
||||||
Plug 'nvim-tree/nvim-web-devicons'
|
|
||||||
Plug 'junegunn/fzf', { 'do': { -> fzf#install() } }
|
Plug 'junegunn/fzf', { 'do': { -> fzf#install() } }
|
||||||
Plug 'junegunn/fzf.vim'
|
Plug 'junegunn/fzf.vim'
|
||||||
Plug 'iamcco/markdown-preview.nvim', { 'do': 'cd app && yarn install' }
|
Plug 'iamcco/markdown-preview.nvim', { 'do': 'cd app && yarn install' }
|
||||||
|
@ -43,6 +45,7 @@ runtime markdownpreview.vim
|
||||||
|
|
||||||
call plug#end()
|
call plug#end()
|
||||||
|
|
||||||
|
|
||||||
" no default mappings for vim smoothie (fancy scrolling)
|
" no default mappings for vim smoothie (fancy scrolling)
|
||||||
let g:smoothie_no_default_mappings = 1
|
let g:smoothie_no_default_mappings = 1
|
||||||
|
|
||||||
|
@ -59,10 +62,6 @@ inoremap <expr> <S-Tab> pumvisible() ? "\<C-p>" : "\<S-Tab>"
|
||||||
" Set completeopt to have a better completion experience"
|
" Set completeopt to have a better completion experience"
|
||||||
set completeopt=menuone,noinsert,noselect
|
set completeopt=menuone,noinsert,noselect
|
||||||
|
|
||||||
|
|
||||||
" Open NvimTree with f5"
|
|
||||||
nnoremap <F5> :NvimTreeToggle<CR>
|
|
||||||
|
|
||||||
" Move to previous/next"
|
" Move to previous/next"
|
||||||
nnoremap <silent> <A-,> <Cmd>BufferPrevious<CR>
|
nnoremap <silent> <A-,> <Cmd>BufferPrevious<CR>
|
||||||
nnoremap <silent> <A-.> <Cmd>BufferNext<CR>
|
nnoremap <silent> <A-.> <Cmd>BufferNext<CR>
|
||||||
|
@ -145,8 +144,6 @@ vim.g.loaded_netrwPlugin = 1
|
||||||
-- set termguicolors to enable highlight groups
|
-- set termguicolors to enable highlight groups
|
||||||
vim.opt.termguicolors = true
|
vim.opt.termguicolors = true
|
||||||
|
|
||||||
-- empty setup using defaults
|
|
||||||
require("nvim-tree").setup()
|
|
||||||
|
|
||||||
require('lualine').setup {
|
require('lualine').setup {
|
||||||
options = {
|
options = {
|
||||||
|
|
|
@ -0,0 +1,65 @@
|
||||||
|
call plug#begin()
|
||||||
|
Plug 'nvim-tree/nvim-tree.lua'
|
||||||
|
Plug 'nvim-tree/nvim-web-devicons'
|
||||||
|
call plug#end()
|
||||||
|
|
||||||
|
|
||||||
|
" Open NvimTree with f5"
|
||||||
|
nnoremap <F5> :NvimTreeToggle<CR>
|
||||||
|
|
||||||
|
|
||||||
|
lua << EOF
|
||||||
|
|
||||||
|
local HEIGHT_RATIO = 0.8 -- You can change this
|
||||||
|
local WIDTH_RATIO = 0.8 -- You can change this too
|
||||||
|
|
||||||
|
local function my_on_attach(bufnr)
|
||||||
|
local api = require "nvim-tree.api"
|
||||||
|
|
||||||
|
local function opts(desc)
|
||||||
|
return { desc = "nvim-tree: " .. desc, buffer = bufnr, noremap = true, silent = true, nowait = true }
|
||||||
|
end
|
||||||
|
|
||||||
|
-- default mappings
|
||||||
|
--api.config.mappings.default_on_attach(bufnr)
|
||||||
|
|
||||||
|
-- custom mappings
|
||||||
|
-- cd
|
||||||
|
vim.keymap.set('n', '<C-c>', api.tree.change_root_to_node, opts('Up'))
|
||||||
|
vim.keymap.set('n', '?', api.tree.toggle_help, opts('Help'))
|
||||||
|
end
|
||||||
|
|
||||||
|
-- empty setup using defaults
|
||||||
|
require("nvim-tree").setup()
|
||||||
|
require('nvim-tree').setup({
|
||||||
|
view = {
|
||||||
|
float = {
|
||||||
|
enable = true,
|
||||||
|
open_win_config = function()
|
||||||
|
local screen_w = vim.opt.columns:get()
|
||||||
|
local screen_h = vim.opt.lines:get() - vim.opt.cmdheight:get()
|
||||||
|
local window_w = screen_w * WIDTH_RATIO
|
||||||
|
local window_h = screen_h * HEIGHT_RATIO
|
||||||
|
local window_w_int = math.floor(window_w)
|
||||||
|
local window_h_int = math.floor(window_h)
|
||||||
|
local center_x = (screen_w - window_w) / 2
|
||||||
|
local center_y = ((vim.opt.lines:get() - window_h) / 2)
|
||||||
|
- vim.opt.cmdheight:get()
|
||||||
|
return {
|
||||||
|
border = 'rounded',
|
||||||
|
relative = 'editor',
|
||||||
|
row = center_y,
|
||||||
|
col = center_x,
|
||||||
|
width = window_w_int,
|
||||||
|
height = window_h_int,
|
||||||
|
}
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
width = function()
|
||||||
|
return math.floor(vim.opt.columns:get() * WIDTH_RATIO)
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
on_attach = my_on_attach,
|
||||||
|
})
|
||||||
|
|
||||||
|
EOF
|
Loading…
Reference in New Issue