97 lines
2.9 KiB
Lua
97 lines
2.9 KiB
Lua
local fn = vim.fn
|
|
local opt = vim.opt
|
|
local map = vim.api.nvim_set_keymap
|
|
|
|
local install_path = fn.stdpath('data')..'/site/pack/packer/start/packer.nvim'
|
|
|
|
if fn.empty(fn.glob(install_path)) > 0 then
|
|
fn.system({'git', 'clone', 'https://github.com/wbthomason/packer.nvim', install_path})
|
|
vim.cmd 'packadd packer.nvim'
|
|
end
|
|
|
|
require('packer').startup(function()
|
|
use 'wbthomason/packer.nvim' -- Package Manager
|
|
use 'nvim-lua/plenary.nvim' -- Lua Library
|
|
use 'tpope/vim-commentary' -- Commentary
|
|
use 'nvim-telescope/telescope.nvim' -- Fuzzy Finder
|
|
use 'tamago324/lir.nvim' -- Filebrowser
|
|
end)
|
|
|
|
-- General Editor Settings
|
|
opt.termguicolors = true
|
|
vim.cmd('colorscheme zenburn')
|
|
|
|
vim.g.mapleader = ","
|
|
opt.mouse = "nv"
|
|
opt.pastetoggle = "ZP"
|
|
|
|
opt.number = true
|
|
opt.relativenumber = true
|
|
|
|
opt.statusline = ' %f %r %m%=%y %{&fileencoding?&fileencoding:&encoding}[%{&fileformat}] %p%% %l:%c '
|
|
|
|
opt.completeopt = 'menuone,noinsert,noselect'
|
|
|
|
map('n', 'ZT', '<cmd>w<cr>', { noremap = true })
|
|
map('n', 'ZO', '<cmd>!compiler %<cr>', { noremap = true })
|
|
map('n', 'ZK', '<cmd>!kdeconnect-cli -d 3993d52f1018a472 --share %<cr>', { noremap = true })
|
|
map('n', '<leader>/', '<cmd>let @/ = ""<cr>', { noremap = true })
|
|
|
|
-- Splits
|
|
map('n', '<C-h>', '<C-w>h', { noremap = true })
|
|
map('n', '<C-j>', '<C-w>j', { noremap = true })
|
|
map('n', '<C-k>', '<C-w>k', { noremap = true })
|
|
map('n', '<C-l>', '<C-w>l', { noremap = true })
|
|
|
|
opt.splitbelow = true
|
|
opt.splitright = true
|
|
|
|
-- Telescope
|
|
map('n', '<Leader>ff', '<cmd>lua require("telescope.builtin").find_files()<cr>', {noremap = true})
|
|
map('n', '<leader>fg', '<cmd>lua require("telescope.builtin").live_grep()<cr>', {noremap = true})
|
|
map('n', '<leader>fb', '<cmd>lua require("telescope.builtin").buffers()<cr>', {noremap = true})
|
|
map('n', '<leader>fh', '<cmd>lua require("telescope.builtin").help_tags()<cr>', {noremap = true})
|
|
|
|
-- Lir Filebrowser
|
|
local actions = require('lir.actions')
|
|
|
|
require('lir').setup {
|
|
devicons_enable = false,
|
|
mappings = {
|
|
['l'] = actions.edit,
|
|
['<C-s>'] = actions.split,
|
|
['<C-v>'] = actions.vsplit,
|
|
['<C-t>'] = actions.tabedit,
|
|
|
|
['h'] = actions.up,
|
|
['q'] = actions.quit,
|
|
|
|
['K'] = actions.mkdir,
|
|
['N'] = actions.newfile,
|
|
['R'] = actions.rename,
|
|
['@'] = actions.cd,
|
|
['Y'] = actions.yank_path,
|
|
['.'] = actions.toggle_show_hidden,
|
|
['x'] = actions.delete,
|
|
},
|
|
float = {
|
|
winblend = 0,
|
|
win_opts = function()
|
|
local width = math.floor(vim.o.columns * 0.6)
|
|
local height = math.floor(vim.o.lines * 0.6)
|
|
return {
|
|
width = width,
|
|
height = height,
|
|
row = 10,
|
|
col = math.floor((vim.o.columns - width) / 2),
|
|
}
|
|
end,
|
|
},
|
|
hide_cursor = true
|
|
}
|
|
|
|
map('n', '<C-n>', '<cmd>lua require("lir.float").toggle()<cr>', { noremap = true })
|
|
vim.g.loaded_netrw = 1
|
|
vim.g.loaded_netrwPlugin = 1
|
|
|