diff --git a/.config/nvim/init.vim b/.config/nvim/init.vim index ff425cb..5750d73 100644 --- a/.config/nvim/init.vim +++ b/.config/nvim/init.vim @@ -42,9 +42,12 @@ Plug 'simrat39/rust-tools.nvim' Plug 'tpope/vim-fugitive' " src tree view -Plug 'preservim/nerdtree' +Plug 'nvim-tree/nvim-tree.lua' +Plug 'nvim-tree/nvim-web-devicons' " optional, for file icons call plug#end() +" lua require("setup" +luafile ~/.config/nvim/lua/setup.lua " ============================================================================== @@ -53,6 +56,7 @@ call plug#end() " dealing with files syntax on filetype plugin indent on +set paste set colorcolumn=80 set autoindent expandtab tabstop=4 shiftwidth=4 set encoding=utf-8 @@ -232,12 +236,10 @@ nnoremap nnoremap nnoremap -"enable nerdtree with ^\ -map :NERDTreeToggle - -" enable clipboard access for Neovide -nnoremap "+p -nnoremap "+p +" neovide (GUI) clipboard +nnoremap "+P +" handle Ctrl+Shift+V in GUI somehow +" inoremap "+P " RUST diff --git a/.config/nvim/lua/plugins.lua b/.config/nvim/lua/plugins.lua new file mode 100644 index 0000000..57a75d6 --- /dev/null +++ b/.config/nvim/lua/plugins.lua @@ -0,0 +1,81 @@ +-------------------------------------------------------------------------------- +-- initial setup +-------------------------------------------------------------------------------- + +-- disable netrw at the very start of init.lua (strongly advised by _nvim-tree.lua_) +vim.g.loaded_netrw = 1 +vim.g.loaded_netrwPlugin = 1 + + +-------------------------------------------------------------------------------- +-- Plugin setup +-------------------------------------------------------------------------------- + +-- ensure that packer is installed +if vim.fn.empty(vim.fn.glob(vim.fn.stdpath("data").."/site/pack/packer/start/packer.nvim")) > 0 then + PACKER_BOOTSTRAP = vim.fn.system({ + "git", + "clone", + "--depth", + "1", + "https://github.com/wbthomason/packer.nvim", + "~/.local/share/nvim/site/pack/packer/start/packer.nvim", + }) + print("Packer installed. Please close and re-open Neovim."); +end + +-- Autocommand that reloads Neovim whenever the "plugins.lua" file is saved + + +-- 'nvim-tree.lua' setup +require("nvim-tree").setup({ + auto_reload_on_write = true, + disable_netrw = false, + hijack_netrw = true, + sort_by = "case_sensitive", + view = { + width = 30, + number = true, + relativenumber = true, + mappings = { + list = { + { key = "u", action = "dir_up" }, + }, + }, + }, + renderer = { + group_empty = false, + highlight_git = true, + icons = { + symlink_arrow = " ➛ ", + glyphs = { + modified = "●", + git = { + unstaged = "✗", + staged = "✓", + unmerged = "", + renamed = "➜", + untracked = "[ ]", + deleted = "", + ignored = "◌", + }, + }, + }, + special_files = { "Cargo.toml", "README.md", "Readme.md", "readme.md" }, + symlink_destination = true, + }, + filters = { + dotfiles = true, + }, +}) + + +-------------------------------------------------------------------------------- +-- open _things_... +-------------------------------------------------------------------------------- + +local function open_nvim_tree() + require("nvim-tree.api").tree.open() +end + +-- UNDO THIS open_nvim_tree() diff --git a/.config/nvim/lua/setup.lua b/.config/nvim/lua/setup.lua new file mode 100644 index 0000000..48cee6e --- /dev/null +++ b/.config/nvim/lua/setup.lua @@ -0,0 +1,67 @@ +-------------------------------------------------------------------------------- +-- initial setup +-------------------------------------------------------------------------------- + +-- disable netrw at the very start of init.lua (strongly advised by _nvim-tree.lua_) +vim.g.loaded_netrw = 1 +vim.g.loaded_netrwPlugin = 1 + + +-------------------------------------------------------------------------------- +-- Plugin setup +-------------------------------------------------------------------------------- + + + +-- 'nvim-tree.lua' setup +require("nvim-tree").setup({ + auto_reload_on_write = true, + disable_netrw = false, + hijack_netrw = true, + sort_by = "case_sensitive", + view = { + width = 30, + number = true, + relativenumber = true, + mappings = { + list = { + { key = "u", action = "dir_up" }, + }, + }, + }, + renderer = { + group_empty = false, + highlight_git = true, + icons = { + symlink_arrow = " ➛ ", + glyphs = { + modified = "●", + git = { + unstaged = "✗", + staged = "✓", + unmerged = "", + renamed = "➜", + untracked = "[ ]", + deleted = "", + ignored = "◌", + }, + }, + }, + special_files = { "Cargo.toml", "README.md", "Readme.md", "readme.md" }, + symlink_destination = true, + }, + filters = { + dotfiles = true, + }, +}) + + +-------------------------------------------------------------------------------- +-- open _things_... +-------------------------------------------------------------------------------- + +local function open_nvim_tree() + require("nvim-tree.api").tree.open() +end + +-- UNDO THIS open_nvim_tree()