-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinit.lua
More file actions
155 lines (125 loc) · 3.95 KB
/
init.lua
File metadata and controls
155 lines (125 loc) · 3.95 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
local ensure_packer = function()
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
fn.system({ 'git', 'clone', '--depth', '1', 'https://github.com/wbthomason/packer.nvim', install_path })
vim.cmd [[packadd packer.nvim]]
return true
end
return false
end
local packer_bootstrap = ensure_packer()
require('packer').startup(function(use)
use 'wbthomason/packer.nvim'
use {
'nvim-treesitter/nvim-treesitter',
run = ':TSUpdate'
}
use {
'nvim-telescope/telescope.nvim',
requires = { 'nvim-lua/plenary.nvim', 'nvim-lua/popup.nvim' }
}
use 'nvim-tree/nvim-web-devicons'
use 'nvim-lualine/lualine.nvim'
use {
'nvim-tree/nvim-tree.lua',
requires = 'nvim-tree/nvim-web-devicons'
}
use 'lukas-reineke/indent-blankline.nvim'
use 'glepnir/dashboard-nvim'
use 'morhetz/gruvbox'
use 'folke/tokyonight.nvim'
use 'joshdick/onedark.vim'
use 'phaazon/hop.nvim'
use { "catppuccin/nvim", as = "catppuccin" }
if packer_bootstrap then
require('packer').sync()
end
end)
require('nvim-tree').setup {
view = {
width = 40,
},
renderer = {
icons = {
show = {
file = true,
folder = true,
folder_arrow = true,
git = true,
},
},
},
filters = {
dotfiles = true,
},
actions = {
open_file = {
quit_on_open = true,
},
},
}
require('hop').setup()
require("ibl").setup {
indent = {
char = "┆",
},
scope = {
enabled = true,
show_start = true,
show_end = false,
},
}
require('telescope').setup {
defaults = {
mappings = {
i = {
["<C-n>"] = require('telescope.actions').move_selection_next,
["<C-p>"] = require('telescope.actions').move_selection_previous,
},
},
},
}
require('lualine').setup {
options = { theme = 'gruvbox' }
}
vim.g.mapleader = " "
vim.opt.termguicolors = true
vim.cmd 'colorscheme gruvbox'
vim.opt.number = true
vim.opt.hlsearch = true
vim.opt.incsearch = true
vim.api.nvim_set_keymap('n', '<leader>ff', "<cmd>Telescope find_files<CR>", { noremap = true, silent = true })
vim.api.nvim_set_keymap('n', '<leader>fg', "<cmd>Telescope live_grep<CR>", { noremap = true, silent = true })
vim.api.nvim_set_keymap('n', '<leader>fb', "<cmd>Telescope buffers<CR>", { noremap = true, silent = true })
vim.api.nvim_set_keymap('n', '<leader>th', ":TSBufToggle highlight<CR>", { noremap = true, silent = true })
vim.api.nvim_set_keymap('n', '<leader>e', ':NvimTreeToggle<CR>', { noremap = true, silent = true })
vim.api.nvim_set_keymap('n', '<leader>cd', ":lua NvimTreeChangeDir()<CR>", { noremap = true, silent = true })
function NvimTreeChangeDir()
local input = vim.fn.input("📂 Path: ")
local path
if input == "" then
path = vim.fn.expand("%:p:h")
else
if not input:match("^/") then
path = vim.fn.getcwd() .. "/" .. input
else
path = input
end
end
if vim.fn.isdirectory(path) == 0 then
print(" ❌ Invalid directory: " .. path)
return
end
vim.cmd("cd " .. vim.fn.fnameescape(path))
print(" 📂 Moved to -> " .. path)
local api = require('nvim-tree.api')
if api.tree.is_visible() then
api.tree.change_root(path)
api.tree.reload()
else
api.tree.open()
end
end
vim.api.nvim_set_keymap('n', '<leader>ln', ':set number! relativenumber!<CR>', { noremap = true, silent = true })
vim.api.nvim_set_keymap('n', '<leader>h', ":HopWord<CR>", { noremap = true, silent = true })