@ -0,0 +1,11 @@ | |||||
-- General options and remaps | |||||
require('general.options') | |||||
require('general.remaps') | |||||
require('general.autocmd') | |||||
-- Helper functions | |||||
require('helper.toggle-tab-width') | |||||
-- Plugins | |||||
require('packer-plugins') |
@ -1,241 +0,0 @@ | |||||
" My awesome vimrc | |||||
let mapleader ="," | |||||
if ! filereadable(expand('~/.config/nvim/autoload/plug.vim')) | |||||
echo "Downloading junegunn/vim-plug to manage plugins..." | |||||
silent !mkdir -p ~/.config/nvim/autoload/ | |||||
silent !curl "https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim" > ~/.config/nvim/autoload/plug.vim | |||||
autocmd VimEnter * PlugInstall | |||||
endif | |||||
function! Cond(cond, ...) | |||||
let opts = get(a:000, 0, {}) | |||||
return a:cond ? opts : extend(opts, { 'on': [], 'for': [] }) | |||||
endfunction | |||||
call plug#begin('~/.config/nvim/plugged') | |||||
Plug 'neoclide/coc.nvim', Cond(!exists('g:vscode')) | |||||
Plug 'nvim-lua/popup.nvim', Cond(!exists('g:vscode')) | |||||
Plug 'nvim-lua/plenary.nvim', Cond(!exists('g:vscode')) | |||||
Plug 'nvim-telescope/telescope.nvim', Cond(!exists('g:vscode')) | |||||
Plug 'nvim-telescope/telescope-fzy-native.nvim', Cond(!exists('g:vscode')) | |||||
Plug 'Rican7/php-doc-modded' | |||||
Plug 'udalov/kotlin-vim' | |||||
Plug 'f-person/git-blame.nvim' | |||||
Plug 'vimwiki/vimwiki', Cond(!exists('g:vscode')) | |||||
Plug 'ap/vim-css-color', Cond(!exists('g:vscode')) | |||||
Plug 'dart-lang/dart-vim-plugin' | |||||
Plug 'fatih/vim-go', { 'do': ':GoUpdateBinaries' } | |||||
Plug 'darrikonn/vim-gofmt', { 'do': ':GoUpdateBinaries' } | |||||
call plug#end() | |||||
" Some basics: | |||||
set clipboard+=unnamedplus | |||||
set nohlsearch | |||||
set incsearch | |||||
set ignorecase | |||||
autocmd BufWritePre * :%s/\s\+$//e | |||||
set go=a | |||||
set mouse=a | |||||
set smartcase | |||||
set linebreak | |||||
set noswapfile | |||||
set nobackup | |||||
set undodir=~/.config/nvim/undodir | |||||
set undofile | |||||
nnoremap c "_c | |||||
set nocompatible | |||||
filetype plugin on | |||||
syntax on | |||||
set encoding=utf-8 | |||||
set number relativenumber | |||||
autocmd BufWritePre * :%s/\s\+$//e | |||||
nnoremap <leader>vs :vsplit<Enter> | |||||
nnoremap <leader>hs :split<Enter> | |||||
" Tab 2 spaces | |||||
filetype plugin indent on | |||||
set tabstop=4 softtabstop=4 expandtab shiftwidth=4 smarttab | |||||
let g:tabStop=4 | |||||
function! ToggleTabWidth() | |||||
if g:tabStop == 2 | |||||
set tabstop=4 softtabstop=4 shiftwidth=4 | |||||
let g:tabStop=4 | |||||
else | |||||
set tabstop=2 softtabstop=2 shiftwidth=2 | |||||
let g:tabStop=2 | |||||
endif | |||||
endfunction | |||||
nnoremap <leader>t :call ToggleTabWidth()<CR> | |||||
autocmd BufNewFile,BufRead *.dart setlocal tabstop=2 softtabstop=2 shiftwidth=2 | |||||
autocmd BufNewFile,BufRead *.dart let g:tabStop=2 | |||||
" Disables automatic commenting on newline: | |||||
autocmd FileType * setlocal formatoptions-=c formatoptions-=r formatoptions-=o | |||||
nnoremap <leader>t :call ToggleTabWidth()<CR> | |||||
" Disables automatic commenting on newline: | |||||
autocmd FileType * setlocal formatoptions-=c formatoptions-=r formatoptions-=o | |||||
" Remember last cursor position | |||||
autocmd BufReadPost * if @% !~# '\.git[\/\\]COMMIT_EDITMSG$' && line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g`\"" | endif | |||||
" Automatically save the current session whenever vim is closed | |||||
autocmd VimLeave * mksession! ~/.config/nvim/session/shutdown_session.vim | |||||
" <F7> restores that 'shutdown session' | |||||
noremap <F7> :source ~/.config/nvim/session/shutdown_session.vim<CR> | |||||
" If you really want to, this next line should restore the shutdown session | |||||
" automatically, whenever you start vim. (Commented out for now, in case | |||||
" somebody just copy/pastes this whole block) | |||||
" | |||||
" autocmd VimEnter source ~/.vim/shutdown_session.vim<CR> | |||||
" manually save a session with <F5> | |||||
noremap <F5> :mksession! ~/.config/nvim/session/manual_session.vim<cr> | |||||
" recall the manually saved session with <F6> | |||||
noremap <F6> :source ~/.config/nvim/session/manual_session.vim<cr> | |||||
" Copy entire document | |||||
noremap <leader>y <Esc>ggyG<C-o> | |||||
map <leader>y <Esc>ggyG<C-o> | |||||
" Set gohtml template files to html syntax | |||||
autocmd BufNewFile,BufRead *.gohtml set syntax=html | |||||
nnoremap <leader>1 1gt | |||||
nnoremap <leader>2 2gt | |||||
nnoremap <leader>3 3gt | |||||
nnoremap <leader>4 4gt | |||||
nnoremap <leader>5 5gt | |||||
" NETRW | |||||
let g:netrw_liststyle = 3 | |||||
let g:netrw_banner = 0 | |||||
let g:netrw_browse_split = 4 | |||||
let g:netrw_winsize = 20 | |||||
let g:netrw_altv = 1 | |||||
let g:NetrwIsOpen=0 | |||||
function! ToggleNetrw() | |||||
if g:NetrwIsOpen | |||||
let i = bufnr("$") | |||||
while (i >= 1) | |||||
if (getbufvar(i, "&filetype") == "netrw") | |||||
silent exe "bwipeout " . i | |||||
endif | |||||
let i-=1 | |||||
endwhile | |||||
let g:NetrwIsOpen=0 | |||||
else | |||||
let g:NetrwIsOpen=1 | |||||
silent Lexplore | |||||
endif | |||||
endfunction | |||||
" Add your own mapping. For example: | |||||
noremap <silent> <C-p> :call ToggleNetrw()<CR> | |||||
" coc | |||||
highlight CocErrorSign ctermfg=Black ctermbg=Magenta | |||||
inoremap <silent><expr> <TAB> | |||||
\ pumvisible() ? "\<C-n>" : | |||||
\ <SID>check_back_space() ? "\<TAB>" : | |||||
\ coc#refresh() | |||||
inoremap <expr><S-TAB> pumvisible() ? "\<C-p>" : "\<C-h>" | |||||
function! s:check_back_space() abort | |||||
let col = col('.') - 1 | |||||
return !col || getline('.')[col - 1] =~# '\s' | |||||
endfunction | |||||
nmap <leader>gd <Plug>(coc-definition) | |||||
nmap <leader>gr <Plug>(coc-references) | |||||
nmap <leader>rr <Plug>(coc-rename) | |||||
nnoremap <leader>prw :CocSearch <C-R>=expand("<cword>")<CR><CR> | |||||
inoremap <expr> <C-j> pumvisible() ? "\<Down>" : "\<C-j>" | |||||
inoremap <expr> <C-k> pumvisible() ? "\<Up>" : "\<C-k>" | |||||
" PHP Doc | |||||
nnoremap <leader>h :call UpdatePhpDocIfExists()<CR> | |||||
function! UpdatePhpDocIfExists() | |||||
normal! k | |||||
if getline('.') =~ '/' | |||||
normal! V%d | |||||
else | |||||
normal! j | |||||
endif | |||||
call PhpDocSingle() | |||||
normal! k^%k$ | |||||
if getline('.') =~ ';' | |||||
exe "normal! $svoid" | |||||
endif | |||||
endfunction | |||||
nnoremap <C-D> :call UpdatePhpDocIfExists()<CR> | |||||
" VimWiki | |||||
au filetype vimwiki silent! iunmap <buffer> <Tab> | |||||
try | |||||
nmap <silent> <leader>ej :call CocAction('diagnosticNext')<cr> | |||||
nmap <silent> <leader>ek :call CocAction('diagnosticPrevious')<cr> | |||||
endtry | |||||
" Telescope remaps | |||||
lua require("telescope") | |||||
nnoremap <C-g> :lua require('telescope.builtin').grep_string({ search = vim.fn.input("Grep For > ")})<CR> | |||||
nnoremap <C-p> :lua require('telescope.builtin').git_files()<CR> | |||||
nnoremap <C-q> :lua require('telescope.builtin').find_files()<CR> | |||||
nnoremap <leader>fb <cmd>lua require('telescope.builtin').buffers()<cr> | |||||
" Spell-check | |||||
map <leader>o :setlocal spell! spelllang=en_au<CR> | |||||
" Shortcutting split navigation, saving a keypress: | |||||
nnoremap <C-h> <C-w>h | |||||
nnoremap <C-j> <C-w>j | |||||
nnoremap <C-k> <C-w>k | |||||
nnoremap <C-l> <C-w>l | |||||
" Replace all is aliased to S. | |||||
nnoremap <c-s> :%s//g<Left><Left> | |||||
" Navigating with guides | |||||
inoremap <leader><leader> <Esc>/<++><Enter>"_c4l | |||||
vnoremap <leader><leader> <Esc>/<++><Enter>"_c4l | |||||
map <leader><leader> <Esc>/<++><Enter>"_c4l | |||||
augroup twig_ft | |||||
au! | |||||
autocmd BufNewFile,BufRead *.docker set syntax=dockerfile | |||||
augroup END | |||||
@ -0,0 +1,33 @@ | |||||
-- Remove any trailing whitespace from the file on write | |||||
vim.api.nvim_create_autocmd({ 'BufWritePre' }, { command = [[%s/\s\+$//e]] }) | |||||
-- Load file on last line | |||||
-- TODO: change this to use lua | |||||
vim.api.nvim_create_autocmd({ 'BufRead' }, { | |||||
command = [[if @% !~# '\.git[\/\\]COMMIT_EDITMSG$' && line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g`\"" | endif]] | |||||
}) | |||||
-- Save session on VimLeave | |||||
vim.api.nvim_create_autocmd({ 'VimLeave' }, { | |||||
command = [[mksession! ~/.config/nvim/session/shutdown_session.vim]] | |||||
}) | |||||
-- Set tabs to 2 for dart, vue, and js files | |||||
vim.api.nvim_create_autocmd({ 'BufNewFile', 'BufRead' }, { | |||||
pattern = { '*.dart', '*.vue', '*.js' }, | |||||
callback = function() | |||||
vim.o.tabstop = 2 | |||||
vim.o.softtabstop = 2 | |||||
vim.o.shiftwidth = 2 | |||||
end | |||||
}) | |||||
-- Ensure to read .docker files as a dockerfile | |||||
vim.api.nvim_create_autocmd({ 'BufNewFile', 'BufRead' }, { | |||||
pattern = { '*.docker' }, | |||||
callback = function() | |||||
vim.o.syntax = 'dockerfile' | |||||
end | |||||
}) | |||||
@ -0,0 +1,30 @@ | |||||
vim.g.mapleader = ',' | |||||
vim.o.clipboard = 'unnamedplus' | |||||
vim.o.nohlsearch = true | |||||
vim.o.incsearch = true | |||||
vim.o.ignorecase = true | |||||
-- autocmd BufWritePre * :%s/\s\+$//e | |||||
vim.o.mouse = 'a' | |||||
vim.o.smartcase = true | |||||
vim.o.linebreak = true | |||||
vim.o.noswapfile = true | |||||
vim.o.nobackup = true | |||||
vim.o.undodir = vim.fn.expand('~/.config/nvim/undodir') | |||||
vim.o.undofile = true | |||||
vim.o.encoding = 'utf-8' | |||||
vim.o.number = true | |||||
vim.o.relativenumber = true | |||||
vim.o.tabstop = 4 | |||||
vim.o.softtabstop = 4 | |||||
vim.o.expandtab = true | |||||
vim.o.shiftwidth = 4 | |||||
vim.o.smarttab = true | |||||
vim.o.formatoptions = 'tqj' |
@ -0,0 +1,25 @@ | |||||
return require('packer').startup(function() | |||||
-- Packer can manage itself | |||||
use 'wbthomason/packer.nvim' | |||||
-- colorscheme | |||||
use 'gruvbox-community/gruvbox' | |||||
use { 'neoclide/coc.nvim', run = 'yarn install' } | |||||
use 'nvim-lua/popup.nvim' | |||||
use 'nvim-lua/plenary.nvim' | |||||
use 'nvim-telescope/telescope.nvim' | |||||
use 'nvim-telescope/telescope-fzy-native.nvim' | |||||
use 'Rican7/php-doc-modded' | |||||
use 'f-person/git-blame.nvim' | |||||
use 'dart-lang/dart-vim-plugin' | |||||
use { 'fatih/vim-go', cmd = 'GoUpdateBinaries' } | |||||
use { 'darrikonn/vim-gofmt', cmd = 'GoUpdateBinaries' } | |||||
use 'aserowy/tmux.nvim' | |||||
end) |
@ -0,0 +1,35 @@ | |||||
local options = { noremap = true } | |||||
vim.api.nvim_set_keymap('n', 'c', '"_c', options) | |||||
-- Easily open splits | |||||
vim.api.nvim_set_keymap('n', '<leader>hs', '<cmd>split<cr>', options) | |||||
vim.api.nvim_set_keymap('n', '<leader>vs', '<cmd>vsplit<cr>', options) | |||||
-- Copy the entire file | |||||
vim.api.nvim_set_keymap('n', '<leader>y', 'ggyG<C-o>', options) | |||||
-- Easily navigate tabs | |||||
vim.api.nvim_set_keymap('n', '<leader>1', '1gt', options) | |||||
vim.api.nvim_set_keymap('n', '<leader>2', '2gt', options) | |||||
vim.api.nvim_set_keymap('n', '<leader>3', '3gt', options) | |||||
vim.api.nvim_set_keymap('n', '<leader>4', '4gt', options) | |||||
vim.api.nvim_set_keymap('n', '<leader>5', '5gt', options) | |||||
-- Manually store session | |||||
vim.api.nvim_set_keymap('n', '<F5>', '<cmd>mksession! ~/.config/nvim/session/manual_session.vim<cr>', options) | |||||
-- Restore manually stored session | |||||
vim.api.nvim_set_keymap('n', '<F6>', '<cmd>source ~/.config/nvim/session/manual_session.vim<cr>', options) | |||||
-- Restore auto saved session created on exit | |||||
vim.api.nvim_set_keymap('n', '<F7>', '<cmd>source ~/.config/nvim/session/shutdown_session.vim<CR>', options) | |||||
-- Replace all is aliased to S. | |||||
vim.api.nvim_set_keymap('n', '<C-s>', '<cmd>%s//g<Left><Left>', options) | |||||
-- Navigating with guides | |||||
vim.api.nvim_set_keymap('n', '<leader><leader>', '<Esc>/<++><Enter>"_c4l', options) | |||||
vim.api.nvim_set_keymap('i', '<leader><leader>', '<Esc>/<++><Enter>"_c4l', options) | |||||
vim.api.nvim_set_keymap('v', '<leader><leader>', '<Esc>/<++><Enter>"_c4l', options) | |||||
-- Spell-check | |||||
vim.api.nvim_set_keymap('n', '<leader>o', '<cmd>setlocal spell! spelllang=en_au<cr>', options) |
@ -0,0 +1,21 @@ | |||||
vim.o.signcolumn = 'number' | |||||
-- Bind tab to select next tab complete | |||||
vim.api.nvim_set_keymap("i", "<TAB>", "pumvisible() ? '<C-n>' : '<TAB>'", {noremap = true, silent = true, expr = true}) | |||||
vim.api.nvim_set_keymap("n", "<leader>.", "<Plug>(coc-codeaction)", {}) | |||||
vim.api.nvim_set_keymap("n", "<leader>l", ":CocCommand eslint.executeAutofix<CR>", {}) | |||||
vim.api.nvim_set_keymap("n", "gd", "<Plug>(coc-definition)", {silent = true}) | |||||
vim.api.nvim_set_keymap("n", "gr", "<Plug>(coc-references)", {silent = true}) | |||||
vim.api.nvim_set_keymap("n", "K", ":call CocActionAsync('doHover')<CR>", {silent = true, noremap = true}) | |||||
vim.api.nvim_set_keymap("n", "<leader>rn", "<Plug>(coc-rename)", {}) | |||||
vim.api.nvim_set_keymap("n", "<leader>f", ":CocCommand prettier.formatFile<CR>", {noremap = true}) | |||||
vim.api.nvim_set_keymap("n", "g[", ":call CocActionAsync('diagnosticPrevious')<CR>", {silent = true, noremap = true}) | |||||
vim.api.nvim_set_keymap("n", "g]", ":call CocActionAsync('diagnosticNext')<CR>", {silent = true, noremap = true}) | |||||
vim.keymap.set("n", "<C-space>", vim.fn['coc#refresh'](), {silent = true, noremap = true}) | |||||
-- Bind Ctrl + j,k to up and down for COC completion | |||||
vim.api.nvim_set_keymap('i', '<C-j>', "pumvisible() ? '<Down>' : '<C-j>'", { noremap = true, expr = true, silent = true }) | |||||
vim.api.nvim_set_keymap('i', '<C-k>', "pumvisible() ? '<Up>' : '<C-k>'", { noremap = true, expr = true, silent = true }) |
@ -0,0 +1 @@ | |||||
vim.cmd[[colorscheme gruvbox]] |
@ -0,0 +1,159 @@ | |||||
-- Automatically generated packer.nvim plugin loader code | |||||
if vim.api.nvim_call_function('has', {'nvim-0.5'}) ~= 1 then | |||||
vim.api.nvim_command('echohl WarningMsg | echom "Invalid Neovim version for packer.nvim! | echohl None"') | |||||
return | |||||
end | |||||
vim.api.nvim_command('packadd packer.nvim') | |||||
local no_errors, error_msg = pcall(function() | |||||
local time | |||||
local profile_info | |||||
local should_profile = false | |||||
if should_profile then | |||||
local hrtime = vim.loop.hrtime | |||||
profile_info = {} | |||||
time = function(chunk, start) | |||||
if start then | |||||
profile_info[chunk] = hrtime() | |||||
else | |||||
profile_info[chunk] = (hrtime() - profile_info[chunk]) / 1e6 | |||||
end | |||||
end | |||||
else | |||||
time = function(chunk, start) end | |||||
end | |||||
local function save_profiles(threshold) | |||||
local sorted_times = {} | |||||
for chunk_name, time_taken in pairs(profile_info) do | |||||
sorted_times[#sorted_times + 1] = {chunk_name, time_taken} | |||||
end | |||||
table.sort(sorted_times, function(a, b) return a[2] > b[2] end) | |||||
local results = {} | |||||
for i, elem in ipairs(sorted_times) do | |||||
if not threshold or threshold and elem[2] > threshold then | |||||
results[i] = elem[1] .. ' took ' .. elem[2] .. 'ms' | |||||
end | |||||
end | |||||
_G._packer = _G._packer or {} | |||||
_G._packer.profile_output = results | |||||
end | |||||
time([[Luarocks path setup]], true) | |||||
local package_path_str = "/home/tovi/.cache/nvim/packer_hererocks/2.1.0-beta3/share/lua/5.1/?.lua;/home/tovi/.cache/nvim/packer_hererocks/2.1.0-beta3/share/lua/5.1/?/init.lua;/home/tovi/.cache/nvim/packer_hererocks/2.1.0-beta3/lib/luarocks/rocks-5.1/?.lua;/home/tovi/.cache/nvim/packer_hererocks/2.1.0-beta3/lib/luarocks/rocks-5.1/?/init.lua" | |||||
local install_cpath_pattern = "/home/tovi/.cache/nvim/packer_hererocks/2.1.0-beta3/lib/lua/5.1/?.so" | |||||
if not string.find(package.path, package_path_str, 1, true) then | |||||
package.path = package.path .. ';' .. package_path_str | |||||
end | |||||
if not string.find(package.cpath, install_cpath_pattern, 1, true) then | |||||
package.cpath = package.cpath .. ';' .. install_cpath_pattern | |||||
end | |||||
time([[Luarocks path setup]], false) | |||||
time([[try_loadstring definition]], true) | |||||
local function try_loadstring(s, component, name) | |||||
local success, result = pcall(loadstring(s), name, _G.packer_plugins[name]) | |||||
if not success then | |||||
vim.schedule(function() | |||||
vim.api.nvim_notify('packer.nvim: Error running ' .. component .. ' for ' .. name .. ': ' .. result, vim.log.levels.ERROR, {}) | |||||
end) | |||||
end | |||||
return result | |||||
end | |||||
time([[try_loadstring definition]], false) | |||||
time([[Defining packer_plugins]], true) | |||||
_G.packer_plugins = { | |||||
["coc.nvim"] = { | |||||
loaded = true, | |||||
path = "/home/tovi/.local/share/nvim/site/pack/packer/start/coc.nvim", | |||||
url = "https://github.com/neoclide/coc.nvim" | |||||
}, | |||||
["dart-vim-plugin"] = { | |||||
loaded = true, | |||||
path = "/home/tovi/.local/share/nvim/site/pack/packer/start/dart-vim-plugin", | |||||
url = "https://github.com/dart-lang/dart-vim-plugin" | |||||
}, | |||||
["git-blame.nvim"] = { | |||||
loaded = true, | |||||
path = "/home/tovi/.local/share/nvim/site/pack/packer/start/git-blame.nvim", | |||||
url = "https://github.com/f-person/git-blame.nvim" | |||||
}, | |||||
gruvbox = { | |||||
loaded = true, | |||||
path = "/home/tovi/.local/share/nvim/site/pack/packer/start/gruvbox", | |||||
url = "https://github.com/gruvbox-community/gruvbox" | |||||
}, | |||||
["packer.nvim"] = { | |||||
loaded = true, | |||||
path = "/home/tovi/.local/share/nvim/site/pack/packer/start/packer.nvim", | |||||
url = "https://github.com/wbthomason/packer.nvim" | |||||
}, | |||||
["php-doc-modded"] = { | |||||
loaded = true, | |||||
path = "/home/tovi/.local/share/nvim/site/pack/packer/start/php-doc-modded", | |||||
url = "https://github.com/Rican7/php-doc-modded" | |||||
}, | |||||
["plenary.nvim"] = { | |||||
loaded = true, | |||||
path = "/home/tovi/.local/share/nvim/site/pack/packer/start/plenary.nvim", | |||||
url = "https://github.com/nvim-lua/plenary.nvim" | |||||
}, | |||||
["popup.nvim"] = { | |||||
loaded = true, | |||||
path = "/home/tovi/.local/share/nvim/site/pack/packer/start/popup.nvim", | |||||
url = "https://github.com/nvim-lua/popup.nvim" | |||||
}, | |||||
["telescope-fzy-native.nvim"] = { | |||||
loaded = true, | |||||
path = "/home/tovi/.local/share/nvim/site/pack/packer/start/telescope-fzy-native.nvim", | |||||
url = "https://github.com/nvim-telescope/telescope-fzy-native.nvim" | |||||
}, | |||||
["telescope.nvim"] = { | |||||
loaded = true, | |||||
path = "/home/tovi/.local/share/nvim/site/pack/packer/start/telescope.nvim", | |||||
url = "https://github.com/nvim-telescope/telescope.nvim" | |||||
}, | |||||
["tmux.nvim"] = { | |||||
loaded = true, | |||||
path = "/home/tovi/.local/share/nvim/site/pack/packer/start/tmux.nvim", | |||||
url = "https://github.com/aserowy/tmux.nvim" | |||||
}, | |||||
["vim-go"] = { | |||||
commands = { "GoUpdateBinaries" }, | |||||
loaded = false, | |||||
needs_bufread = true, | |||||
only_cond = false, | |||||
path = "/home/tovi/.local/share/nvim/site/pack/packer/opt/vim-go", | |||||
url = "https://github.com/fatih/vim-go" | |||||
}, | |||||
["vim-gofmt"] = { | |||||
commands = { "GoUpdateBinaries" }, | |||||
loaded = false, | |||||
needs_bufread = true, | |||||
only_cond = false, | |||||
path = "/home/tovi/.local/share/nvim/site/pack/packer/opt/vim-gofmt", | |||||
url = "https://github.com/darrikonn/vim-gofmt" | |||||
} | |||||
} | |||||
time([[Defining packer_plugins]], false) | |||||
-- Command lazy-loads | |||||
time([[Defining lazy-load commands]], true) | |||||
pcall(vim.cmd, [[command -nargs=* -range -bang -complete=file GoUpdateBinaries lua require("packer.load")({'vim-go', 'vim-gofmt'}, { cmd = "GoUpdateBinaries", l1 = <line1>, l2 = <line2>, bang = <q-bang>, args = <q-args>, mods = "<mods>" }, _G.packer_plugins)]]) | |||||
time([[Defining lazy-load commands]], false) | |||||
if should_profile then save_profiles() end | |||||
end) | |||||
if not no_errors then | |||||
error_msg = error_msg:gsub('"', '\\"') | |||||
vim.api.nvim_command('echohl ErrorMsg | echom "Error in packer_compiled: '..error_msg..'" | echom "Please check your config for correctness" | echohl None') | |||||
end |
@ -0,0 +1,7 @@ | |||||
vim.keymap.set('n', '<C-d>', function () | |||||
if vim.bo.filetype ~= 'php' then | |||||
return | |||||
end | |||||
vim.api.nvim_call_function("PhpDocSingle", {}) | |||||
end, options) |
@ -0,0 +1,60 @@ | |||||
local pickers = require("telescope.pickers") | |||||
local finders = require("telescope.finders") | |||||
local previewers = require("telescope.previewers") | |||||
local action_state = require("telescope.actions.state") | |||||
local conf = require("telescope.config").values | |||||
local actions = require("telescope.actions") | |||||
require("telescope").setup({ | |||||
defaults = { | |||||
file_sorter = require("telescope.sorters").get_fzy_sorter, | |||||
prompt_prefix = " >", | |||||
color_devicons = true, | |||||
file_previewer = require("telescope.previewers").vim_buffer_cat.new, | |||||
grep_previewer = require("telescope.previewers").vim_buffer_vimgrep.new, | |||||
qflist_previewer = require("telescope.previewers").vim_buffer_qflist.new, | |||||
mappings = { | |||||
i = { | |||||
["<C-x>"] = false, | |||||
["<C-q>"] = actions.send_to_qflist, | |||||
}, | |||||
}, | |||||
}, | |||||
}) | |||||
local M = {} | |||||
function git_branches () | |||||
require("telescope.builtin").git_branches({ | |||||
attach_mappings = function(_, map) | |||||
map("i", "<c-d>", actions.git_delete_branch) | |||||
map("n", "<c-d>", actions.git_delete_branch) | |||||
return true | |||||
end, | |||||
}) | |||||
end | |||||
local options = { noremap = true } | |||||
vim.keymap.set('n', '<C-g>', function() | |||||
local term = vim.fn.input("Grep For > ") | |||||
if term == '' then | |||||
return | |||||
end | |||||
require('telescope.builtin').grep_string({ search = term }) | |||||
end, options) | |||||
vim.keymap.set('n', '<C-p>', function() | |||||
local ran, errorMessage = pcall(require('telescope.builtin').git_files) | |||||
if not ran then | |||||
require('telescope.builtin').find_files() | |||||
end | |||||
end, options) | |||||
-- vim.keymap.set('n', '<C-q>', function() | |||||
-- end, options) | |||||
vim.keymap.set('n', '<leader>fb', require('telescope.builtin').buffers, options) | |||||
@ -0,0 +1,17 @@ | |||||
require("tmux").setup({ | |||||
-- overwrite default configuration | |||||
-- here, e.g. to enable default bindings | |||||
copy_sync = { | |||||
-- enables copy sync and overwrites all register actions to | |||||
-- sync registers *, +, unnamed, and 0 till 9 from tmux in advance | |||||
enable = true, | |||||
}, | |||||
navigation = { | |||||
-- enables default keybindings (C-hjkl) for normal mode | |||||
enable_default_keybindings = true, | |||||
}, | |||||
resize = { | |||||
-- enables default keybindings (A-hjkl) for normal mode | |||||
enable_default_keybindings = true, | |||||
} | |||||
}) |
@ -1,27 +0,0 @@ | |||||
local actions = require('telescope.actions') | |||||
require('telescope').setup { | |||||
defaults = { | |||||
file_sorter = require('telescope.sorters').get_fzy_sorter, | |||||
prompt_prefix = ' >', | |||||
color_devicons = true, | |||||
file_previewer = require('telescope.previewers').vim_buffer_cat.new, | |||||
grep_previewer = require('telescope.previewers').vim_buffer_vimgrep.new, | |||||
qflist_previewer = require('telescope.previewers').vim_buffer_qflist.new, | |||||
mappings = { | |||||
i = { | |||||
["<C-x>"] = false, | |||||
["<C-q>"] = actions.send_to_qflist, | |||||
}, | |||||
} | |||||
}, | |||||
extensions = { | |||||
fzy_native = { | |||||
override_generic_sorter = false, | |||||
override_file_sorter = true, | |||||
} | |||||
} | |||||
} | |||||
require('telescope').load_extension('fzy_native') |