-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy path.vimrc
More file actions
275 lines (238 loc) · 6.8 KB
/
Copy path.vimrc
File metadata and controls
275 lines (238 loc) · 6.8 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
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
" vim: set sw=2 et :
" Configure plug.vim
if has('nvim')
let vimautoloaddir='~/.config/nvim/site/autoload'
else
let vimautoloaddir='~/.vim/autoload'
endif
call plug#begin()
" This is taking care of the plugins
Plug 'junegunn/vim-plug'
" Neovim is sensible by default
if !has('nvim')
Plug 'tpope/vim-sensible'
endif
" Editing eye-candy
Plug 'junegunn/goyo.vim'
Plug 'junegunn/limelight.vim'
" Solarized colorscheme
Plug 'altercation/vim-colors-solarized'
" Tmux .conf
Plug 'tmux-plugins/vim-tmux'
" Tmux Focus Events
Plug 'tmux-plugins/vim-tmux-focus-events'
" Automatically detect indentation
Plug 'tpope/vim-sleuth'
if has('nvim')
" Asynchronous make for neovim
Plug 'neomake/neomake'
" Automated code formatter
Plug 'sbdchd/neoformat'
" Popup terminal
Plug 'kassio/neoterm'
" Nice tree view
Plug 'kyazdani42/nvim-tree.lua'
" Icons for the tree view
Plug 'kyazdani42/nvim-web-devicons'
" A buffer bar
Plug 'noib3/nvim-cokeline'
" Better syntax recognition
Plug 'nvim-treesitter/nvim-treesitter', {'do': ':TSUpdate'}
" Mason is now preferred over LSP Installer
Plug 'williamboman/mason.nvim'
" LSP config
Plug 'neovim/nvim-lspconfig'
Plug 'williamboman/mason-lspconfig.nvim'
" Auto completion
Plug 'hrsh7th/cmp-nvim-lsp'
Plug 'hrsh7th/cmp-nvim-lsp-signature-help'
Plug 'hrsh7th/cmp-buffer'
Plug 'hrsh7th/cmp-path'
Plug 'hrsh7th/cmp-cmdline'
Plug 'hrsh7th/nvim-cmp'
" Snippets
Plug 'hrsh7th/cmp-vsnip'
Plug 'hrsh7th/vim-vsnip'
Plug 'rafamadriz/friendly-snippets'
" Telescope for quick switching
Plug 'nvim-lua/plenary.nvim'
Plug 'nvim-telescope/telescope.nvim'
Plug 'nvim-telescope/telescope-fzf-native.nvim', { 'do': 'make' }
" Copliot here
Plug 'github/copilot.vim'
" Nice colours for our NeoVim
Plug 'ishan9299/nvim-solarized-lua'
Plug 'shaunsingh/solarized.nvim'
" Show indent lines
Plug 'lukas-reineke/indent-blankline.nvim'
" Status line
Plug 'feline-nvim/feline.nvim'
" Dim inactive windows
Plug 'sunjon/shade.nvim'
endif
call plug#end()
if has('nvim')
" Add some colors
set termguicolors
colorscheme solarized-high
" When writing a buffer (no delay), and on normal mode changes (after 750ms).
call neomake#configure#automake('nw', 750)
" Call Neomake when writing a buffer (no delay)
let g:neomake_open_list = 2
" Configure Cokeline
lua << EOF
require('cokeline').setup({
show_if_buffers_are_at_least = 2
})
local map = vim.api.nvim_set_keymap
map('n', '<S-Tab>', '<Plug>(cokeline-focus-prev)', { silent = true })
map('n', '<Tab>', '<Plug>(cokeline-focus-next)', { silent = true })
map('n', '<Leader>h', '<Plug>(cokeline-focus-prev)', { silent = true })
map('n', '<Leader>l', '<Plug>(cokeline-focus-next)', { silent = true })
EOF
" Configure completion and LSP
set completeopt=menu,menuone,noselect
autocmd BufWritePre * lua vim.lsp.buf.formatting_sync(nil, 4000)
lua <<EOF
-- Setup nvim-cmp.
local cmp = require'cmp'
cmp.setup({
snippet = {
expand = function(args)
vim.fn["vsnip#anonymous"](args.body)
end,
},
mapping = cmp.mapping.preset.insert({
['<C-b>'] = cmp.mapping.scroll_docs(-4),
['<C-f>'] = cmp.mapping.scroll_docs(4),
['<C-Space>'] = cmp.mapping.complete(),
['<C-e>'] = cmp.mapping.abort(),
['<CR>'] = cmp.mapping.confirm({ select = true }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items.
}),
sources = cmp.config.sources({
{ name = 'nvim_lsp' },
{ name = 'nvim_lsp_signature_help' },
{ name = 'vsnip' },
}, {
{ name = 'buffer' },
})
})
require("mason").setup({
automatic_installation = true,
})
require("mason-lspconfig").setup()
EOF
" Configure NvimTree
lua << EOF
require('nvim-tree').setup()
EOF
nmap <leader>n :NvimTreeToggle<CR>
" Configure Telescope
lua << EOF
require('telescope').load_extension('fzf')
EOF
" Find files using Telescope command-line sugar.
nnoremap <leader>ff <cmd>Telescope find_files<cr>
nnoremap <leader>fg <cmd>Telescope live_grep<cr>
nnoremap <leader>fb <cmd>Telescope buffers<cr>
nnoremap <leader>fh <cmd>Telescope help_tags<cr>
" Configure tree-sitter with folding
lua <<EOF
if vim.loop.os_uname().sysname == "Darwin" then
require('nvim-treesitter.install').compilers = { os.getenv("HOME")..'/.local/bin/clang-wrapper' }
end
require('nvim-treesitter.configs').setup({
-- One of "all", or a list of languages
ensure_installed = "all",
ignore_install = { "godot_resource", "teal" },
highlight = {
enable = true
},
indent = {
enable = true
},
})
EOF
set foldmethod=expr
set foldexpr=nvim_treesitter#foldexpr()
" Configure feline
lua <<EOF
require('feline').setup()
EOF
" Configure Shade
lua <<EOF
require('shade').setup({
overlay_opacity = 50,
opacity_step = 1,
keys = {
brightness_up = '<C-Up>',
brightness_down = '<C-Down>',
toggle = '<Leader>s',
}
})
EOF
endif
set background=light
" Keep at least 5 lines anove or below the cursor
set scrolloff=5
" use F2 to switch to paste mode
set pastetoggle=<F2>
" Configure Goyo
nmap <leader>] :Goyo<CR>
function! s:goyo_enter()
if exists('$TMUX')
" Hide the status panel and zoom in the current pane
silent !tmux set status off
" This hackery checks whether the pane is zoomed and toggles the status if
" not
silent !tmux list-panes -F '\#F'|grep -q Z || tmux resize-pane -Z
endif
" All eyes on me
Limelight
" Resize after zoom
if !exists("g:goyo_width")
let g:goyo_width=80
endif
if !exists("g:goyo_height")
let g:goyo_height='85%'
endif
execute "Goyo ".g:goyo_width."x".g:goyo_height
set scrolloff=999
endfunction
function! s:goyo_leave()
if exists('$TMUX')
" Show the status panel and zoom out the current pane
silent !tmux set status on
silent !tmux list-panes -F '\#F'|grep -q Z && tmux resize-pane -Z
endif
Limelight!
set scrolloff=5
endfunction
autocmd! User GoyoEnter nested call <SID>goyo_enter()
autocmd! User GoyoLeave nested call <SID>goyo_leave()
" Configure Limelight
let g:limelight_conceal_ctermfg = 245 " Solarized Base1
let g:limelight_conceal_guifg = '#8a8a8a' " Solarized Base1
"""
""" Visually indicate long columns
""" Taken from https://www.youtube.com/watch?v=aHm36-na4-4
"""
highlight ColorColumn ctermbg=magenta
call matchadd('ColorColumn', '\%81v', 100)
" Prefer two spaces
set shiftwidth=2
set softtabstop=2
" Show me those tabs, BTW
set list
set listchars=trail:~,nbsp:␣,tab:▸\
" Easy moves through wrapped lines
nnoremap j gj
nnoremap k gk
" Work with tmux mouse integration
set mouse=a
if has('nvim')
set undodir=~/.config/nvim/undodir
else
set undodir=~/.vim/undodir
endif
set undofile