New neovim config

Uses lazy nvim and Lua instead of the old Vundle and vimscript setup.
This commit is contained in:
2024-10-14 00:44:29 +01:00
parent e36e3bd66c
commit bc3fae6b88
7 changed files with 78 additions and 108 deletions

View File

@@ -0,0 +1,20 @@
-- Bootstrap lazy.nvim
vim.g.mapleader = " "
vim.g.maplocalleader = "\\"
vim.schedule(function()
vim.opt.clipboard = 'unnamedplus'
end)
vim.opt.termguicolors = true
vim.opt.tabstop = 2
vim.opt.softtabstop = 2
vim.opt.shiftwidth = 2
vim.opt.wildmenu = true
vim.opt.expandtab = true
vim.opt.inccommand = 'split'
vim.opt.cursorline = true
vim.opt.scrolloff = 8
vim.opt.autoindent = true
vim.cmd("set path+=**")
-- Setup lazy.nvim
require("config.lazy")

View File

@@ -1,108 +0,0 @@
set runtimepath^=~/.vim runtimepath+=~/.vim/after
let &packpath = &runtimepath
filetype off
"" Plugins
set rtp+=~/.vim/bundle/Vundle.vim
set termguicolors
call vundle#begin()
"" Core
Plugin 'gmarik/Vundle.vim'
Plugin 'tpope/vim-dispatch'
Plugin 'christoomey/vim-tmux-navigator'
"" UI
Plugin 'scrooloose/nerdtree'
"" Plugins
Plugin 'junegunn/fzf', { 'do': { -> fzf#install() } }
Plugin 'junegunn/fzf.vim'
Plugin 'godlygeek/tabular'
Plugin 'tpope/vim-commentary'
Plugin 'tpope/vim-surround'
Plugin 'overcache/NeoSolarized'
Plugin 'altercation/vim-colors-solarized'
call vundle#end()
"" Standard variables
syntax enable
filetype plugin indent on
set nocompatible
set ignorecase
set smartcase
set clipboard=unnamed
set nobackup
set noundofile
set nowritebackup
set nohlsearch
set wildmenu
set tabstop=2
set softtabstop=2
set expandtab
set shiftwidth=2
set previewheight=5
set foldmethod=syntax
set foldlevel=99
set path+=**
let mapleader = ' '
"" Theming
set background=dark
colorscheme NeoSolarized
" Set backgrounds off => transparency!
highlight Normal guibg=none
highlight NonText guibg=none
highlight Normal ctermbg=none
highlight NonText ctermbg=none
"" Dir Config
let g:NERDTreeHijackNetrw = 1
"" Keybinds
imap jk <Esc>
"" General keybind
nnoremap <leader>fp :e ~/.config/nvim/init.vim<CR>
nnoremap <leader>fei :e ~/.vim/ftplugin<CR>
nnoremap <leader>fr :so ~/.vimrc<CR>:PluginInstall<CR>:PluginClean<CR>
nnoremap <leader>qq :q!<CR>
nnoremap <leader>gs :G<CR>
nnoremap <leader><leader> :
nnoremap <leader>l :set relativenumber!<CR>
"" File Management
nnoremap <leader>ff :Files <CR>
nnoremap <leader>fs :w<CR>
nnoremap <leader>fq :wq<CR>
nnoremap <leader>fn :enew<CR>
nnoremap <F8> :set hlsearch! hlsearch?<CR>
"" Buffer Management
nnoremap <leader>bn :bn <CR>
nnoremap <leader>bp :bp <CR>
nnoremap <leader>bb :Buffers <CR>
nnoremap <leader>bd :bd <CR>
"" Search
nnoremap <leader>ss :Lines<CR>
"" Window Splits
nnoremap <leader>wv <C-W>v
nnoremap <leader>ws <C-W>s
nnoremap <leader>wd <C-W>q
"" Window Movement
nnoremap <leader>wj <C-W><C-J>
nnoremap <leader>wk <C-W><C-K>
nnoremap <leader>wl <C-W><C-L>
nnoremap <leader>wh <C-W><C-H>
"" Projects
nnoremap <leader>ot :NERDTreeToggle<CR>
nnoremap <leader>pg :!ctags-exuberant -R --exclude=Makefile .
"" Tags
nnoremap <leader>tt :Tags<CR>

View File

@@ -0,0 +1,7 @@
{
"NeoSolarized": { "branch": "master", "commit": "b94b1a9ad51e2de015266f10fdc6e142f97bd617" },
"lazy.nvim": { "branch": "main", "commit": "1159bdccd8910a0fd0914b24d6c3d186689023d9" },
"plenary.nvim": { "branch": "master", "commit": "2d9b06177a975543726ce5c73fca176cedbffe9d" },
"telescope.nvim": { "branch": "master", "commit": "df534c3042572fb958586facd02841e10186707c" },
"vim-tmux-navigator": { "branch": "master", "commit": "a9b52e7d36114d40350099f254b5f299a35df978" }
}

View File

@@ -0,0 +1,22 @@
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
if not (vim.uv or vim.loop).fs_stat(lazypath) then
local lazyrepo = "https://github.com/folke/lazy.nvim.git"
local out = vim.fn.system({ "git", "clone", "--filter=blob:none", "--branch=stable", lazyrepo, lazypath })
if vim.v.shell_error ~= 0 then
vim.api.nvim_echo({
{ "Failed to clone lazy.nvim:\n", "ErrorMsg" },
{ out, "WarningMsg" },
{ "\nPress any key to exit..." },
}, true, {})
vim.fn.getchar()
os.exit(1)
end
end
vim.opt.rtp:prepend(lazypath)
require("lazy").setup({
spec = {
{ import = "plugins" }
},
checker = { enabled = true }
})

View File

@@ -0,0 +1,10 @@
local neosolarized = require ("plugins/neosolarized")
local telescope = require ("plugins/telescope")
return {
neosolarized,
telescope,
{
"christoomey/vim-tmux-navigator",
}
}

View File

@@ -0,0 +1,11 @@
return {
"overcache/NeoSolarized",
init = function ()
vim.cmd.colorscheme "NeoSolarized"
-- Make background transparent
vim.cmd.hi "Normal guibg=none"
vim.cmd.hi "NonText guibg=none"
vim.cmd.hi "Normal ctermbg=none"
vim.cmd.hi "NonText ctermbg=none"
end
}

View File

@@ -0,0 +1,8 @@
return {
"nvim-telescope/telescope.nvim",
config = function ()
local telescope = require("telescope.builtin")
vim.keymap.set("n", "<leader>ff", telescope.find_files, {})
vim.keymap.set("n", "<leader>ss", telescope.current_buffer_fuzzy_find, {})
end
}