Let's start
This commit is contained in:
commit
ec5f72e8cb
2 changed files with 471 additions and 0 deletions
12
coc-settings.json
Normal file
12
coc-settings.json
Normal file
|
@ -0,0 +1,12 @@
|
|||
{
|
||||
"diagnostic.checkCurrentLine": true,
|
||||
"suggest.enablePreselect": false,
|
||||
"suggest.noselect": true,
|
||||
"diagnostic.messageDelay": 800,
|
||||
"python.analysis.diagnosticSeverityOverrides": {
|
||||
"reportInvalidStringEscapeSequence": "none",
|
||||
"reportUnboundVariable": "none"
|
||||
},
|
||||
"python.linting.ruffEnabled": true
|
||||
}
|
||||
|
459
nix.vim
Normal file
459
nix.vim
Normal file
|
@ -0,0 +1,459 @@
|
|||
filetype off " required
|
||||
|
||||
set shell=/run/current-system/sw/bin/sh
|
||||
|
||||
" use undo directory to store undo files between sessions
|
||||
if isdirectory('~/.local/share/vim-undo')
|
||||
set undodir=~/.local/share/vim-undo
|
||||
set undofile
|
||||
endif
|
||||
|
||||
" detect remote sessions
|
||||
let g:remoteSession = ($SSH_CLIENT != "")
|
||||
|
||||
" yank to system clipboard
|
||||
noremap yc "+yy
|
||||
if g:remoteSession
|
||||
autocmd TextYankPost * if v:event.operator is 'y' && v:event.regname is '+' | OSCYankReg + | endif
|
||||
endif
|
||||
|
||||
" Ctrl arrow mappings for mux
|
||||
map <ESC>[1;5C <C-Right>
|
||||
map <ESC>[1;5D <C-Left>
|
||||
|
||||
" ctrl-right should pause at the end of the line (thanks to: crose @ #vim)
|
||||
" TODO: Does not work, ask to forum
|
||||
inoremap <expr><silent> <C-Right> search('\s', 'Wn', line('.')) <bar><bar> col('.') >= col('$') - 1 ? '<C-Right>' : '<c-o>$'
|
||||
nnoremap <expr><silent> <C-Right> search('\s', 'Wn', line('.')) <bar><bar> col('.') >= col('$') - 1 ? '<C-Right>' : '$'
|
||||
|
||||
syntax enable
|
||||
set expandtab
|
||||
set tabstop=4
|
||||
set softtabstop=4
|
||||
set shiftwidth=4
|
||||
set shiftround
|
||||
set cinoptions=(0
|
||||
|
||||
set ruler
|
||||
set history=10000
|
||||
set colorcolumn=120
|
||||
set hlsearch " highlight all search results
|
||||
set ignorecase " do case insensitive search
|
||||
set incsearch " show incremental search results as you type
|
||||
set hidden
|
||||
set nofoldenable " who the fuck uses folding
|
||||
|
||||
augroup NO_CURSOR_MOVE_ON_FOCUS
|
||||
au!
|
||||
au FocusLost * let g:oldmouse=&mouse | set mouse=
|
||||
au FocusGained * if exists('g:oldmouse') | let &mouse=g:oldmouse | unlet g:oldmouse | endif
|
||||
augroup END
|
||||
|
||||
" LEADER button, comma is da best for it
|
||||
:let mapleader = ","
|
||||
:let maplocalleader = ","
|
||||
|
||||
colorscheme nord
|
||||
" hi Visual term=reverse cterm=reverse guibg=#634811
|
||||
set background=light
|
||||
|
||||
"Limelight plugin
|
||||
let g:limelight_conceal_guifg = '#83a598'
|
||||
map <C-l> :Limelight!!<CR>
|
||||
let g:limelight_conceal_ctermfg = 'gray'
|
||||
let g:limelight_conceal_ctermfg = 240
|
||||
let g:limelight_priority = -1
|
||||
|
||||
" Illuminate plugin
|
||||
augroup illuminate_augroup
|
||||
autocmd!
|
||||
autocmd VimEnter * hi illuminatedWord cterm=underline gui=underline
|
||||
augroup END
|
||||
|
||||
" Return to last edit position when opening files
|
||||
autocmd BufReadPost *
|
||||
\ if line("'\"") > 0 && line("'\"") <= line("$") |
|
||||
\ exe "normal! g`\"" |
|
||||
\ endif
|
||||
|
||||
let g:NERDSpaceDelims = 1
|
||||
" Comment with Crtl-C
|
||||
" map <C-C> <Plug>NERDCommenterToggle
|
||||
" Toggle tagbar
|
||||
map <C-t> :TagbarToggle<CR>
|
||||
|
||||
"Show tab chars visibly and use them with tab button
|
||||
command Showtabs set list|set listchars=tab:>-|set noexpandtab
|
||||
|
||||
" Set tab space to 2
|
||||
command Tabs2space set autoindent expandtab tabstop=2 shiftwidth=2
|
||||
" Set tab space to 4
|
||||
command Tabs4space set autoindent expandtab tabstop=4 shiftwidth=4
|
||||
|
||||
" Telescope
|
||||
nnoremap <Leader>f <cmd>Telescope file_browser<cr>
|
||||
nnoremap <Leader>g <cmd>Telescope live_grep<cr>
|
||||
nnoremap <Leader>z <cmd>Telescope zoxide list<cr>
|
||||
nnoremap <Leader>b <cmd>Telescope git_branches<cr>
|
||||
|
||||
"yanky
|
||||
nnoremap <Leader>c <cmd>Telescope yank_history theme=ivy<cr>
|
||||
|
||||
lua << EOF
|
||||
-- Telescope
|
||||
local actions = require("telescope.actions")
|
||||
local fb_actions = require "telescope._extensions.file_browser.actions"
|
||||
require('telescope').setup{
|
||||
extensions = {
|
||||
file_browser = {
|
||||
theme = "ivy",
|
||||
-- disables netrw and use telescope-file-browser in its place
|
||||
hijack_netrw = true,
|
||||
cwd_to_path = true,
|
||||
grouped = true,
|
||||
hidden = true,
|
||||
files = true,
|
||||
auto_depth = 4,
|
||||
git_status = true,
|
||||
mappings = {
|
||||
["i"] = {
|
||||
["<C-Up>"] = fb_actions.goto_parent_dir
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
defaults = {
|
||||
mappings = {
|
||||
i = {
|
||||
-- Quit via Esc in insert mode
|
||||
["<esc>"] = actions.close,
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
require("telescope").load_extension "file_browser"
|
||||
|
||||
-- Transparent
|
||||
require("transparent").setup({
|
||||
extra_groups = {
|
||||
"BufferLineTabClose",
|
||||
"BufferlineBufferSelected",
|
||||
"BufferLineFill",
|
||||
"BufferLineBackground",
|
||||
"BufferLineSeparator",
|
||||
"BufferLineIndicatorSelected",
|
||||
"CocFloating",
|
||||
},
|
||||
})
|
||||
vim.opt.termguicolors = true
|
||||
vim.cmd [[highlight CoCMenuSel guibg=#5e81ac]]
|
||||
vim.cmd [[highlight IndentBlanklineIndent1 guifg=#E06C75]]
|
||||
vim.cmd [[highlight IndentBlanklineIndent2 guifg=#E5C07B]]
|
||||
vim.cmd [[highlight IndentBlanklineIndent3 guifg=#98C379 gui=nocombine]]
|
||||
vim.cmd [[highlight IndentBlanklineIndent4 guifg=#56B6C2 gui=nocombine]]
|
||||
vim.cmd [[highlight IndentBlanklineIndent5 guifg=#61AFEF gui=nocombine]]
|
||||
vim.cmd [[highlight IndentBlanklineIndent6 guifg=#C678DD gui=nocombine]]
|
||||
|
||||
-- indent
|
||||
vim.opt.list = true
|
||||
require("indent_blankline").setup {
|
||||
space_char_blankline = " ",
|
||||
show_trailing_blankline_indent = false,
|
||||
char = "┊",
|
||||
char_highlight_list = {
|
||||
"",
|
||||
"IndentBlanklineIndent1",
|
||||
"IndentBlanklineIndent2",
|
||||
"IndentBlanklineIndent3",
|
||||
"IndentBlanklineIndent4",
|
||||
"IndentBlanklineIndent5",
|
||||
"IndentBlanklineIndent6",
|
||||
},
|
||||
}
|
||||
|
||||
-- yanky
|
||||
local utils = require("yanky.utils")
|
||||
local mapping = require("yanky.telescope.mapping")
|
||||
require("yanky").setup({
|
||||
picker = {
|
||||
select = {
|
||||
action = nil, -- nil to use default put action
|
||||
},
|
||||
highlight = {
|
||||
on_put = true,
|
||||
on_yank = true,
|
||||
timer = 1500,
|
||||
},
|
||||
telescope = {
|
||||
mappings = {
|
||||
default = mapping.set_register(utils.get_default_register()),
|
||||
i = {
|
||||
["<C-p>"] = mapping.put("p"),
|
||||
["<C-P>"] = mapping.put("P"),
|
||||
},
|
||||
}
|
||||
},
|
||||
},
|
||||
})
|
||||
require("telescope").load_extension("yank_history")
|
||||
vim.keymap.set({"n","x"}, "p", "<Plug>(YankyPutAfter)")
|
||||
vim.keymap.set({"n","x"}, "P", "<Plug>(YankyPutBefore)")
|
||||
|
||||
-- leap
|
||||
require('leap').set_default_keymaps(true)
|
||||
|
||||
-- comment.nvim
|
||||
require('Comment').setup(
|
||||
{
|
||||
toggler = {
|
||||
line = '<C-C>',
|
||||
},
|
||||
opleader = {
|
||||
line = '<C-C>',
|
||||
}
|
||||
})
|
||||
|
||||
require('lualine').setup(
|
||||
{
|
||||
options = {
|
||||
theme = 'everforest',
|
||||
},
|
||||
tabline = {
|
||||
lualine_a = {
|
||||
{ 'buffers',
|
||||
show_filename_only = false,
|
||||
symbols = {
|
||||
modified = ' +'
|
||||
}
|
||||
},
|
||||
},
|
||||
},
|
||||
sections = {
|
||||
lualine_a = {'mode'},
|
||||
lualine_b = {'branch', 'diff', 'diagnostics'},
|
||||
lualine_c = {'filename'},
|
||||
lualine_x = {'encoding', 'fileformat', 'filetype'},
|
||||
lualine_y = {'progress'},
|
||||
lualine_z = {'location'}
|
||||
},
|
||||
})
|
||||
|
||||
EOF
|
||||
|
||||
" do not yank with x
|
||||
nnoremap x "_x
|
||||
|
||||
" indent_blankline
|
||||
let g:indent_blankline_show_first_indent_level = v:false
|
||||
|
||||
" gutentags
|
||||
let g:gutentags_cache_dir = '/tmp/gutentags'
|
||||
|
||||
" easytags
|
||||
let g:easytags_async = 1
|
||||
|
||||
" Window chooser
|
||||
nmap c <Plug>(choosewin)
|
||||
let g:choosewin_overlay_enable = 1
|
||||
|
||||
" airline
|
||||
" let g:airline_powerline_fonts = 1
|
||||
" let g:airline#extensions#tabline#enabled = 1
|
||||
" let g:airline_theme='dark'
|
||||
" let gairline#extensions#tabline#formatter = 'unique_tail'
|
||||
|
||||
" yaml
|
||||
autocmd FileType yaml setlocal ts=2 sts=2 sw=2 expandtab
|
||||
|
||||
" python
|
||||
" au BufNewFile,BufRead *.py
|
||||
" \ set tabstop=4 |
|
||||
" \ set softtabstop=4 |
|
||||
" \ set shiftwidth=4 |
|
||||
" \ set textwidth=79 |
|
||||
" \ set expandtab |
|
||||
" \ set autoindent |
|
||||
" \ set fileformat=unix
|
||||
|
||||
let python_highlight_all=1
|
||||
|
||||
" vimwiki stuff "
|
||||
let hostname = substitute(system('hostname'), '\n', '', '')
|
||||
let mywiki = {}
|
||||
if hostname == "rocksteady"
|
||||
let mywiki.path = '/shared/syncfolder/wiki'
|
||||
let mywiki.path_html = '/shared/vhosts/gurkan.in/public/wiki'
|
||||
else
|
||||
let mywiki.path = '~/syncfolder/wiki'
|
||||
let mywiki.path_html = '/tmp/wikihtml'
|
||||
endif
|
||||
let mywiki.syntax = 'markdown'
|
||||
let mywiki.ext = '.md'
|
||||
let mywiki.auto_toc = 1
|
||||
let mywiki.custom_wiki2html = 'vimwiki_markdown'
|
||||
|
||||
let g:vimwiki_list = [mywiki]
|
||||
let g:vimwiki_ext2syntax = {'.md': 'markdown', '.markdown': 'markdown', '.mdown': 'markdown'}
|
||||
|
||||
" flake8: Ignore some warnings
|
||||
let g:syntastic_python_flake8_post_args='--ignore=W1202'
|
||||
|
||||
" Do not make chars starting with _ subscript
|
||||
let g:tex_conceal = ""
|
||||
|
||||
let g:tagbar_width = 50
|
||||
let g:tagbar_autoshowtag = 1
|
||||
let g:tagbar_autofocus = 0
|
||||
let g:tagbar_autoclose = 0
|
||||
let g:tagbar_silent = 0
|
||||
let g:tagbar_compact = 1
|
||||
let g:tagbar_indent = 1
|
||||
let g:tagbar_left = 0
|
||||
let g:tagbar_iconchars = ['▸', '▾']
|
||||
let g:tagbar_sort = 0
|
||||
|
||||
" filetype-specific stuff
|
||||
autocmd BufRead,BufNewFile *.md
|
||||
\ set linebreak
|
||||
|
||||
" if I have my path available, I have cool stuff
|
||||
if !empty(glob("~/.path/markdown2ctags.py"))
|
||||
" My .md files are not "markdown" type, they're "vimwiki"
|
||||
let g:tagbar_type_vimwiki = {
|
||||
\ 'ctagstype': 'markdown',
|
||||
\ 'ctagsbin' : '~/.path/markdown2ctags.py',
|
||||
\ 'ctagsargs' : '-f - --sort=yes',
|
||||
\ 'kinds' : [
|
||||
\ 's:sections',
|
||||
\ 'i:images'
|
||||
\ ],
|
||||
\ 'sro' : '|',
|
||||
\ 'kind2scope' : {
|
||||
\ 's' : 'section',
|
||||
\ },
|
||||
\ 'sort': 0,
|
||||
\ }
|
||||
endif
|
||||
|
||||
" nerdtree, tagbar: Start as open
|
||||
" First kick tagbar so it calculates correctly
|
||||
" Also enable only if ctags are available
|
||||
" if executable('ctags-exuberant') || executable('ctags')
|
||||
" autocmd VimEnter * TagbarOpen
|
||||
" autocmd VimEnter * ToggleNERDTreeAndTagbar
|
||||
" endif
|
||||
" Go to previous (last accessed) window.
|
||||
" autocmd VimEnter * wincmd p
|
||||
|
||||
" transparent-nvim is caching like a moron
|
||||
autocmd VimEnter * :TransparentEnable
|
||||
|
||||
" Do not leave a space when combining lines with J
|
||||
nmap J gJi <ESC>diW
|
||||
|
||||
" Auto-close nerdtree if nothing left in buffer
|
||||
autocmd bufenter * nested if (winnr("$") == 1 && exists("b:NERDTree") && b:NERDTree.isTabTree()) | q | endif
|
||||
|
||||
" Define hiera filetype
|
||||
augroup CatchHieraFiles
|
||||
au! BufRead,BufNewFile,BufEnter hiera/*.json set filetype=hierafile syntax=json
|
||||
augroup END
|
||||
|
||||
" Copilot
|
||||
" not welcomed in hieras
|
||||
let g:copilot_filetypes = {
|
||||
\ 'hierafile': v:false,
|
||||
\ }
|
||||
|
||||
" CoC
|
||||
let g:no_python_maps = 1
|
||||
function! CheckBackspace() abort
|
||||
let col = col('.') - 1
|
||||
return !col || getline('.')[col - 1] =~ '\s'
|
||||
endfunction
|
||||
" Insert <tab> when previous text is space, refresh completion if not.
|
||||
inoremap <silent><expr> <TAB>
|
||||
\ coc#pum#visible() ? coc#pum#next(1):
|
||||
\ CheckBackspace() ? "\<Tab>" :
|
||||
\ coc#refresh()
|
||||
inoremap <expr><S-TAB> coc#pum#visible() ? coc#pum#prev(1) : "\<C-h>"
|
||||
inoremap <expr> <CR> pumvisible() ? "\<C-Y>" : "\<C-G>u\<CR>"
|
||||
nmap gd <Plug>(coc-definition)
|
||||
nnoremap en <Plug>(coc-diagnostic-next-error)
|
||||
nnoremap ep <Plug>(coc-diagnostic-prev-error)
|
||||
" TODO: how to make it actually italic?
|
||||
hi CoCInlayHint gui=italic guifg=#94680a
|
||||
|
||||
" Fuck capitals
|
||||
cabb W w
|
||||
cabb X x
|
||||
cabb Q q
|
||||
|
||||
" F6 to fix all indentation
|
||||
map <F6> gg=G<C-o><C-o>
|
||||
|
||||
" reload neovim
|
||||
nnoremap <leader>r :source ~/.config/nvim/nix.vim<CR>
|
||||
|
||||
" Arrows can wrap lines, why the fuck this is not default?
|
||||
set whichwrap+=<,>,[,]
|
||||
|
||||
" Do not auto-newline my shit
|
||||
set formatoptions-=t
|
||||
|
||||
" switch buffers with Ctrl left and right
|
||||
nnoremap <C-S-right> :bnext<CR>
|
||||
nnoremap <C-S-left> :bprevious<CR>
|
||||
" and whilst in insert mode
|
||||
inoremap <C-S-right> <Esc>:bnext<CR>
|
||||
inoremap <C-S-left> <Esc>:previous<CR>
|
||||
|
||||
" split window
|
||||
nmap <leader>sw<left> :topleft vnew<CR>
|
||||
nmap <leader>sw<right> :botright vnew<CR>
|
||||
nmap <leader>sw<up> :topleft new<CR>
|
||||
nmap <leader>sw<down> :botright new<CR>
|
||||
|
||||
map <S-down> <C-W>j
|
||||
map <S-up> <C-W>k
|
||||
map <S-left> <C-W>h
|
||||
map <S-right> <C-W>l
|
||||
|
||||
" cursor browsing (too bad Alt is not usable)
|
||||
nnoremap <Leader><Left> <C-O>
|
||||
nnoremap <Leader><Right> <C-I>
|
||||
|
||||
" Ctrl-backspace deletes previous word
|
||||
noremap! <C-BS> <C-w>
|
||||
noremap! <C-h> <C-w>
|
||||
|
||||
" split buffer
|
||||
nmap <leader>sb<left> :leftabove vnew<CR>
|
||||
nmap <leader>sb<right> :rightbelow vnew<CR>
|
||||
nmap <leader>sb<up> :leftabove new<CR>
|
||||
nmap <leader>sb<down> :rightbelow new<CR>
|
||||
|
||||
" A helper to preserve the cursor location with filters
|
||||
function! Preserve(command)
|
||||
let w = winsaveview()
|
||||
execute a:command
|
||||
call winrestview(w)
|
||||
endfunction
|
||||
|
||||
" Update fetcher under cursor, note that this might take a little while if the
|
||||
" fetched path is large.
|
||||
autocmd FileType nix map <nowait> <leader>u :call Preserve("%!update-nix-fetchgit --location=" . line(".") . ":" . col("."))<CR>
|
||||
|
||||
nmap <leader>e :e ~/.config/nvim/nix.vim<CR>
|
||||
|
||||
" Append modeline after last line in buffer.
|
||||
" Use substitute() instead of printf() to handle '%%s' modeline in LaTeX
|
||||
" files.
|
||||
function! AppendModeline()
|
||||
let l:modeline = printf(" vim: set ts=%d sw=%d tw=%d %set :",
|
||||
\ &tabstop, &shiftwidth, &textwidth, &expandtab ? '' : 'no')
|
||||
let l:modeline = substitute(&commentstring, "%s", l:modeline, "")
|
||||
call append(line("$"), l:modeline)
|
||||
endfunction
|
||||
nnoremap <silent> <Leader>ml :call AppendModeline()<CR>
|
||||
" vim: set ts=2 sw=2 tw=78 et :
|
Loading…
Reference in a new issue