Compare commits
1 Commits
43785d7323
...
f71eb472e2
Author | SHA1 | Date |
---|---|---|
kalle | f71eb472e2 |
|
@ -0,0 +1,9 @@
|
||||||
|
# Nvim Config Rewrite - TODO
|
||||||
|
-[ ] LSP for:
|
||||||
|
-[ ] Python
|
||||||
|
-[ ] Kotlin
|
||||||
|
-[ ] Bash/Shell scripts
|
||||||
|
-[ ] JavaScript
|
||||||
|
-[ ] Java
|
||||||
|
-[ ] Auto close neogit/nvimtree panes when they are the only thing left.
|
||||||
|
-[ ] Start with file focused instead of nvimtree.
|
|
@ -0,0 +1,58 @@
|
||||||
|
local options = vim.o -- For the globals options
|
||||||
|
local window_options = vim.wo -- For the window local options
|
||||||
|
local buffer_options = vim.bo -- For the buffer local options
|
||||||
|
|
||||||
|
-- window_options.colorcolumn = [[100]]
|
||||||
|
options.termguicolors = true
|
||||||
|
options.clipboard = 'unnamed,unnamedplus'
|
||||||
|
options.timeoutlen = 300
|
||||||
|
options.mouse = 'a'
|
||||||
|
options.undodir = vim.fn.expand('~/.cache/vim/undo')
|
||||||
|
options.listchars = 'tab:▸ ,extends:❯,precedes:❮'
|
||||||
|
|
||||||
|
window_options.relativenumber = true
|
||||||
|
window_options.list = true
|
||||||
|
|
||||||
|
buffer_options.autoindent = true
|
||||||
|
buffer_options.expandtab = true
|
||||||
|
buffer_options.softtabstop = 4
|
||||||
|
buffer_options.shiftwidth = 4
|
||||||
|
buffer_options.tabstop = 4
|
||||||
|
buffer_options.smartindent = true
|
||||||
|
buffer_options.modeline = true
|
||||||
|
|
||||||
|
buffer_options.undofile = true
|
||||||
|
vim.g.mapleader = ' '
|
||||||
|
|
||||||
|
-- Load utilities
|
||||||
|
require('kalle.utils')
|
||||||
|
|
||||||
|
-- Load plugins
|
||||||
|
require('kalle.plugins')
|
||||||
|
|
||||||
|
-- Load config
|
||||||
|
require('kalle.config')
|
||||||
|
|
||||||
|
vim.cmd('colorscheme nightfox')
|
||||||
|
|
||||||
|
|
||||||
|
-- TODO: Move to a better place at some point
|
||||||
|
local nvimtree = require('nvim-tree')
|
||||||
|
local nvimtree_reloaders = require('nvim-tree.actions.reloaders')
|
||||||
|
|
||||||
|
local function keepFileTree()
|
||||||
|
nvimtree_reloaders.reload_explorer()
|
||||||
|
nvimtree.open(false)
|
||||||
|
end
|
||||||
|
|
||||||
|
vim.api.nvim_create_autocmd(
|
||||||
|
"TabNewEntered",
|
||||||
|
{
|
||||||
|
pattern = "*",
|
||||||
|
callback = keepFileTree,
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
-- Automatically start nvim tree with vim
|
||||||
|
nvimtree.open()
|
|
@ -0,0 +1,2 @@
|
||||||
|
require('kalle.config.keybinds')
|
||||||
|
require('kalle.config.plugin-config')
|
|
@ -0,0 +1,19 @@
|
||||||
|
Keybind.g({
|
||||||
|
-- [ space + h ] move cursor to left window
|
||||||
|
{ 'n', '<Leader>h', '<Cmd>wincmd h<CR>', { noremap = true, desc = 'Window left' } },
|
||||||
|
-- [ space + l ] move cursor to bottom window
|
||||||
|
{ 'n', '<Leader>j', '<Cmd>wincmd j<CR>', { noremap = true, desc = 'Window down' } },
|
||||||
|
-- [ space + j ] move cursor to top window
|
||||||
|
{ 'n', '<Leader>k', '<Cmd>wincmd k<CR>', { noremap = true, desc = 'Window up' } },
|
||||||
|
-- [ space + k ] move cursor to right window
|
||||||
|
{ 'n', '<Leader>l', '<Cmd>wincmd l<CR>', { noremap = true, desc = 'Window right' } },
|
||||||
|
|
||||||
|
-- [ space + t ] Toggles
|
||||||
|
{ 'n', '<Leader>t', '', { noremap = true, desc = '+Toggle' } },
|
||||||
|
-- [ space + t + t] Toggle file tree
|
||||||
|
{ 'n', '<Leader>tt', '<Cmd>NvimTreeToggle<CR>', { noremap = true, desc = 'Open file tree' } },
|
||||||
|
-- [ space + t + g] Neogit
|
||||||
|
{ 'n', '<Leader>tg', '<Cmd>Neogit<CR>', { noremap = true, desc = 'Open git status' } },
|
||||||
|
|
||||||
|
|
||||||
|
})
|
|
@ -0,0 +1,31 @@
|
||||||
|
require('which-key').setup {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
require('nvim-tree').setup {
|
||||||
|
sort_by = 'case_sensitive',
|
||||||
|
view = {
|
||||||
|
adaptive_size = true,
|
||||||
|
mappings = {
|
||||||
|
custom_only = false,
|
||||||
|
list = {},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
renderer = {
|
||||||
|
group_empty = true,
|
||||||
|
highlight_git = true,
|
||||||
|
highlight_opened_files = "name",
|
||||||
|
indent_markers = {
|
||||||
|
enable = true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
filters = {
|
||||||
|
dotfiles = true,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
require('neogit').setup {}
|
||||||
|
|
||||||
|
require('lualine').setup {}
|
||||||
|
|
||||||
|
require('tabline').setup {}
|
|
@ -0,0 +1,30 @@
|
||||||
|
local fn = vim.fn
|
||||||
|
local install_path = fn.stdpath('data')..'/site/pack/packer/start/packer.nvim'
|
||||||
|
if fn.empty(fn.glob(install_path)) > 0 then
|
||||||
|
packer_bootstrap = fn.system({'git', 'clone', '--depth', '1', 'https://github.com/wbthomason/packer.nvim', install_path})
|
||||||
|
end
|
||||||
|
|
||||||
|
return require('packer').startup(function(use)
|
||||||
|
use 'EdenEast/nightfox.nvim'
|
||||||
|
use 'folke/which-key.nvim'
|
||||||
|
|
||||||
|
use {
|
||||||
|
'kyazdani42/nvim-tree.lua',
|
||||||
|
requires = {
|
||||||
|
'kyazdani42/nvim-web-devicons',
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
use('TimUntersberger/neogit')
|
||||||
|
use('nvim-lua/plenary.nvim')
|
||||||
|
|
||||||
|
use('nvim-lualine/lualine.nvim')
|
||||||
|
|
||||||
|
use('kdheepak/tabline.nvim')
|
||||||
|
|
||||||
|
-- Automatically set up your configuration after cloning packer.nvim
|
||||||
|
-- Put this at the end after all plugins
|
||||||
|
if packer_bootstrap then
|
||||||
|
require('packer').sync()
|
||||||
|
end
|
||||||
|
end)
|
|
@ -0,0 +1,5 @@
|
||||||
|
Keybind = require('kalle.utils.keybind')
|
||||||
|
|
||||||
|
Vim = {
|
||||||
|
Keybind = Keybind,
|
||||||
|
}
|
|
@ -0,0 +1,37 @@
|
||||||
|
local Keybind = {}
|
||||||
|
|
||||||
|
Keybind.add_global_keybinds = function (keybinds)
|
||||||
|
for _, keybind in pairs(keybinds) do
|
||||||
|
if(keybind[4] == nil) then
|
||||||
|
keybind[4] = {}
|
||||||
|
end
|
||||||
|
|
||||||
|
vim.api.nvim_set_keymap(
|
||||||
|
keybind[1],
|
||||||
|
keybind[2],
|
||||||
|
keybind[3],
|
||||||
|
keybind[4]
|
||||||
|
)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
Keybind.add_buffer_keybinds = function (keybinds)
|
||||||
|
for _, keybind in pairs(keybinds) do
|
||||||
|
if(keybind[5] == nil) then
|
||||||
|
keybind[5] = {}
|
||||||
|
end
|
||||||
|
|
||||||
|
vim.api.nvim_buf_set_keymap(
|
||||||
|
keybind[1],
|
||||||
|
keybind[2],
|
||||||
|
keybind[3],
|
||||||
|
keybind[4],
|
||||||
|
keybind[5]
|
||||||
|
)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
Keybind.g = Keybind.add_global_keybinds
|
||||||
|
Keybind.b = Keybind.add_buffer_keybinds
|
||||||
|
|
||||||
|
return Keybind
|
|
@ -0,0 +1,117 @@
|
||||||
|
-- Automatically generated packer.nvim plugin loader code
|
||||||
|
|
||||||
|
if vim.api.nvim_call_function('has', {'nvim-0.5'}) ~= 1 then
|
||||||
|
vim.api.nvim_command('echohl WarningMsg | echom "Invalid Neovim version for packer.nvim! | echohl None"')
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
vim.api.nvim_command('packadd packer.nvim')
|
||||||
|
|
||||||
|
local no_errors, error_msg = pcall(function()
|
||||||
|
|
||||||
|
local time
|
||||||
|
local profile_info
|
||||||
|
local should_profile = false
|
||||||
|
if should_profile then
|
||||||
|
local hrtime = vim.loop.hrtime
|
||||||
|
profile_info = {}
|
||||||
|
time = function(chunk, start)
|
||||||
|
if start then
|
||||||
|
profile_info[chunk] = hrtime()
|
||||||
|
else
|
||||||
|
profile_info[chunk] = (hrtime() - profile_info[chunk]) / 1e6
|
||||||
|
end
|
||||||
|
end
|
||||||
|
else
|
||||||
|
time = function(chunk, start) end
|
||||||
|
end
|
||||||
|
|
||||||
|
local function save_profiles(threshold)
|
||||||
|
local sorted_times = {}
|
||||||
|
for chunk_name, time_taken in pairs(profile_info) do
|
||||||
|
sorted_times[#sorted_times + 1] = {chunk_name, time_taken}
|
||||||
|
end
|
||||||
|
table.sort(sorted_times, function(a, b) return a[2] > b[2] end)
|
||||||
|
local results = {}
|
||||||
|
for i, elem in ipairs(sorted_times) do
|
||||||
|
if not threshold or threshold and elem[2] > threshold then
|
||||||
|
results[i] = elem[1] .. ' took ' .. elem[2] .. 'ms'
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
_G._packer = _G._packer or {}
|
||||||
|
_G._packer.profile_output = results
|
||||||
|
end
|
||||||
|
|
||||||
|
time([[Luarocks path setup]], true)
|
||||||
|
local package_path_str = "/home/kalle/.cache/nvim/packer_hererocks/2.1.0-beta3/share/lua/5.1/?.lua;/home/kalle/.cache/nvim/packer_hererocks/2.1.0-beta3/share/lua/5.1/?/init.lua;/home/kalle/.cache/nvim/packer_hererocks/2.1.0-beta3/lib/luarocks/rocks-5.1/?.lua;/home/kalle/.cache/nvim/packer_hererocks/2.1.0-beta3/lib/luarocks/rocks-5.1/?/init.lua"
|
||||||
|
local install_cpath_pattern = "/home/kalle/.cache/nvim/packer_hererocks/2.1.0-beta3/lib/lua/5.1/?.so"
|
||||||
|
if not string.find(package.path, package_path_str, 1, true) then
|
||||||
|
package.path = package.path .. ';' .. package_path_str
|
||||||
|
end
|
||||||
|
|
||||||
|
if not string.find(package.cpath, install_cpath_pattern, 1, true) then
|
||||||
|
package.cpath = package.cpath .. ';' .. install_cpath_pattern
|
||||||
|
end
|
||||||
|
|
||||||
|
time([[Luarocks path setup]], false)
|
||||||
|
time([[try_loadstring definition]], true)
|
||||||
|
local function try_loadstring(s, component, name)
|
||||||
|
local success, result = pcall(loadstring(s), name, _G.packer_plugins[name])
|
||||||
|
if not success then
|
||||||
|
vim.schedule(function()
|
||||||
|
vim.api.nvim_notify('packer.nvim: Error running ' .. component .. ' for ' .. name .. ': ' .. result, vim.log.levels.ERROR, {})
|
||||||
|
end)
|
||||||
|
end
|
||||||
|
return result
|
||||||
|
end
|
||||||
|
|
||||||
|
time([[try_loadstring definition]], false)
|
||||||
|
time([[Defining packer_plugins]], true)
|
||||||
|
_G.packer_plugins = {
|
||||||
|
neogit = {
|
||||||
|
loaded = true,
|
||||||
|
path = "/home/kalle/.local/share/nvim/site/pack/packer/start/neogit",
|
||||||
|
url = "https://github.com/TimUntersberger/neogit"
|
||||||
|
},
|
||||||
|
["nightfox.nvim"] = {
|
||||||
|
loaded = true,
|
||||||
|
path = "/home/kalle/.local/share/nvim/site/pack/packer/start/nightfox.nvim",
|
||||||
|
url = "https://github.com/EdenEast/nightfox.nvim"
|
||||||
|
},
|
||||||
|
["nvim-tree.lua"] = {
|
||||||
|
loaded = true,
|
||||||
|
path = "/home/kalle/.local/share/nvim/site/pack/packer/start/nvim-tree.lua",
|
||||||
|
url = "https://github.com/kyazdani42/nvim-tree.lua"
|
||||||
|
},
|
||||||
|
["nvim-web-devicons"] = {
|
||||||
|
loaded = true,
|
||||||
|
path = "/home/kalle/.local/share/nvim/site/pack/packer/start/nvim-web-devicons",
|
||||||
|
url = "https://github.com/kyazdani42/nvim-web-devicons"
|
||||||
|
},
|
||||||
|
["plenary.nvim"] = {
|
||||||
|
loaded = true,
|
||||||
|
path = "/home/kalle/.local/share/nvim/site/pack/packer/start/plenary.nvim",
|
||||||
|
url = "https://github.com/nvim-lua/plenary.nvim"
|
||||||
|
},
|
||||||
|
["stickybuf.nvim"] = {
|
||||||
|
loaded = true,
|
||||||
|
path = "/home/kalle/.local/share/nvim/site/pack/packer/start/stickybuf.nvim",
|
||||||
|
url = "https://github.com/stevearc/stickybuf.nvim"
|
||||||
|
},
|
||||||
|
["which-key.nvim"] = {
|
||||||
|
loaded = true,
|
||||||
|
path = "/home/kalle/.local/share/nvim/site/pack/packer/start/which-key.nvim",
|
||||||
|
url = "https://github.com/folke/which-key.nvim"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
time([[Defining packer_plugins]], false)
|
||||||
|
if should_profile then save_profiles() end
|
||||||
|
|
||||||
|
end)
|
||||||
|
|
||||||
|
if not no_errors then
|
||||||
|
error_msg = error_msg:gsub('"', '\\"')
|
||||||
|
vim.api.nvim_command('echohl ErrorMsg | echom "Error in packer_compiled: '..error_msg..'" | echom "Please check your config for correctness" | echohl None')
|
||||||
|
end
|
5
setup.sh
5
setup.sh
|
@ -12,11 +12,6 @@ if [ -d $NVIM_DIR ]; then
|
||||||
else
|
else
|
||||||
# Symlink the config.
|
# Symlink the config.
|
||||||
ln -s $DOTS_DIR/nvim $NVIM_DIR
|
ln -s $DOTS_DIR/nvim $NVIM_DIR
|
||||||
|
|
||||||
# Install dein.vim
|
|
||||||
curl https://raw.githubusercontent.com/Shougo/dein.vim/master/bin/installer.sh > /tmp/dein_installer.sh
|
|
||||||
chmod +x /tmp/dein_installer.sh
|
|
||||||
/tmp/dein_installer.sh ~/.local/share/dein
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# i3-gaps
|
# i3-gaps
|
||||||
|
|
Loading…
Reference in New Issue