forked from smithbm2316/vimconf-2021
-
Notifications
You must be signed in to change notification settings - Fork 0
/
init.lua
160 lines (142 loc) · 3.99 KB
/
init.lua
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
156
157
158
159
160
--[[
-- settings
--]]
vim.cmd 'syntax on'
vim.cmd 'filetype plugin indent on'
vim.g.mapleader = ' '
vim.g.vimsyn_embed = 'lPr'
vim.o.autoindent = true
vim.o.completeopt = 'menu,menuone,noinsert'
vim.o.errorbells = false
vim.o.expandtab = true
vim.o.foldmethod = 'manual'
vim.opt.formatoptions:append 'jnrql'
vim.opt.formatoptions:remove '2tac'
vim.o.hidden = true
vim.o.ignorecase = true
vim.o.inccommand = 'split'
vim.o.incsearch = true
vim.o.laststatus = 2
vim.o.lazyredraw = true
vim.o.mouse = 'n'
vim.o.number = true
vim.o.path = '.,**'
vim.o.relativenumber = true
vim.o.shiftwidth = 2
vim.opt.shortmess:append 'c'
vim.o.showtabline = 1
vim.o.signcolumn = 'yes'
vim.o.smartcase = true
vim.o.smartindent = true
vim.o.softtabstop = 2
vim.o.splitbelow = true
vim.o.splitright = true
vim.o.tabstop = 2
vim.o.termguicolors = true
vim.o.wildignore = '*/node_modules/*,*/.git/*,DS_Store,*/venv/*,*/__pycache__/*,*.pyc'
vim.o.wildmenu = true
vim.o.wildmode = 'full'
vim.o.wildoptions = 'pum'
vim.o.wrap = false
-- [[
-- for me, not you!
-- ]]
vim.cmd [[set runtimepath=$VIMRUNTIME]]
vim.cmd [[set packpath=/tmp/nvim/site]]
local package_root = '/tmp/nvim/site/pack'
local install_path = package_root .. '/packer/start/packer.nvim'
local fn = vim.fn
if fn.empty(fn.glob(install_path)) > 0 then
print 'installing packer...'
packer_bootstrap = fn.system {
'git',
'clone',
'--depth',
'1',
'https://github.com/wbthomason/packer.nvim',
install_path,
}
print 'done!!'
end
--[[
-- plugins
--]]
-- check packer's docs for more details on how to bootstrap
-- https://github.com/wbthomason/packer.nvim
require('packer').startup {
function(use)
-- manage packer with packer :0
use 'wbthomason/packer.nvim'
-- telescope
use 'nvim-lua/plenary.nvim'
use 'nvim-lua/popup.nvim'
use 'nvim-telescope/telescope.nvim'
-- builtin lsp
use 'neovim/nvim-lspconfig'
-- treesitter
use {
'nvim-treesitter/nvim-treesitter',
run = ':TSUpdate',
}
-- auto-completion
use 'hrsh7th/nvim-cmp'
use 'hrsh7th/cmp-buffer'
use 'hrsh7th/cmp-nvim-lsp'
use 'hrsh7th/cmp-path'
-- comments
use 'numToStr/Comment.nvim'
-- nerd font icons :D
use 'kyazdani42/nvim-web-devicons'
-- statusline
use 'shadmansaleh/lualine.nvim'
-- theme
use {
'rose-pine/neovim',
config = function()
--[[
-- colorscheme
--]]
vim.g.rose_pine_variant = 'moon'
vim.cmd 'colorscheme rose-pine'
end,
}
-- vimscript plugins
use 'milisims/nvim-luaref'
use 'tpope/vim-surround'
use 'tpope/vim-repeat'
use 'christoomey/vim-system-copy'
end,
config = {
package_root = package_root,
compile_path = install_path .. '/plugin/packer_compiled.lua',
},
}
--[[
-- autocmds
--]]
-- highlight yank for a brief second for visual feedback
vim.cmd 'autocmd! TextYankPost * lua vim.highlight.on_yank { on_visual = false }'
--[[
-- remaps
--]]
-- remap Y to yank to end of line
vim.api.nvim_set_keymap('n', 'Y', 'y$', { noremap = true })
vim.api.nvim_set_keymap('v', 'Y', 'y$', { noremap = true })
-- delete text without yanking
vim.api.nvim_set_keymap('n', '<leader>d', '"_d', { noremap = true })
vim.api.nvim_set_keymap('v', '<leader>d', '"_d', { noremap = true })
-- turn off search highlighting
vim.api.nvim_set_keymap('n', '<leader>hl', ':nohlsearch<cr>', { noremap = true })
-- neovim terminal can exit to normal mode with <esc> now
vim.api.nvim_set_keymap('t', '<esc>', [[ <c-\><c-n> ]], { noremap = true })
-- swap between light and dark themes for rose-pine (Toggle Theme)
vim.api.nvim_set_keymap(
'n',
'<leader>tt',
[[<cmd>lua require('rose-pine.functions').toggle_variant({ 'moon', 'dawn' })<cr>]],
{ noremap = true }
)
-- these are for my sanity :)
vim.api.nvim_set_keymap('n', '<leader>fj', [[<cmd>Telescope find_files<cr>]], { noremap = true, silent = true })
vim.api.nvim_set_keymap('n', 'gl', [[<c-^>]], { noremap = true, silent = true })
vim.api.nvim_set_keymap('n', 'go', [[:]], { noremap = true })