Skip to content

Commit ccab8ed

Browse files
committed
set options, keymaps and packer lua files are added...
0 parents  commit ccab8ed

File tree

5 files changed

+175
-0
lines changed

5 files changed

+175
-0
lines changed

init.lua

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
-- settings for plugins and list plugins.
2+
require("user.packer")
3+
-- activation of everforest colors.
4+
require("everforest").load()
5+
-- settings for options or sets.
6+
require("user.options")
7+
-- settings for vscode key shortcuts.
8+
require("user.keymaps")

lua/user/keymaps.lua

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
-- normal mode function.
2+
function nmap(shortcut, command)
3+
vim.api.nvim_set_keymap('n', shortcut, command, { noremap = true, silent = true })
4+
end
5+
6+
-- insert mode function.
7+
function imap(shortcut, command)
8+
vim.api.nvim_set_keymap('i', shortcut, command, { noremap = true, silent = true })
9+
end
10+
11+
-- pre defined vscode key shortcuts.
12+
nmap("f","zc")
13+
nmap("<C-t>","<Esc>:NERDTree<CR>")
14+
nmap("<C-q>","<Esc>:q!<CR>")
15+
imap("<C-q>","<Esc>:wq<CR>i")
16+
imap("<C-s>","<Esc>:w<CR>i")
17+
imap("<C-d>","<Esc>:t.<CR>i")
18+
imap("<C-u>","<Esc>:undo<CR>i")
19+
imap("<C-r>","<Esc>:redo<CR>i")
20+
imap("<C-Up>","<Esc>:m-2<CR>gi")
21+
imap("<C-Down>","<Esc>:m+<CR>gi")
22+
imap("<C-c>","<Esc>yyi")
23+
imap("<C-p>","<Esc>pi")

lua/user/options.lua

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
-- needed settings for text editor.
2+
vim.opt.number = true
3+
vim.opt.mouse = "a"
4+
vim.opt.cursorline = true
5+
vim.opt.fileencoding = "utf-8"
6+
vim.opt.foldmethod = "indent"
7+
8+
-- no need of any backup file.
9+
vim.opt.backup = false
10+
vim.opt.writebackup = false
11+
vim.opt.swapfile = false
12+
13+
-- tabs and indents.
14+
vim.opt.tabstop = 2
15+
-- vim.opt.showtabline = 2 -- quick file tabs on the top.
16+
vim.opt.shiftwidth = 2
17+
vim.opt.expandtab = true
18+
vim.opt.smartindent = true
19+
20+
-- vim.opt.completeopt = { "menuone", "noselect" }

lua/user/packer.lua

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
local ensure_packer = function()
2+
local fn = vim.fn
3+
local install_path = fn.stdpath('data')..'/site/pack/packer/start/packer.nvim'
4+
if fn.empty(fn.glob(install_path)) > 0 then
5+
fn.system({'git', 'clone', '--depth', '1', 'https://github.com/wbthomason/packer.nvim', install_path})
6+
vim.cmd [[packadd packer.nvim]]
7+
return true
8+
end
9+
return false
10+
end
11+
12+
local packer_bootstrap = ensure_packer()
13+
14+
return require('packer').startup(function(use)
15+
use 'wbthomason/packer.nvim'
16+
use 'neanias/everforest-nvim'
17+
if packer_bootstrap then
18+
require('packer').sync()
19+
end
20+
end)

plugin/packer_compiled.lua

Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
-- Automatically generated packer.nvim plugin loader code
2+
3+
if vim.api.nvim_call_function('has', {'nvim-0.5'}) ~= 1 then
4+
vim.api.nvim_command('echohl WarningMsg | echom "Invalid Neovim version for packer.nvim! | echohl None"')
5+
return
6+
end
7+
8+
vim.api.nvim_command('packadd packer.nvim')
9+
10+
local no_errors, error_msg = pcall(function()
11+
12+
_G._packer = _G._packer or {}
13+
_G._packer.inside_compile = true
14+
15+
local time
16+
local profile_info
17+
local should_profile = false
18+
if should_profile then
19+
local hrtime = vim.loop.hrtime
20+
profile_info = {}
21+
time = function(chunk, start)
22+
if start then
23+
profile_info[chunk] = hrtime()
24+
else
25+
profile_info[chunk] = (hrtime() - profile_info[chunk]) / 1e6
26+
end
27+
end
28+
else
29+
time = function(chunk, start) end
30+
end
31+
32+
local function save_profiles(threshold)
33+
local sorted_times = {}
34+
for chunk_name, time_taken in pairs(profile_info) do
35+
sorted_times[#sorted_times + 1] = {chunk_name, time_taken}
36+
end
37+
table.sort(sorted_times, function(a, b) return a[2] > b[2] end)
38+
local results = {}
39+
for i, elem in ipairs(sorted_times) do
40+
if not threshold or threshold and elem[2] > threshold then
41+
results[i] = elem[1] .. ' took ' .. elem[2] .. 'ms'
42+
end
43+
end
44+
if threshold then
45+
table.insert(results, '(Only showing plugins that took longer than ' .. threshold .. ' ms ' .. 'to load)')
46+
end
47+
48+
_G._packer.profile_output = results
49+
end
50+
51+
time([[Luarocks path setup]], true)
52+
local package_path_str = "/data/data/com.termux/files/home/.cache/nvim/packer_hererocks/2.1.0-beta3/share/lua/5.1/?.lua;/data/data/com.termux/files/home/.cache/nvim/packer_hererocks/2.1.0-beta3/share/lua/5.1/?/init.lua;/data/data/com.termux/files/home/.cache/nvim/packer_hererocks/2.1.0-beta3/lib/luarocks/rocks-5.1/?.lua;/data/data/com.termux/files/home/.cache/nvim/packer_hererocks/2.1.0-beta3/lib/luarocks/rocks-5.1/?/init.lua"
53+
local install_cpath_pattern = "/data/data/com.termux/files/home/.cache/nvim/packer_hererocks/2.1.0-beta3/lib/lua/5.1/?.so"
54+
if not string.find(package.path, package_path_str, 1, true) then
55+
package.path = package.path .. ';' .. package_path_str
56+
end
57+
58+
if not string.find(package.cpath, install_cpath_pattern, 1, true) then
59+
package.cpath = package.cpath .. ';' .. install_cpath_pattern
60+
end
61+
62+
time([[Luarocks path setup]], false)
63+
time([[try_loadstring definition]], true)
64+
local function try_loadstring(s, component, name)
65+
local success, result = pcall(loadstring(s), name, _G.packer_plugins[name])
66+
if not success then
67+
vim.schedule(function()
68+
vim.api.nvim_notify('packer.nvim: Error running ' .. component .. ' for ' .. name .. ': ' .. result, vim.log.levels.ERROR, {})
69+
end)
70+
end
71+
return result
72+
end
73+
74+
time([[try_loadstring definition]], false)
75+
time([[Defining packer_plugins]], true)
76+
_G.packer_plugins = {
77+
["everforest-nvim"] = {
78+
loaded = true,
79+
path = "/data/data/com.termux/files/home/.local/share/nvim/site/pack/packer/start/everforest-nvim",
80+
url = "https://github.com/neanias/everforest-nvim"
81+
},
82+
["packer.nvim"] = {
83+
loaded = true,
84+
path = "/data/data/com.termux/files/home/.local/share/nvim/site/pack/packer/start/packer.nvim",
85+
url = "https://github.com/wbthomason/packer.nvim"
86+
}
87+
}
88+
89+
time([[Defining packer_plugins]], false)
90+
91+
_G._packer.inside_compile = false
92+
if _G._packer.needs_bufread == true then
93+
vim.cmd("doautocmd BufRead")
94+
end
95+
_G._packer.needs_bufread = false
96+
97+
if should_profile then save_profiles() end
98+
99+
end)
100+
101+
if not no_errors then
102+
error_msg = error_msg:gsub('"', '\\"')
103+
vim.api.nvim_command('echohl ErrorMsg | echom "Error in packer_compiled: '..error_msg..'" | echom "Please check your config for correctness" | echohl None')
104+
end

0 commit comments

Comments
 (0)