-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinit.lua
More file actions
100 lines (77 loc) · 2.73 KB
/
Copy pathinit.lua
File metadata and controls
100 lines (77 loc) · 2.73 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
vim.call('plug#begin', '~/.config/nvim/plugged')
vim.cmd([[
Plug 'sangdol/mintabline.vim'
Plug 'nvim-lua/plenary.nvim'
Plug 'nvim-telescope/telescope.nvim', { 'tag': '0.1.6' }
Plug 'neovim/nvim-lspconfig'
Plug 'folke/tokyonight.nvim'
Plug 'sainnhe/everforest'
Plug 'diegoulloao/neofusion.nvim'
Plug 'shaunsingh/solarized.nvim'
Plug 'rebelot/kanagawa.nvim'
Plug 'tjdevries/colorbuddy.nvim'
Plug 'morhetz/gruvbox'
]])
vim.call('plug#end')
-- Keymaps
local map = vim.keymap.set
map('i', '<CR>', function()
return vim.fn.pumvisible() == 1 and '<C-y>' or '<CR>'
end, { expr = true })
map('n', '<leader>ff', '<cmd>Telescope find_files<cr>')
map('n', '<leader>fg', '<cmd>Telescope live_grep<cr>')
map('n', '<leader>fb', '<cmd>Telescope buffers<cr>')
map('n', '<leader>fh', '<cmd>Telescope help_tags<cr>')
map('n', '<leader>l', ":split | terminal bash -c 'git log -p; read'<cr>")
map('n', '<leader>d', ":split | terminal bash -c 'git diff; read'<cr>")
map('n', '<leader>ya', 'gg "*yG')
map('n', '<leader>c', '0i//<Esc>')
map('n', '<LEFT>', ':vertical resize -2<CR>', { silent = true })
map('n', '<RIGHT>', ':vertical resize +2<CR>', { silent = true })
map('n', '<UP>', ':resize -2<CR>', { silent = true })
map('n', '<DOWN>', ':resize +2<CR>', { silent = true })
map('i', '<LEFT>', '<Nop>')
map('i', '<RIGHT>', '<Nop>')
map('t', '<Esc>', [[<C-\><C-n>]])
-- Search word under cursor
map('n', '<leader>sa', function()
vim.fn.setreg('/', '\\<' .. vim.fn.expand('<cword>') .. '\\>')
vim.opt.hlsearch = true
end, { silent = true })
map('n', '<leader>ss', function()
vim.opt.hlsearch = false
end, { silent = true })
-- Commands
vim.api.nvim_create_user_command('Vter', 'vsplit | terminal', {})
-- Functions (converted from Vimscript)
function _G.JsxFunc()
local name = vim.fn.input("Function name: ")
return name .. '() {}'
end
function _G.ModStyle()
local style = vim.fn.input("Class name: ")
return style .. '}'
end
-- Abbreviations
vim.cmd([[
iabbrev jsxfunc export default function <C-R>=v:lua.JsxFunc()<CR>
iabbrev modstyle className={style<C-R>=v:lua.ModStyle()<CR>
iabbrev lorem Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
iabbrev contenttype 'Content-Type': 'application/json'
iabbrev authfail new Response(null, { status: 401 });
iabbrev normfail new Response(null, { status: 400 });
iabbrev okresp new Response(null, { status: 200 });
]])
-- Settings
vim.opt.tabstop = 2
vim.opt.shiftwidth = 2
vim.opt.expandtab = true
vim.opt.path:append(".,src/**")
vim.opt.relativenumber = true
vim.opt.number = true
vim.opt.hlsearch = false
vim.opt.termguicolors = true
vim.opt.guicursor = "n-v-c-i:block"
-- Colorscheme
vim.cmd("colorscheme gruvbox")
-- require('lspconfig').clangd.setup({})