-
-
Save Glog78/4ad797317196209a46fc27be3e07f7cc to your computer and use it in GitHub Desktop.
Haiku lsp+vim example vimrc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"Haiku installation hints: | |
"------------------------------------------------- | |
"1.) clangd | |
" pkgman install llvm12-clangd | |
"2.) rust-analyzer (currently buggy) | |
" pkgman install rust-bin | |
"3.) pip as of writing | |
" pkgman install pip3.10 | |
"4.) cmake-language-server | |
" pip3.10 install cmake-language-server | |
"5.) python language server | |
" pip3.10 install 'python-language-server[all]' | |
"6.) ag and fzy | |
" pkgman install fzy the_silver_searcher | |
"7.) node16 and yarn | |
" pkgman node16js yarn | |
"8.) configure yarn and bugfix for yarn creating /usr/... in root | |
" echo -e "disable-self-update-check true\nprefix \"/boot/home/config/non-packaged\"" >~/.yarnrc | |
"9.) install bash-language-server | |
" yarn global add bash-language-server | |
"10.) install vim-language-server | |
" yarn global add vim-language-server | |
"11.) dirty workaround for zod module emoji error might need to be redone on new package install or update | |
" sed -i '/emojiRegex =/s/^/\/\//' /boot/home/config/non-packaged/data/yarn/global/node_modules/zod/lib/types.js | |
"------------------------------------------------ | |
"copy this vimrc to ~/config/settings/vim/ | |
"do one start and | |
":JetpackSync | |
"do one last restart | |
"------------------------------------------------ | |
"hint fonts: | |
" UTF8 font without ligatures -> https://github.com/ryanoasis/nerd-fonts/tree/master/patched-fonts/JetBrainsMono/NoLigatures | |
" UTF8 font with ligatures -> https://github.com/ryanoasis/nerd-fonts/tree/master/patched-fonts/JetBrainsMono/Ligatures | |
"create swap dir if it doesn't exist | |
call mkdir($HOME .. "/config/cache/vim/swap","p") | |
"set swapfile directory outside of project directories | |
set directory^=$HOME/config/cache/vim/swap// | |
"set real vim mode and disable being vi compatible | |
set nocompatible | |
"load file type dependend plugins | |
filetype plugin on | |
"enable syntax highlighting | |
syntax on | |
"create vim jetpack directory and download the package manager | |
call mkdir($HOME .. "/config/settings/vim/pack/jetpack/opt/vim-jetpack/plugin","p") | |
if !filereadable(expand('~/config/settings/vim/pack/jetpack/opt/vim-jetpack/plugin/jetpack.vim')) | |
call system(printf('wget -O %s https://raw.githubusercontent.com/kat0h/vim9-jetpack/master/plugin/jetpack.vim',expand('~/config/settings/vim/pack/jetpack/opt/vim-jetpack/plugin/jetpack.vim'))) | |
endif | |
packadd vim-jetpack | |
"start packagemanagement with haiku compatible path | |
call jetpack#begin('~/config/settings/vim/') | |
Jetpack 'kat0h/vim-jetpack', {'opt': 1} | |
Jetpack 'sainnhe/gruvbox-material' | |
Jetpack 'greeschenko/vim9-lsp' | |
Jetpack 'Bakudankun/qline.vim' | |
Jetpack 'itchyny/lightline.vim' | |
Jetpack 'tpope/vim-fugitive' | |
"end packagemanagement | |
call jetpack#end() | |
let g:loaded_lightline = 1 | |
let g:qline_config = {} | |
let g:qline_config.colorscheme = 'lightline:gruvbox_material' | |
"disable indentation | |
"needs to come after plugin management so it's off for sure | |
filetype plugin indent off | |
let lspServers = [ | |
\ #{ | |
\ name: 'clangd', | |
\ filetype: ['c', 'cpp'], | |
\ path: '/bin/clangd', | |
\ args: ['--background-index'] | |
\ }, | |
\ #{ | |
\ name: 'rustls', | |
\ filetype: ['rust'], | |
\ path: '/bin/rust-analyzer', | |
\ args: [], | |
\ syncInit: v:true, | |
\ }, | |
\ #{ | |
\ name: 'cmake_language_server', | |
\ filetype: ['cmake'], | |
\ path: '/boot/system/non-packaged/bin/cmake-language-server', | |
\ args: [], | |
\ syncInit: v:true, | |
\ initializationOptions: { | |
\ 'buildDirectory': 'build' | |
\ } | |
\ }, | |
\ #{ | |
\ name: 'python-language-server', | |
\ filetype: ['python'], | |
\ path: '/boot/system/non-packaged/bin/pyls', | |
\ args: ['--check-parent-process', '-v'], | |
\ }, | |
\ #{ | |
\ name: 'bash-language-server', | |
\ filetype: ['sh'], | |
\ path: '/boot/home/config/non-packaged/bin/bash-language-server', | |
\ args: ['start'], | |
\ }, | |
\ #{ | |
\ name: 'vimscript-language-server', | |
\ filetype: ['vim'], | |
\ path: '/boot/home/config/non-packaged/bin/vim-language-server', | |
\ args: ['--stdio'], | |
\ }, | |
\] | |
autocmd VimEnter * call LspAddServer(lspServers) | |
set wildmenu | |
set wildmode=longest:full,full | |
set completeopt=longest,menuone | |
let lspOpts = { | |
\ 'autoComplete': v:true, | |
\ 'completionMatcher': 'fuzzy', | |
\ 'autoHighlightDiags': v:true, | |
\ 'showDiagOnStatusLine': v:true, | |
\ 'noNewlineInCompletion': v:true, | |
\ 'outlineOnRight': v:true, | |
\ 'outlineWinSize': 40 | |
\} | |
autocmd VimEnter * call LspOptionsSet(lspOpts) | |
"enable true color and gruvbox-material | |
set termguicolors | |
set bg=dark | |
colorscheme gruvbox-material | |
"search settings | |
set incsearch | |
set hlsearch | |
"enable mouse | |
set mouse=a | |
"set undobuffer | |
set history=10000 | |
"set fillchar for spaces tabs and eol | |
set list | |
set listchars=tab:\ \ ┆,space:·,eol:↵ | |
"enable relativenumber | |
set relativenumber | |
"set that new windows open right or below existing windows | |
set splitbelow | |
set splitright | |
"enable modline support | |
set modeline | |
set modelines=1 | |
"backspace can delete further | |
set backspace=indent,eol,start | |
"default settings for files | |
"maybe 4 chars for intend might be better but i love | |
"2 chars | |
set smartindent | |
set tabstop=2 | |
set shiftwidth=2 | |
set sidescroll=2 | |
set noexpandtab | |
"from https://github.com/jhawthorn/fzy | |
function! FzyCommand(choice_command, vim_command) | |
try | |
let output = system(a:choice_command . " | fzy ") | |
catch /Vim:Interrupt/ | |
" Swallow errors from ^C, allow redraw! below | |
endtry | |
redraw! | |
if v:shell_error == 0 && !empty(output) | |
exec a:vim_command . ' ' . output | |
endif | |
endfunction | |
let mapleader='.' | |
nnoremap <leader>e :call FzyCommand("ag . --silent -l -g ''", ":e")<cr> | |
nnoremap <leader>v :call FzyCommand("ag . --silent -l -g ''", ":vs")<cr> | |
nnoremap <leader>s :call FzyCommand("ag . --silent -l -g ''", ":sp")<cr> | |
"uncomment the next lines if you want to JetpackSync on every start | |
"augroup JetPackUpdate | |
" au! VimEnter * nested JetpackSync | |
"augroup end | |
" vim: sw=4 ss=4 ts=4 nu noet |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment