-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinit.vim
More file actions
236 lines (206 loc) · 7.11 KB
/
Copy pathinit.vim
File metadata and controls
236 lines (206 loc) · 7.11 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
set number
set guifont=FiraCode\ Nerd\ Font:h12
if has("macunix")
set shell=/opt/homebrew/bin/fish
endif
autocmd VimEnter * if expand('%:p:h') ==# '/' | cd ~/projects | endif |" Open the projects directory by default in Neovide
autocmd FileType json setlocal conceallevel=0
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>
" Remap the arrow keys to move between windows
nnoremap <C-J> <C-W><C-J>
nnoremap <C-K> <C-W><C-K>
nnoremap <C-L> <C-W><C-L>
nnoremap <C-H> <C-W><C-H>
" Git maps
nnoremap <leader>gg <cmd>Git<cr>
"nnoremap <leader>gg :LazyGit<cr>
nnoremap <leader>lg :LazyGit<cr>
" Buffer maps
nnoremap <leader>n :bn<cr>
nnoremap <leader>p :bp<cr>
nnoremap <leader>D :bd<cr>
nnoremap <leader>d :Bdelete<cr>
" Neotree
nnoremap <leader>T :Neotree toggle<cr>
inoremap <D-b> <C-o>:Neotree close<cr>
nnoremap <D-b> :Neotree close<cr>
" nmap <leader>rcA :RuboCop<cr>
" Save file hotkey maps
nnoremap <C-s> :w<cr>
nnoremap <D-s> :w<cr>
inoremap <C-s> <C-o>:w<cr>
inoremap <D-s> <C-o>:w<cr>
inoremap <C-z> <C-o>u<cr>
inoremap <D-z> <C-o>u<cr>
inoremap <C-y> <C-o><C-R><cr>
inoremap <D-y> <C-o><C-R><cr>
nmap <leader>q :q<cr>
" Close all buffers same as VS Code
nnoremap <D-k><D-w> :bufdo bd<cr>
" Add easier clipboard access
nnoremap <leader>y "+y
nnoremap <leader>p "+p
nnoremap <leader>P "+P
nnoremap <C-_> :Commentary<CR>
vnoremap <C-_> :Commentary<CR>
set nocompatible
call plug#begin("~/.config/nvim/plugged")
Plug 'tpope/vim-sensible'
Plug 'nvim-lua/plenary.nvim'
Plug 'nvim-telescope/telescope.nvim'
Plug 'psliwka/vim-smoothie'
Plug 'Yggdroot/indentLine'
Plug 'kdheepak/lazygit.nvim'
Plug 'junegunn/goyo.vim'
Plug 'f-person/git-blame.nvim'
" Plug 'github/copilot.vim'
Plug 'MunifTanjim/nui.nvim'
Plug 'MeanderingProgrammer/render-markdown.nvim'
Plug 'tpope/vim-fugitive'
Plug 'tpope/vim-rails'
Plug 'vim-ruby/vim-ruby'
Plug 'tpope/vim-endwise'
Plug 'nvim-treesitter/nvim-treesitter', {'do': ':TSUpdate'}
"Plug 'wellle/context.vim'
Plug 'sheerun/vim-polyglot'
Plug 'ngmy/vim-rubocop'
" Plug 'folke/tokyonight.nvim'
Plug 'vim-airline/vim-airline'
Plug 'eslint/eslint'
Plug 'prabirshrestha/vim-lsp'
Plug 'mattn/vim-lsp-settings'
Plug 'neovim/nvim-lspconfig'
Plug 'MunifTanjim/nui.nvim'
Plug 'nvim-neo-tree/neo-tree.nvim'
Plug 'nvim-tree/nvim-web-devicons'
Plug 'VonHeikemen/lsp-zero.nvim', {'branch': 'v3.x'}
Plug 'LunarWatcher/auto-pairs'
Plug 'vim-vdebug/vdebug'
Plug 'neovim/nvim-lspconfig'
Plug 'jose-elias-alvarez/null-ls.nvim'
Plug 'MunifTanjim/prettier.nvim'
Plug 'hrsh7th/nvim-cmp'
Plug 'hrsh7th/cmp-nvim-lsp'
Plug 'iamcco/markdown-preview.nvim', { 'do': 'cd app && npx --yes yarn install' }
Plug 'chentoast/marks.nvim'
Plug 'projekt0n/github-nvim-theme'
Plug 'tpope/vim-surround'
Plug 'alvan/vim-closetag'
" Plug 'leafOfTree/vim-vue-plugin'
Plug 'editorconfig/editorconfig-vim'
Plug 'moll/vim-bbye'
Plug 'akinsho/toggleterm.nvim'
Plug 'tpope/vim-commentary'
Plug 'windwp/nvim-autopairs'
Plug 'vim-scripts/RltvNmbr.vim'
" Plug 'CopilotC-Nvim/CopilotChat.nvim'
Plug 'folke/snacks.nvim'
Plug 'nickjvandyke/opencode.nvim', { 'tag': '*' }
call plug#end()
colorscheme github_dark_high_contrast
highlight LineNr ctermfg=Red guifg=Red
set termguicolors
let g:closetag_filenames = '*.html,*.xhtml,*.phtml,*.jsx,*.tsx,*.xml'
let g:closetag_always_insert_mode = 1
" Function to adjust guifont size
function! AdjustGuifontSize(delta)
let current_font = &guifont
let font_parts = split(current_font, ':h')
let font_name = font_parts[0]
let current_size = str2nr(font_parts[1])
let new_size = current_size + a:delta
let &guifont = font_name . ':h' . new_size
endfunction
" Map keys to increase or decrease font size
nnoremap <C-=> :call AdjustGuifontSize(1)<CR>
nnoremap <C--> :call AdjustGuifontSize(-1)<CR>
lua << EOF
local ok, ts = pcall(require, "nvim-treesitter.configs")
if ok then
ts.setup {
ensure_installed = {
"c","lua","php","phpdoc","javascript","typescript","css","html",
"json","yaml","go","ruby","python","bash","dockerfile",
"vim","vimdoc","query","sql",
},
auto_install = true,
highlight = { enable = true },
}
end
require("neo-tree").setup({
event_handlers = {
{
event = "file_open_requested",
handler = function()
-- auto close
-- vimc.cmd("Neotree close")
-- OR
require("neo-tree.command").execute({ action = "close" })
end
},
},
filesystem = {
follow_current_file = {
enable = true,
},
}
})
require("toggleterm").setup{
open_mapping=[[<leader>t]],
insert_mapping=true,
direction='float'
}
vim.opt.signcolumn = "yes"
vim.api.nvim_create_autocmd("FileType", {
pattern = "ruby",
callback = function()
vim.lsp.start {
name = "rubocop",
cmd = { "bundle", "exec", "rubocop", "--lsp" },
}
end,
})
require("nvim-autopairs").setup {}
-- opencode.nvim
-- Run the OpenCode TUI in a snacks.nvim float, toggled with <C-,>.
local opencode_cmd = "opencode --port"
local opencode_win = { position = "float", width = 0.9, height = 0.9, border = "rounded" }
local opencode_term_opts = { count = 1, win = opencode_win }
---@type opencode.Opts
vim.g.opencode_opts = {
server = {
-- Reuse the float instead of the default `term://opencode --port` split.
start = function()
require("snacks.terminal").open(
opencode_cmd,
{ count = 1, win = vim.tbl_extend("force", opencode_win, { enter = false }) }
)
end,
},
}
-- Focus the OpenCode float, or hide it if it's already focused.
vim.keymap.set({ "n", "t" }, "<C-,>", function()
require("snacks.terminal").focus(opencode_cmd, opencode_term_opts)
end, { desc = "Focus/hide OpenCode" })
-- Reveal the float when a prompt is submitted from Neovim.
vim.api.nvim_create_autocmd("User", {
pattern = "OpencodeEvent:tui.command.execute",
callback = function(args)
if args.data.event.properties.command == "prompt.submit" then
local win = require("snacks.terminal").get(opencode_cmd, { count = 1, create = false })
if win then
win:show()
end
end
end,
})
vim.keymap.set({ "n", "x" }, "<leader>oa", function() require("opencode").ask("@this: ") end, { desc = "Ask OpenCode" })
vim.keymap.set({ "n", "x" }, "<leader>os", function() require("opencode").select() end, { desc = "Select OpenCode" })
vim.keymap.set({ "n", "x" }, "go", function() return require("opencode").operator("@this ") end, { desc = "Append range to OpenCode", expr = true })
vim.keymap.set({ "n" }, "goo", function() return require("opencode").operator("@this ") .. "_" end, { desc = "Append line to OpenCode", expr = true })
vim.keymap.set({ "n" }, "<S-C-u>", function() require("opencode").command("session.half.page.up") end, { desc = "Scroll OpenCode up" })
vim.keymap.set({ "n" }, "<S-C-d>", function() require("opencode").command("session.half.page.down") end, { desc = "Scroll OpenCode down" })
EOF