update to using lua in init.vim

master
ALI Hamza 2023-05-18 10:22:21 +07:00
parent be465941c9
commit db9835dc23
4 changed files with 206 additions and 364 deletions

@ -1,117 +1,16 @@
{
"coc.preferences.formatOnSaveFiletypes": ["gunk", "go", "css", "svelte", "typescript", "javascript"],
"coc.preferences.currentFunctionSymbolAutoUpdate": true,
"diagnostic.virtualText": true,
"diagnostic.virtualTextCurrentLineOnly": true,
"diagnostic.virtualTextPrefix": " ⇒ ",
"diagnostic.virtualTextLineSeparator": "|",
"diagnostic.errorSign": "✘",
"diagnostic.warningSign": "!",
"diagnostic.infoSign": "?",
"diagnostic.checkCurrentLine": true,
"codeLens.enable": false,
"languageserver": {
"golang": {
"command": "gopls",
"rootPatterns": ["go.mod", ".vim/", ".git/", ".hg/"],
"filetypes": ["go"]
}
},
"explorer": {
"width": 32,
"icon.enableNerdfont": true,
"file.reveal.whenOpen": false,
"keyMappings.global": {
"l": ["wait", "expandable?", "expand", "open:select:keep"],
"L": ["wait", "expandable?", "expand", "open"]
}
},
"suggest.completionItemKindLabels": {
"class": "",
"color": "",
"constant": "",
"constructor": "",
"default": "",
"enum": "",
"enumMember": "",
"event": "鬒",
"field": "",
"file": "",
"folder": "",
"function": "ƒ",
"interface": "",
"keyword": "",
"method": "",
"module": "פּ",
"operator": "",
"property": "",
"reference": "",
"snippet": "",
"struct": "",
"text": "",
"typeParameter": "",
"unit": "",
"value": "",
"variable": "⒳"
},
"suggest.noselect": true,
"suggest.enablePreselect": false,
"coc.preferences.formatOnSave": true,
"codeLens.enable": true,
"codeLens.position": "eol",
"go.goplsOptions": {
"completeUnimported": true,
"gofumpt": true,
"hoverKind": "SynopsisDocumentation",
"linksInHover": false
},
"cSpell.allowCompoundWords": true,
"cSpell.enabledLanguageIds": [ "markdown", "pandoc" ],
"cSpell.languagesettings": [
{
"languageId": "gunk",
"local": "en",
"dictionaries": ["wordsEn", "softwareTerms", "misc", "go"]
}
],
"cSpell.userWords": [
"Brankas",
"GRPC",
"Glitchless",
"Gorm",
"Idempotency",
"Minecraft",
"ORMs",
"Overworld",
"Piglin",
"Speedrunning",
"accountingreports",
"appstatus",
"authorizationholds",
"discordgo",
"emptypb",
"fset",
"glaccounts",
"gohtml",
"hhhapz",
"livestreams",
"newpage",
"nums",
"openapiv",
"pagebreak",
"pkgs",
"proto",
"protobuf",
"protoc",
"resends",
"speedrun",
"speedrunner",
"speedrunners",
"speedruns",
"struct",
"teamortix",
"textwidth",
"unban"
],
"coc-gunk": {
"server.args": ["-lint"]
"semanticTokens": true,
"staticcheck": true,
"usePlaceholders": false
},
"svelte.enable-ts-plugin": true
"clangd.path": "~/.config/coc/extensions/coc-clangd-data/install/15.0.6/clangd_15.0.6/bin/clangd",
"svelte.enable-ts-plugin": true,
"tsserver.log": "verbose"
}

@ -1,73 +1,103 @@
set nocompatible
so ~/.config/nvim/plugins.vim
so ~/.config/nvim/word_processing.vim
" --Plugin Configurations
let g:airline#extensions#tabline#enabled = 1
let g:airline#extensions#whitespace#enabled = 0
let g:airline_powerline_fonts = 1
let g:airline_theme='base16_bespin'
" let g:formatdef_gunk = '"gunk format -"'
" let g:formatters_gunk = ['gunk']
let g:go_gopls_enabled = 1
let g:pandoc#command#autoexec_command = "Pandoc! pdf --citeproc"
let g:pandoc#formatting#mode = 'ha'
let g:pandoc#formatting#textwidth = 100
let g:pandoc#spell#enabled = 0
let g:svelte_indent_script = 0
let g:svelte_indent_style = 0
"--My ColorScheme
set background=dark
set termguicolors
let g:srcery_italic=1
let g:srcery_bold=1
let g:srcery_white='#FCE8C3'
let g:srcery_bright_white='#FCF5E8'
colorscheme srcery
" General
set noerrorbells
set title
set number
set relativenumber
set signcolumn=number
set ruler
set wrap
set scrolloff=3
set clipboard+=unnamedplus
set colorcolumn=81
set guicursor+=a:blinkon0
set nofoldenable
set updatetime=300
set shortmess+=c
set mouse=ar
" Indentation and highlighting
filetype on
filetype plugin on
filetype plugin indent on
filetype indent on
set shiftwidth=4
set tabstop=4
set softtabstop=0
" Searchstuff
set ignorecase
set smartcase
set incsearch
set hlsearch
" Purple comments and transparent background
hi Comment guifg=#b799bd ctermfg=102
hi Normal guibg=#NONE ctermbg=NONE
set statusline^=%{coc#status()}%{get(b:,'coc_current_function','')}
lua <<EOF
-- telescope
vim.g['airline#extensions#tabline#enabled'] = 1
vim.g['airline#extensions#whitespace#enabled'] = 0
vim.g.airline_theme = 'catppuccin'
vim.g.airline_powerline_fonts = 1
vim.g.go_def_mapping_enabled =0
vim.g.go_gopls_enabled =1
vim.g.vimtex_view_method = 'zathura'
vim.g.vimtex_compiler_method = 'latexmk'
vim.g.vimtex_quickfix_enabled = 0
vim.g.maplocalleader = ","
vim.o.errorbells = false
vim.o.title = true
vim.o.number = true
vim.o.relativenumber = true
vim.o.signcolumn = "number"
vim.o.ruler = true
vim.o.wrap = true
vim.o.scrolloff = 3
vim.o.clipboard = "unnamedplus"
vim.o.guicursor = "n-v-c-sm:block,i-ci-ve:ver25,r-cr-o:hor20,a:blinkon0"
vim.o.foldenable = false
vim.o.updatetime = 300
vim.o.shortmess = "filnxtToOFc"
vim.o.mouse = "ar"
vim.o.shiftwidth = 4
vim.o.tabstop = 4
vim.o.softtabstop = 0
vim.o.ignorecase = true
vim.o.smartcase = true
vim.o.incsearch = true
vim.o.hlsearch = true
require("catppuccin").setup {
flavour = "mocha", -- latte, frappe, macchiato, mocha
term_colors = true,
transparent_background = true,
no_italic = false,
no_bold = false,
styles = {
comments = { "italic" },
conditionals = {},
loops = {},
functions = {},
keywords = {},
strings = {},
variables = {},
numbers = {},
booleans = {},
properties = {},
types = {},
},
color_overrides = {
mocha = {
base = "#000000",
mantle = "#222222",
},
},
integrations = {
coc_nvim = true,
native_lsp = {
enabled = true,
virtual_text = {
errors = { "undercurl" },
hints = { "italic" },
warnings = { "undercurl" },
information = { "italic" },
},
underlines = {
errors = { "undercurl" },
hints = { "underline" },
warnings = { "undercurl" },
information = { "underline" },
},
},
},
highlight_overrides = {
mocha = function(C)
return {
Comment = { fg = C.sky },
TabLineSel = { bg = C.pink },
CmpBorder = { fg = C.surface2 },
Pmenu = { bg = C.none },
TelescopeBorder = { link = "FloatBorder" },
}
end,
},
}
vim.o.background = "dark"
vim.o.termguicolors = true
vim.cmd.colorscheme("catppuccin-mocha")
require'telescope'.setup {
defaults = {
@ -75,82 +105,62 @@ require'telescope'.setup {
}
}
-- better syntax highlighting
require'nvim-treesitter.configs'.setup {
highlight = { enable = true },
incremental_selection = { enable = true },
textobjects = { enable = true },
}
vim.g.mapleader = ","
vim.g.coc_snippet_next = "<c-s-j>"
vim.g.coc_snippet_prev = "<c-s-k>"
vim.keymap.set('n', '//', '<cmd>nohls<cr>')
vim.keymap.set('n', ';', ':')
vim.keymap.set({'n', 'i'}, '<C-k>', '<cmd>bprev<cr>')
vim.keymap.set({'n', 'i'}, '<C-j>', '<cmd>bnext<cr>')
vim.keymap.set('n', 'K', '<cmd>call ShowDocumentation()<cr>', { silent = true })
vim.keymap.set('n', '<leader>w', ':e ')
vim.keymap.set('n', '<leader>E', '<cmd>Files<cr>')
vim.keymap.set('n', '<leader>b', '<cmd>Buffers<cr>')
vim.keymap.set('n', '<leader>d', '<cmd>bp<cr><cmd>:bd #<cr>')
vim.keymap.set('n', '<leader>rn', '<Plug>(coc-rename)')
vim.keymap.set('n', '<leader>pp', '<cmd>Prettier<cr>')
vim.keymap.set('n', '<leader>ff', '<cmd>Telescope find_files<cr>')
vim.keymap.set('n', '<leader>fg', '<cmd>Telescope live_grep<cr>')
vim.keymap.set('n', '<leader>fb', '<cmd>Telescope buffers<cr>')
vim.keymap.set('n', '<leader>fh', '<cmd>Telescope help_tags<cr>')
vim.keymap.set('n', '<leader>so', '<cmd>source ~/.config/nvim/init.vim<cr>')
vim.keymap.set('n', '[g', '<Plug>(coc-diagnostic-prev)', { silent = true })
vim.keymap.set('n', ']g', '<Plug>(coc-diagnostic-next)', { silent = true })
vim.keymap.set('n', '<leader>cl', '<Plug>(coc-codelens-action)', { silent = true })
vim.keymap.set('n', 'gd', '<Plug>(coc-definition)', { silent = true })
vim.keymap.set('n', 'gy', '<Plug>(coc-type-definition)', { silent = true })
vim.keymap.set('n', 'gi', '<Plug>(coc-implementaiton)', { silent = true })
vim.keymap.set('n', 'gr', '<Plug>(coc-references)', { silent = true })
vim.keymap.set('i', 'jj', '<Esc>')
vim.keymap.set('i', '<tab>', 'coc#pum#visible() ? coc#pum#next(1) : "<Tab>"', { expr = true, silent = true })
vim.keymap.set('i', '<s-tab>', 'coc#pum#visible() ? coc#pum#prev(1) : "<C-h>"', { expr = true, silent = true })
vim.keymap.set('i', '<cr>', 'EnterSelect()', { expr = true, silent = true })
vim.keymap.set('i', '<c-space>', 'coc#refresh()', { expr = true, silent = true })
vim.keymap.set('i', '<c-p>', '<cmd>call CocActionAsync("showSignatureHelp")<cr>a')
vim.keymap.set('i', '<c-a>', '<cmd>call CocActionAsync("codeAction", "")<cr>', { silent = true})
EOF
""""""""""""""""""""""""""""""""""""""""
" "
" KEYBINDS "
" "
""""""""""""""""""""""""""""""""""""""""
inoremap jj <Esc>
noremap // :nohls<RETURN>
noremap ; :
command WQ wq
command Wq q
command W w
command Q w
nnoremap <C-k> :bprev<CR>
nnoremap <C-j> :bnext<CR>
inoremap <C-k> <Esc>:bprev<CR>
inoremap <C-j> <Esc>:bnext<CR>
nnoremap gf :e <cfile><CR>
noremap <Up> <Nop>
noremap <Right> <Nop>
inoremap <C-P> <C-\><C-O>:call CocActionAsync('showSignatureHelp')<CR>
noremap <silent> <Left> :call CocAction('diagnosticNext')<CR>
noremap <silent> <Down> :call CocAction('diagnosticPrevious')<CR>
nnoremap <silent> K :call <SID>show_documentation()<CR>
let mapleader=","
nnoremap <leader>w :e<SPACE>
nnoremap <leader>E :Files<CR>
nnoremap <leader>b :Buffers<CR>
nnoremap <leader>d :bp<cr>:bd #<cr>
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>
nmap <leader>a <Plug>(coc-codeaction-selected)
noremap <leader>y :VCopy<CR>
vnoremap <leader>y :<BS><BS><BS><BS><BS>VCopyVisual<CR>
noremap <leader>pd :Pandoc pdf --citeproc -Vmainfont="TeX Gyre Schola"
\ -Vmathfont="TeX Gyre Schola Math" -Vdocumentclass="scrartcl"
\ --resource-path=images --highlight-style ~/.config/pandoc/code.theme
\ -Fpandoc-crossref -Fpandoc-include -Fpantable<CR><CR>
nnoremap <leader>g :GoRun<CR>
nnoremap <leader>f :PrettierAsync<CR>
nnoremap <leader>so :so ~/.config/nvim/init.vim<CR>
nnoremap <leader>e :CocCommand explorer --toggle<CR>
nnoremap <leader>lg :CocCommand workspace.showOutput coc-gunk <CR>
noremap <A-j> dap } p
noremap <A-k> vap :m '<-2<CR>gv=gv
" COC
nmap <silent> gd <Plug>(coc-definition)
nmap <silent> gy <Plug>(coc-type-definition)
nmap <silent> gi <Plug>(coc-implementation)
nmap <silent> gr <Plug>(coc-references)
nmap <leader>rn <Plug>(coc-rename)
nnoremap <leader>o :<C-u>CocList outline<cr>
let g:copilot_filetypes = {
\ '*': v:false,
\ 'gunk': v:true,
\ }
command! -nargs=0 Prettier :CocCommand prettier.forceFormatDocument
""""""""""""""""""""""""""""""""""""""""
" "
@ -159,99 +169,63 @@ let g:copilot_filetypes = {
""""""""""""""""""""""""""""""""""""""""
autocmd FileType html,css,scss
" autocmd FileType html,css,scss
\ setlocal ts=4 sts=4 sw=4 expandtab
autocmd FileType javascript,typescript,typescriptreact,svelte
" autocmd FileType javascript,typescript,typescriptreact,svelte
\ setlocal ts=2 sts=2 sw=2 expandtab
autocmd BufNewFile,BufRead *.markdown,*.text
" autocmd BufNewFile,BufRead *.markdown,*.text
\ setlocal ts=2 sts=2 sw=2
\ set textwidth=100 colorcolumn=101
autocmd FileType sql
" autocmd FileType sql
\setlocal ts=2 sts=2 sw=2 expandtab
autocmd BufNewFile,BufRead *.md.tmpl
" autocmd BufNewFile,BufRead *.md.tmpl
\ setlocal filetype=markdown
autocmd BufNewFile,BufRead .*config,*.config,config
" autocmd BufNewFile,BufRead .*config,*.config,config
\ setlocal filetype=gitconfig
autocmd BufNewFile,BufRead *.bolt
" autocmd BufNewFile,BufRead *.bolt
\ setlocal filetype=typescript
autocmd BufNewFile,BufRead *.cql
" autocmd BufNewFile,BufRead *.cql
\ setlocal filetype=cql
autocmd BufNewFile,BufRead *.gradle,*.groovy
" autocmd BufNewFile,BufRead *.gradle,*.groovy
\ setlocal filetype=groovy
autocmd BufNewFile,BufRead *.osgjs,*.osgjs.gz
" autocmd BufNewFile,BufRead *.osgjs,*.osgjs.gz
\ setlocal filetype=json
autocmd BufNewFile,BufRead *.postcss
" autocmd BufNewFile,BufRead *.postcss
\ setlocal filetype=css
autocmd BufNewFile,BufRead *.go.tpl,*.peg,*.qtpl
" autocmd BufNewFile,BufRead *.go.tpl,*.peg,*.qtpl
\ setlocal syntax=go
autocmd BufNewFile,BufRead *.gunk
" autocmd BufNewFile,BufRead *.gunk
\ setlocal filetype=gunk syntax=go
autocmd BufNewFile,BufRead *.gltf
" autocmd BufNewFile,BufRead *.gltf
\ setlocal filetype=gltf syntax=json
autocmd BufNewFile,BufRead *.frag
" autocmd BufNewFile,BufRead *.frag
\ setlocal filetype=glsl syntax=glsl
" autocmd BufWrite *.gunk
" \ :Autoformat
let g:coc_snippet_next = '<tab>'
let g:coc_snippetnext = '<tab>'
autocmd CursorHold * silent call CocActionAsync('highlight')
"
autocmd FileType json syntax match Comment +\/\/.\+$+
autocmd BufWritePre *.svelte,*.ts :silent call CocAction('runCommand', 'editor.action.organizeImport')
autocmd FileType svelte setlocal commentstring=//\ %s
inoremap <silent><expr> <TAB>
\ pumvisible() ? coc#_select_confirm() :
\ coc#expandableOrJumpable() ?
\ "\<C-r>=coc#rpc#request('doKeymap', ['snippets-expand-jump',''])\<CR>" :
\ <SID>check_back_space() ? "\<TAB>" :
\ coc#refresh()
function! s:check_back_space() abort
let col = col('.') - 1
return !col || getline('.')[col - 1] =~# '\s'
endfunction
augroup mygroup
autocmd!
autocmd FileType typescript,json setl formatexpr=CocAction('formatSelected')
autocmd User CocJumpPlaceholder call CocActionAsync('showSignatureHelp')
augroup end
inoremap <silent><expr> <c-space> coc#refresh()
function! EnterSelect()
if coc#pum#visible() && coc#pum#info()["index"] == -1
return "\<esc>o"
inoremap <silent><expr> <cr> pumvisible() ? coc#_select_confirm()
\: "\<C-g>u\<CR>\<c-r>=coc#on_enter()\<CR>"
elseif coc#pum#visible()
return coc#_select_confirm()
function! s:show_documentation()
if (index(['vim','help'], &filetype) >= 0)
execute 'h '.expand('<cword>')
elseif (coc#rpc#ready())
call CocActionAsync('doHover')
else
execute '!' . &keywordprg . " " . expand('<cword>')
endif
return "\<C-g>u\<CR>\<c-r>=coc#on_enter()\<CR>"
endfunction
function! s:doHover()
if coc#rpc#ready()
let diagnostics = CocAction('diagnosticList')
if empty(diagnostics)
function! ShowDocumentation()
if CocAction('hasProvider', 'hover')
call CocActionAsync('doHover')
return
endif
let file = expand('%:p')
let lnum = line('.')
let cnum = col('.')
for v in diagnostics
if v['file'] != file
\ || lnum != v['lnum']
\ || cnum < v['location']['range']['start']['character']
\ || cnum > v['location']['range']['end']['character']
call CocActionAsync('doHover')
return
endif
endfor
else
call feedkeys('K', 'in')
endif
endfunction
augroup mygroup
autocmd!
" Setup formatexpr specified filetype(s).
autocmd FileType typescript,json setl formatexpr=CocAction('formatSelected')
" Update signature help on jump placeholder.
autocmd User CocJumpPlaceholder call CocActionAsync('showSignatureHelp')
augroup end
noremap <leader>py :! clear; python %<CR>

@ -1,33 +1,21 @@
call plug#begin()
Plug 'chrisbra/Colorizer'
Plug 'KabbAmine/vCoolor.vim'
Plug 'ap/vim-css-color'
Plug 'neoclide/coc.nvim', {'branch': 'release'}
Plug 'fatih/vim-go', {'do': ':GoUpdateBinaries'}
Plug 'evanleck/vim-svelte'
Plug 'lervag/vimtex'
Plug 'cespare/vim-toml'
Plug 'evanleck/vim-svelte', {'branch': 'main'}
Plug 'fatih/vim-go'
Plug 'github/copilot.vim'
Plug 'junegunn/fzf', { 'do': { -> fzf#install() } }
Plug 'junegunn/fzf.vim'
Plug 'nvim-lua/plenary.nvim'
Plug 'nvim-telescope/telescope.nvim'
Plug 'machakann/vim-highlightedyank'
Plug 'mattn/emmet-vim'
Plug 'neoclide/coc.nvim', {'branch': 'release'}
Plug 'nvim-treesitter/nvim-treesitter', {'do': ':TSUpdate'} " We recommend updating the parsers on update
Plug 'posva/vim-vue'
Plug 'prettier/vim-prettier', { 'do': 'yarn install' }
Plug 'ron89/thesaurus_query.vim'
Plug 'srcery-colors/srcery-vim'
Plug 'bluz71/vim-moonfly-colors'
Plug 'catppuccin/nvim', { 'as': 'catppuccin' }
Plug 'tpope/vim-commentary'
Plug 'tpope/vim-unimpaired'
Plug 'udalov/kotlin-vim'
Plug 'vim-airline/vim-airline'
Plug 'vim-airline/vim-airline-themes'
Plug 'vim-autoformat/vim-autoformat'
Plug 'vim-pandoc/vim-pandoc'
Plug 'vim-pandoc/vim-pandoc-syntax'
Plug '~/code/misc/vcopy.nvim'
Plug 'hashivim/vim-terraform'
call plug#end()

@ -1,19 +0,0 @@
func! WordProcessor()
" movement changes
map j gj
map k gk
map 0 g0
map $ g$
" formatting text
setlocal wrap
setlocal linebreak
" spelling and thesaurus
setlocal spell spelllang=en_us
" complete+=s makes autocompletion search the thesaurus
set complete+=s
set expandtab
set tabstop=2
set textwidth=100
endfu
com! WP call WordProcessor()